LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
Abstract/Parser.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_PARSER_H
17#define LIEF_ABSTRACT_PARSER_H
18
19#include <string>
20#include <memory>
21#include <vector>
22
23#include "LIEF/visibility.h"
24
25namespace LIEF {
26class BinaryStream;
27class Binary;
28
30class LIEF_API Parser {
31 public:
36 static std::unique_ptr<Binary> parse(const std::string& filename);
37
38
43 static std::unique_ptr<Binary> parse(const std::vector<uint8_t>& raw);
44
49 static std::unique_ptr<Binary> parse(std::unique_ptr<BinaryStream> stream);
50
51 protected:
52 Parser(const std::string& file);
53 uint64_t binary_size_ = 0;
54
55 virtual ~Parser();
56 Parser();
57};
58}
59
60#endif
Main interface to parse an executable regardless of its format.
Definition Abstract/Parser.hpp:30
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:32