LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
String.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_COFF_STRING_H
17#define LIEF_COFF_STRING_H
18#include <ostream>
19#include <string>
20#include <cstdint>
21
22#include "LIEF/visibility.h"
23
24namespace LIEF {
25namespace COFF {
26class LIEF_API String {
34 public:
35 String() = default;
36 String(uint32_t offset, std::string str) :
37 str_(std::move(str)),
38 offset_(offset)
39 {}
40
41 String(const String&) = default;
42 String& operator=(const String&) = default;
43
44 String(String&&) = default;
45 String& operator=(String&&) = default;
46
47 ~String() = default;
48 const std::string& str() const {
51 return str_;
52 }
53 uint32_t offset() const {
57 return offset_;
58 }
59
60 String& str(std::string str) {
61 str_ = std::move(str);
62 return *this;
63 }
64
65 String& offset(uint32_t value) {
66 offset_ = value;
67 return *this;
68 }
69
70 friend LIEF_API
71 std::ostream& operator<<(std::ostream& os, const String& 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::COFF::String
This class represents a string located in the COFF string table.
Definition String.hpp:33
LIEF::COFF::String::operator=
String & operator=(String &&)=default
LIEF::COFF::String::str
const std::string & str() const
The actual string.
Definition String.hpp:50
LIEF::COFF::String::String
String()=default
LIEF::COFF::String::String
String(uint32_t offset, std::string str)
Definition String.hpp:36
LIEF::COFF::String::String
String(String &&)=default
LIEF::COFF::String::operator=
String & operator=(const String &)=default
LIEF::COFF::String::offset
String & offset(uint32_t value)
Definition String.hpp:65
LIEF::COFF::String::~String
~String()=default
LIEF::COFF::String::operator<<
friend std::ostream & operator<<(std::ostream &os, const String &str)
Definition String.hpp:71
LIEF::COFF::String::str
String & str(std::string str)
Definition String.hpp:60
LIEF::COFF::String::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 String.hpp:56
LIEF::COFF::String::String
String(const String &)=default
LIEF::COFF
Definition AuxiliarySymbol.hpp:29
LIEF
LIEF namespace.
Definition Abstract/Binary.hpp:39
visibility.h
LIEF_API
#define LIEF_API
Definition visibility.h:41