LIEF: Library to Instrument Executable Formats Version 0.15.1
Loading...
Searching...
No Matches
SymbolVersion.hpp
Go to the documentation of this file.
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_SYMBOL_VERSION_H
17#define LIEF_ELF_SYMBOL_VERSION_H
18#include <ostream>
19#include <cstdint>
20
21#include "LIEF/Object.hpp"
22#include "LIEF/visibility.h"
23
24namespace LIEF {
25namespace ELF {
26class Parser;
27class SymbolVersionAux;
28class SymbolVersionAuxRequirement;
29
33 friend class Parser;
34
35 public:
36 SymbolVersion(uint16_t value) :
37 value_(value)
38 {}
39 SymbolVersion() = default;
40
43 return SymbolVersion(0);
44 }
45
48 return SymbolVersion(1);
49 }
50
51 ~SymbolVersion() override = default;
52
54 SymbolVersion(const SymbolVersion&) = default;
55
62 uint16_t value() const {
63 return value_;
64 }
65
67 bool has_auxiliary_version() const {
68 return symbol_version_auxiliary() != nullptr;
69 }
70
74 return symbol_aux_;
75 }
76
78 return symbol_aux_;
79 }
80
88
89 void value(uint16_t v) {
90 value_ = v;
91 }
92
93 void accept(Visitor& visitor) const override;
94
95 LIEF_API friend std::ostream& operator<<(std::ostream& os, const SymbolVersion& symv);
96
97 private:
98 uint16_t value_ = 0;
99 SymbolVersionAux* symbol_aux_ = nullptr;
100};
101}
102}
103#endif
Class which parses and transforms an ELF file into a ELF::Binary object.
Definition ELF/Parser.hpp:45
Definition SymbolVersionAuxRequirement.hpp:35
Class which represents an Auxiliary Symbol version.
Definition SymbolVersionAux.hpp:30
Class which represents an entry defined in the DT_VERSYM dynamic entry.
Definition SymbolVersion.hpp:32
const SymbolVersionAux * symbol_version_auxiliary() const
Definition SymbolVersion.hpp:77
bool has_auxiliary_version() const
Whether the current SymbolVersion has an auxiliary one.
Definition SymbolVersion.hpp:67
SymbolVersion & operator=(const SymbolVersion &)=default
static SymbolVersion local()
Generate a local SymbolVersion.
Definition SymbolVersion.hpp:42
~SymbolVersion() override=default
friend std::ostream & operator<<(std::ostream &os, const SymbolVersion &symv)
void accept(Visitor &visitor) const override
SymbolVersion(const SymbolVersion &)=default
void symbol_version_auxiliary(SymbolVersionAuxRequirement &svauxr)
Set the version's auxiliary requirement The given SymbolVersionAuxRequirement must be an existing ref...
static SymbolVersion global()
Generate a global SymbolVersion.
Definition SymbolVersion.hpp:47
SymbolVersion(uint16_t value)
Definition SymbolVersion.hpp:36
void value(uint16_t v)
Definition SymbolVersion.hpp:89
SymbolVersionAux * symbol_version_auxiliary()
SymbolVersionAux associated with the current Version if any, or a nullptr.
Definition SymbolVersion.hpp:73
uint16_t value() const
Value associated with the symbol.
Definition SymbolVersion.hpp:62
Definition Object.hpp:25
Definition Visitor.hpp:224
LIEF namespace.
Definition Abstract/Binary.hpp:32
#define LIEF_API
Definition visibility.h:41