LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
DynamicSharedObject.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 * Copyright 2017 - 2026 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_ELF_DYNAMIC_SHARED_OBJECT_H
17#define LIEF_ELF_DYNAMIC_SHARED_OBJECT_H
18
19#include <string>
20
21#include "LIEF/visibility.h"
23
24namespace LIEF {
25namespace ELF {
26
32
33 public:
37
39 DynamicEntry(DynamicEntry::TAG::SONAME, 0),
40 name_(std::move(name)) {}
41
44
45 std::unique_ptr<DynamicEntry> clone() const override {
46 return std::unique_ptr<DynamicSharedObject>(new DynamicSharedObject(*this));
47 }
48
50 const std::string& name() const {
51 return name_;
52 }
53
54 void name(std::string name) {
55 name_ = std::move(name);
56 }
57
58 void accept(Visitor& visitor) const override;
59
60 std::ostream& print(std::ostream& os) const override;
61
62 static bool classof(const DynamicEntry* entry) {
63 return entry->tag() == DynamicEntry::TAG::SONAME;
64 }
65
66 ~DynamicSharedObject() override = default;
67
68 private:
69 std::string name_;
70};
71}
72}
73#endif
TAG
Definition DynamicEntry.hpp:48
@ SONAME
Definition DynamicEntry.hpp:64
TAG tag() const
Tag of the current entry. The most common tags are: DT_NEEDED, DT_INIT, ...
Definition DynamicEntry.hpp:309
~DynamicSharedObject() override=default
void name(std::string name)
Definition DynamicSharedObject.hpp:54
DynamicSharedObject(std::string name)
Definition DynamicSharedObject.hpp:38
void accept(Visitor &visitor) const override
std::unique_ptr< DynamicEntry > clone() const override
Definition DynamicSharedObject.hpp:45
std::ostream & print(std::ostream &os) const override
DynamicSharedObject(const DynamicSharedObject &)=default
DynamicSharedObject()
Definition DynamicSharedObject.hpp:35
static bool classof(const DynamicEntry *entry)
Definition DynamicSharedObject.hpp:62
const std::string & name() const
The actual name (e.g. libMyLib.so).
Definition DynamicSharedObject.hpp:50
DynamicSharedObject & operator=(const DynamicSharedObject &)=default
Definition Visitor.hpp:212
Namespace related to the LIEF's ELF module.
Definition Abstract/Header.hpp:28
LIEF namespace.
Definition Abstract/Binary.hpp:40
#define LIEF_API
Definition visibility.h:43