LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
GenericContent.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_PE_GENERIC_CONTENT_H
17#define LIEF_PE_GENERIC_CONTENT_H
18
19#include "LIEF/visibility.h"
20#include "LIEF/span.hpp"
21#include "LIEF/PE/signature/ContentInfo.hpp"
22
23namespace LIEF {
24namespace PE {
25class LIEF_API GenericContent : public ContentInfo::Content {
26 friend class SignatureParser;
27
28 public:
30 GenericContent(oid_t oid);
31 GenericContent(const GenericContent&) = default;
32 GenericContent& operator=(const GenericContent&) = default;
33
34 std::unique_ptr<Content> clone() const override {
35 return std::unique_ptr<Content>(new GenericContent{*this});
36 }
37
38 const oid_t& oid() const {
39 return oid_;
40 }
41
42 span<const uint8_t> raw() const {
43 return raw_;
44 }
45
46 span<uint8_t> raw() {
47 return raw_;
48 }
49
50 ~GenericContent() override;
51
52 void print(std::ostream& os) const override;
53 void accept(Visitor& visitor) const override;
54
55 LIEF_API friend std::ostream& operator<<(std::ostream& os, const GenericContent& content) {
56 content.print(os);
57 return os;
58 }
59
60 static bool classof(const ContentInfo::Content* content);
61
62 private:
63 oid_t oid_;
64 std::vector<uint8_t> raw_;
65};
66}
67}
68#endif
Definition ContentInfo.hpp:84
Definition GenericContent.hpp:25
Definition SignatureParser.hpp:37
Definition Visitor.hpp:221
LIEF namespace.
Definition Abstract/Binary.hpp:31