LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
Object.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_OBJECT_H
17#define LIEF_OBJECT_H
18#include <type_traits>
19#include "LIEF/visibility.h"
20
21namespace LIEF {
22
23class Visitor;
24
26
27 template<class T>
28 using add_pointer_t = typename std::add_pointer<T>::type;
29
30 template<class T>
31 using decay_t = typename std::decay<T>::type;
32
33 template<class T>
34 using add_const_t = typename std::add_const<T>::type;
35
36 public:
37 template<class T>
38 using output_t = add_pointer_t<decay_t<T>>;
39
40 template<class T>
41 using output_const_t = add_pointer_t<add_const_t<decay_t<T>>>;
42
43 public:
45 Object(const Object& other);
46 Object& operator=(const Object& other);
47
48 template<class T>
49 LIEF_LOCAL output_t<T> as();
50
51 template<class T>
52 LIEF_LOCAL output_const_t<T> as() const;
53
54 virtual bool operator==(const Object& other) const;
55 virtual bool operator!=(const Object& other) const {
56 return !(*this == other);
57 }
58
59 virtual ~Object();
60 virtual void accept(Visitor& visitor) const = 0;
61};
62}
63
64#endif
Definition Object.hpp:25
virtual void accept(Visitor &visitor) const =0
virtual ~Object()
Object(const Object &other)
output_t< T > as()
virtual bool operator==(const Object &other) const
virtual bool operator!=(const Object &other) const
Definition Object.hpp:55
Object & operator=(const Object &other)
output_const_t< T > as() const
Definition Visitor.hpp:225
LIEF namespace.
Definition Abstract/Binary.hpp:36
typename std::decay< T >::type decay_t
Definition iterators.hpp:31
typename std::add_const< T >::type add_const_t
Definition iterators.hpp:34
#define LIEF_API
Definition visibility.h:41
#define LIEF_LOCAL
Definition visibility.h:42