LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
DynamicSharedObject.hpp
1/* Copyright 2017 - 2024 R. Thomas
2 * Copyright 2017 - 2024 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"
22#include "LIEF/ELF/DynamicEntry.hpp"
23
24namespace LIEF {
25namespace ELF {
26
31class LIEF_API DynamicSharedObject : public DynamicEntry {
32
33 public:
34 using DynamicEntry::DynamicEntry;
36 DynamicEntry(DynamicEntry::TAG::SONAME, 0)
37 {}
38
39 DynamicSharedObject(std::string name) :
40 DynamicEntry(DynamicEntry::TAG::SONAME, 0),
41 name_(std::move(name))
42 {}
43
44 DynamicSharedObject& operator=(const DynamicSharedObject&) = default;
46
47 std::unique_ptr<DynamicEntry> clone() const override {
48 return std::unique_ptr<DynamicSharedObject>(new DynamicSharedObject(*this));
49 }
50
52 const std::string& name() const {
53 return name_;
54 }
55
56 void name(std::string name) {
57 name_ = std::move(name);
58 }
59
60 void accept(Visitor& visitor) const override;
61
62 std::ostream& print(std::ostream& os) const override;
63
64 static bool classof(const DynamicEntry* entry) {
65 return entry->tag() == DynamicEntry::TAG::SONAME;
66 }
67
68 ~DynamicSharedObject() override = default;
69
70 private:
71 std::string name_;
72};
73}
74}
75#endif
Class which represents an entry in the dynamic table These entries are located in the ....
Definition DynamicEntry.hpp:37
Class which represents a DT_SONAME entry in the dynamic table This kind of entry is usually used to n...
Definition DynamicSharedObject.hpp:31
const std::string & name() const
The actual name (e.g. libMyLib.so)
Definition DynamicSharedObject.hpp:52
Definition Visitor.hpp:219
LIEF namespace.
Definition Abstract/Binary.hpp:32