LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
Abstract/Parser.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 * Copyright 2017 - 2026 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_PARSER_H
17#define LIEF_ABSTRACT_PARSER_H
18
19#include <string>
20#include <memory>
21#include <cstdint>
22#include <vector>
23
24#include "LIEF/visibility.h"
25
26namespace LIEF {
27class BinaryStream;
28class Binary;
29
31class LIEF_API Parser {
32 public:
37 static std::unique_ptr<Binary> parse(const std::string& filename);
38
39
44 static std::unique_ptr<Binary> parse(const std::vector<uint8_t>& raw);
45
50 static std::unique_ptr<Binary> parse(std::unique_ptr<BinaryStream> stream);
51
52 protected:
53 Parser(const std::string& file);
54 uint64_t binary_size_ = 0;
55
56 virtual ~Parser();
57 Parser();
58};
59}
60
61#endif
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:35
Generic interface representing a binary executable.
Definition Abstract/Binary.hpp:60
static std::unique_ptr< Binary > parse(const std::vector< uint8_t > &raw)
Construct an LIEF::Binary from the given raw data.
static std::unique_ptr< Binary > parse(std::unique_ptr< BinaryStream > stream)
Construct an LIEF::Binary from the given stream.
static std::unique_ptr< Binary > parse(const std::string &filename)
Construct an LIEF::Binary from the given filename.
LIEF namespace.
Definition Abstract/Binary.hpp:41
#define LIEF_API
Definition visibility.h:45