LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
LangCodeItem.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_PE_RESOURCE_LANG_CODE_ITEM_H
17#define LIEF_PE_RESOURCE_LANG_CODE_ITEM_H
18#include <ostream>
19#include <sstream>
20#include <vector>
21#include <unordered_map>
22
23#include "LIEF/visibility.h"
24
25#include "LIEF/Object.hpp"
26
27#include "LIEF/PE/enums.hpp"
28
29namespace LIEF {
30namespace PE {
31
32class ResourcesManager;
33struct ResourcesParser;
34
39class LIEF_API LangCodeItem : public Object {
40
41 friend class ResourcesManager;
42 friend struct ResourcesParser;
43
44 public:
45 using items_t = std::unordered_map<std::u16string, std::u16string>;
47 LangCodeItem(uint16_t type, std::u16string key);
48
50 LangCodeItem& operator=(const LangCodeItem&);
51 ~LangCodeItem() override;
52
56 uint16_t type() const;
57
63 const std::u16string& key() const;
64
68
70 uint32_t lang() const;
71
73 uint32_t sublang() const;
74
75 const items_t& items() const;
76 items_t& items();
77
78 void type(uint16_t type);
79 void key(const std::u16string& key);
80 void key(const std::string& key);
81
82 void code_page(CODE_PAGES code_page);
83 void lang(uint32_t lang);
84 void sublang(uint32_t lang);
85
86 void items(const items_t& items);
87
88 void accept(Visitor& visitor) const override;
89
90
91 LIEF_API friend std::ostream& operator<<(std::ostream& os, const LangCodeItem& item);
92
93 private:
94 uint16_t type_ = 0;
95 std::u16string key_;
96 items_t items_;
97};
98
99
100
101
102}
103}
104
105
106#endif
Definition Object.hpp:25
Class which represents the childs of the ResourceStringFileInfo.
Definition LangCodeItem.hpp:39
CODE_PAGES code_page() const
Code page for which LangCodeItem::items are defined
const std::u16string & key() const
A 8-digit hexadecimal number stored as an Unicode string.
uint32_t sublang() const
Sublang for which LangCodeItem::items are defined.
uint16_t type() const
The type of data in the version resource.
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:219
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