LIEF: Library to Instrument Executable Formats Version 0.15.1
Loading...
Searching...
No Matches
LangCodeItem.hpp
Go to the documentation of this file.
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_RESOURCE_LANG_CODE_ITEM_H
17#define LIEF_PE_RESOURCE_LANG_CODE_ITEM_H
18#include <ostream>
19#include <unordered_map>
20
21#include "LIEF/visibility.h"
22
23#include "LIEF/Object.hpp"
24
25#include "LIEF/PE/enums.hpp"
26
27namespace LIEF {
28namespace PE {
29
30class ResourcesManager;
31struct ResourcesParser;
32
38
39 friend class ResourcesManager;
40 friend struct ResourcesParser;
41
42 public:
43 using items_t = std::unordered_map<std::u16string, std::u16string>;
45 LangCodeItem(uint16_t type, std::u16string key) :
46 type_(type),
47 key_(std::move(key))
48 {}
49
50 LangCodeItem(const LangCodeItem&) = default;
52 ~LangCodeItem() override = default;
53
57 uint16_t type() const {
58 return type_;
59 }
60
66 const std::u16string& key() const {
67 return key_;
68 }
69
73
75 uint32_t lang() const;
76
78 uint32_t sublang() const;
79
80 const items_t& items() const {
81 return items_;
82 }
83
85 return items_;
86 }
87
88 void type(uint16_t type) {
89 type_ = type;
90 }
91
92 void key(const std::u16string& key) {
93 key_ = key;
94 }
95 void key(const std::string& key);
96
97 void code_page(CODE_PAGES code_page);
98 void lang(uint32_t lang);
99 void sublang(uint32_t lang);
100
101 void items(const items_t& items);
102
103 void accept(Visitor& visitor) const override;
104
105
106 LIEF_API friend std::ostream& operator<<(std::ostream& os, const LangCodeItem& item);
107
108 private:
109 uint16_t type_ = 0;
110 std::u16string key_;
111 items_t items_;
112};
113
114
115
116
117}
118}
119
120
121#endif
Definition Object.hpp:25
Class which represents the childs of the ResourceStringFileInfo.
Definition LangCodeItem.hpp:37
items_t & items()
Definition LangCodeItem.hpp:84
void type(uint16_t type)
Definition LangCodeItem.hpp:88
void sublang(uint32_t lang)
void items(const items_t &items)
CODE_PAGES code_page() const
Code page for which LangCodeItem::items are defined
void code_page(CODE_PAGES code_page)
const std::u16string & key() const
A 8-digit hexadecimal number stored as an Unicode string.
Definition LangCodeItem.hpp:66
void key(const std::string &key)
LangCodeItem(uint16_t type, std::u16string key)
Definition LangCodeItem.hpp:45
const items_t & items() const
Definition LangCodeItem.hpp:80
std::unordered_map< std::u16string, std::u16string > items_t
Definition LangCodeItem.hpp:43
void key(const std::u16string &key)
Definition LangCodeItem.hpp:92
void lang(uint32_t lang)
LangCodeItem & operator=(const LangCodeItem &)=default
uint32_t sublang() const
Sublang for which LangCodeItem::items are defined.
uint16_t type() const
The type of data in the version resource.
Definition LangCodeItem.hpp:57
LangCodeItem(const LangCodeItem &)=default
friend std::ostream & operator<<(std::ostream &os, const LangCodeItem &item)
void accept(Visitor &visitor) const override
~LangCodeItem() override=default
uint32_t lang() const
Lang for which LangCodeItem::items are defined.
The Resource Manager provides an enhanced API to manipulate the resource tree.
Definition ResourcesManager.hpp:38
Definition Visitor.hpp:224
CODE_PAGES
Code page from https://docs.microsoft.com/en-us/windows/win32/intl/code-page-identifiers.
Definition PE/enums.hpp:333
LIEF namespace.
Definition Abstract/Binary.hpp:32
#define LIEF_API
Definition visibility.h:41