LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
COFFString.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2025 R. Thomas
2 * Copyright 2017 - 2025 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_COFF_STRING_H
17#define LIEF_PE_COFF_STRING_H
18#include <ostream>
19#include <string>
20#include <cstdint>
21
22#include "LIEF/visibility.h"
23
24namespace LIEF {
25namespace PE {
26class LIEF_API COFFString {
34 public:
35 COFFString() = default;
36 COFFString(uint32_t offset, std::string str) :
37 str_(std::move(str)),
38 offset_(offset)
39 {}
40
41 COFFString(const COFFString&) = default;
42 COFFString& operator=(const COFFString&) = default;
43
44 COFFString(COFFString&&) = default;
45 COFFString& operator=(COFFString&&) = default;
46
47 ~COFFString() = default;
48 const std::string& str() const {
51 return str_;
52 }
53 uint32_t offset() const {
57 return offset_;
58 }
59
60 COFFString& str(std::string str) {
61 str_ = std::move(str);
62 return *this;
63 }
64
65 COFFString& offset(uint32_t value) {
66 offset_ = value;
67 return *this;
68 }
69
70 friend LIEF_API
71 std::ostream& operator<<(std::ostream& os, const COFFString& str)
72 {
73 os << str.str();
74 return os;
75 }
76
77 private:
78 std::string str_;
79 uint32_t offset_ = 0;
80};
81}
82}
83#endif
LIEF::PE::COFFString
This class represents a string located in the COFF string table.
Definition COFFString.hpp:33
LIEF::PE::COFFString::COFFString
COFFString()=default
LIEF::PE::COFFString::COFFString
COFFString(uint32_t offset, std::string str)
Definition COFFString.hpp:36
LIEF::PE::COFFString::offset
COFFString & offset(uint32_t value)
Definition COFFString.hpp:65
LIEF::PE::COFFString::operator=
COFFString & operator=(const COFFString &)=default
LIEF::PE::COFFString::offset
uint32_t offset() const
The offset of this string the in the COFF string table. This offset includes the first 4-bytes that h...
Definition COFFString.hpp:56
LIEF::PE::COFFString::str
COFFString & str(std::string str)
Definition COFFString.hpp:60
LIEF::PE::COFFString::str
const std::string & str() const
The actual string.
Definition COFFString.hpp:50
LIEF::PE::COFFString::COFFString
COFFString(COFFString &&)=default
LIEF::PE::COFFString::COFFString
COFFString(const COFFString &)=default
LIEF::PE::COFFString::operator=
COFFString & operator=(COFFString &&)=default
LIEF::PE::COFFString::operator<<
friend std::ostream & operator<<(std::ostream &os, const COFFString &str)
Definition COFFString.hpp:71
LIEF::PE::COFFString::~COFFString
~COFFString()=default
LIEF::PE
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
LIEF
LIEF namespace.
Definition Abstract/Binary.hpp:36
visibility.h
LIEF_API
#define LIEF_API
Definition visibility.h:41