LIEF: Library to Instrument Executable Formats Version 0.15.1
Loading...
Searching...
No Matches
Abstract/Header.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_ABSTRACT_HEADER_H
17#define LIEF_ABSTRACT_HEADER_H
18
19#include <ostream>
20#include <set>
21#include <cstdint>
22
23#include "LIEF/Object.hpp"
24#include "LIEF/visibility.h"
25
27
28namespace LIEF {
29class LIEF_API Header : public Object {
30 public:
32 Header(const Header&);
34 ~Header() override;
35
36
38 const std::set<MODES>& modes() const;
40 uint64_t entrypoint() const;
42
43
45 bool is_32() const;
46
48 bool is_64() const;
49
51 void accept(Visitor& visitor) const override;
52
54 void modes(const std::set<MODES>& m);
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#endif
Definition Abstract/Header.hpp:29
uint64_t entrypoint() const
ARCHITECTURES architecture() const
OBJECT_TYPES object_type() const
void endianness(ENDIANNESS endianness)
const std::set< MODES > & modes() const
void entrypoint(uint64_t entrypoint)
friend std::ostream & operator<<(std::ostream &os, const Header &hdr)
Header(const Header &)
ENDIANNESS endianness() const
void modes(const std::set< MODES > &m)
void object_type(OBJECT_TYPES type)
void accept(Visitor &visitor) const override
Method so that the visitor can visit us.
void architecture(ARCHITECTURES arch)
bool is_32() const
true if the binary target a 32-bits architecture
~Header() override
Header & operator=(const Header &)
bool is_64() const
true if the binary target a 64-bits architecture
Definition Object.hpp:25
Definition Visitor.hpp:224
LIEF namespace.
Definition Abstract/Binary.hpp:32
OBJECT_TYPES
Definition Abstract/enums.hpp:21
ARCHITECTURES
Definition Abstract/enums.hpp:29
ENDIANNESS
Definition Abstract/enums.hpp:63
#define LIEF_API
Definition visibility.h:41