LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
EnumType.hpp
Go to the documentation of this file.
1/* Copyright 2022 - 2026 R. Thomas
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef LIEF_DWARF_EDITOR_ENUM_TYPE_H
16#define LIEF_DWARF_EDITOR_ENUM_TYPE_H
17#include <cstdint>
18#include <string>
19
20#include "LIEF/visibility.h"
22
23namespace LIEF {
24namespace dwarf {
25namespace editor {
26
27namespace details {
28class EnumValue;
29}
30
32class LIEF_API EnumType : public Type {
33 public:
34 template<typename... Args,
35 typename = typename std::
36 enable_if<std::is_constructible<Type, Args&&...>::value>::type>
37 EnumType(Args&&... args) :
38 Type(std::forward<Args>(args)...) {}
39
42 public:
43 Value() = delete;
44 Value(std::unique_ptr<details::EnumValue> impl);
45
47
48 private:
49 std::unique_ptr<details::EnumValue> impl_;
50 };
51
54 EnumType& set_size(uint64_t size);
55
58
60 std::unique_ptr<Value> add_value(const std::string& name, int64_t value);
61
62 static bool classof(const Type* type);
63
64 ~EnumType() override = default;
65};
66
67}
68}
69}
70#endif
Value(std::unique_ptr< details::EnumValue > impl)
EnumType & set_underlying_type(const Type &type)
Set the underlying type that is used to encode this enum.
EnumType & set_size(uint64_t size)
Define the number of bytes required to hold an instance of the enumeration (DW_AT_byte_size).
EnumType(Args &&... args)
Definition EnumType.hpp:37
~EnumType() override=default
static bool classof(const Type *type)
std::unique_ptr< Value > add_value(const std::string &name, int64_t value)
Add an enum value by specifying its name and its integer value.
Definition DWARF/editor/CompilationUnit.hpp:36
Definition Editor.hpp:31
Namespace for the DWARF debug format.
Definition DWARF/CompilationUnit.hpp:28
LIEF namespace.
Definition Abstract/Binary.hpp:40
#define LIEF_API
Definition visibility.h:45