LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
Abstract/Header.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_ABSTRACT_HEADER_H
17#define LIEF_ABSTRACT_HEADER_H
18
19#include <ostream>
20#include <set>
21
22#include "LIEF/Object.hpp"
23#include "LIEF/visibility.h"
24#include "LIEF/types.hpp"
25
26#include "LIEF/Abstract/enums.hpp"
27
28namespace LIEF {
29class LIEF_API Header : public Object {
30 public:
31 Header();
32 Header(const Header&);
33 Header& operator=(const Header&);
34 ~Header() override;
35
36
37 ARCHITECTURES architecture() const;
38 const std::set<MODES>& modes() const;
39 OBJECT_TYPES object_type() const;
40 uint64_t entrypoint() const;
41 ENDIANNESS endianness() const;
42
43
45 bool is_32() const;
46
48 bool is_64() const;
49
51 void accept(Visitor& visitor) const override;
52
53 void architecture(ARCHITECTURES arch);
54 void modes(const std::set<MODES>& m);
55 void object_type(OBJECT_TYPES type);
56 void entrypoint(uint64_t entrypoint);
57 void endianness(ENDIANNESS endianness);
58
59 LIEF_API friend std::ostream& operator<<(std::ostream& os, const Header& hdr);
60
61 protected:
62 ARCHITECTURES architecture_ = ARCHITECTURES::ARCH_NONE;
63 std::set<MODES> modes_;
64 OBJECT_TYPES object_type_ = OBJECT_TYPES::TYPE_NONE;
65 uint64_t entrypoint_ = 0;
66 ENDIANNESS endianness_ = ENDIANNESS::ENDIAN_NONE;
67
68
69};
70}
71
72#endif
Definition Abstract/Header.hpp:29
void accept(Visitor &visitor) const override
Method so that the visitor can visit us.
bool is_32() const
true if the binary target a 32-bits architecture
bool is_64() const
true if the binary target a 64-bits architecture
Definition Object.hpp:25
Definition Visitor.hpp:219
LIEF namespace.
Definition Abstract/Binary.hpp:32