LIEF: Library to Instrument Executable Formats Version 0.17.0
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
31struct ResourcesParser;
32class LIEF_API LangCodeItem : public Object {
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;
51 LangCodeItem& operator=(const LangCodeItem&) = default;
52 ~LangCodeItem() override = default;
53 uint16_t type() const {
58 return type_;
59 }
60 const std::u16string& key() const {
67 return key_;
68 }
69 CODE_PAGES code_page() const;
73 uint32_t lang() const;
76 uint32_t sublang() const;
79
80 const items_t& items() const {
81 return items_;
82 }
83
84 items_t& items() {
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
Object.hpp
enums.hpp
LIEF::PE::LangCodeItem
Class which represents the childs of the ResourceStringFileInfo.
Definition LangCodeItem.hpp:37
LIEF::PE::LangCodeItem::items
items_t & items()
Definition LangCodeItem.hpp:84
LIEF::PE::LangCodeItem::type
void type(uint16_t type)
Definition LangCodeItem.hpp:88
LIEF::PE::LangCodeItem::sublang
void sublang(uint32_t lang)
LIEF::PE::LangCodeItem::items
void items(const items_t &items)
LIEF::PE::LangCodeItem::code_page
CODE_PAGES code_page() const
Code page for which LangCodeItem::items are defined
LIEF::PE::LangCodeItem::code_page
void code_page(CODE_PAGES code_page)
LIEF::PE::LangCodeItem::key
const std::u16string & key() const
A 8-digit hexadecimal number stored as an Unicode string.
Definition LangCodeItem.hpp:66
LIEF::PE::LangCodeItem::key
void key(const std::string &key)
LIEF::PE::LangCodeItem::LangCodeItem
LangCodeItem(uint16_t type, std::u16string key)
Definition LangCodeItem.hpp:45
LIEF::PE::LangCodeItem::items
const items_t & items() const
Definition LangCodeItem.hpp:80
LIEF::PE::LangCodeItem::key
void key(const std::u16string &key)
Definition LangCodeItem.hpp:92
LIEF::PE::LangCodeItem::lang
void lang(uint32_t lang)
LIEF::PE::LangCodeItem::LangCodeItem
LangCodeItem()
LIEF::PE::LangCodeItem::operator=
LangCodeItem & operator=(const LangCodeItem &)=default
LIEF::PE::LangCodeItem::sublang
uint32_t sublang() const
Sublang for which LangCodeItem::items are defined.
LIEF::PE::LangCodeItem::type
uint16_t type() const
The type of data in the version resource.
Definition LangCodeItem.hpp:57
LIEF::PE::LangCodeItem::LangCodeItem
LangCodeItem(const LangCodeItem &)=default
LIEF::PE::LangCodeItem::operator<<
friend std::ostream & operator<<(std::ostream &os, const LangCodeItem &item)
LIEF::PE::LangCodeItem::accept
void accept(Visitor &visitor) const override
LIEF::PE::LangCodeItem::~LangCodeItem
~LangCodeItem() override=default
LIEF::PE::LangCodeItem::lang
uint32_t lang() const
Lang for which LangCodeItem::items are defined.
LIEF::PE::ResourcesManager
The Resource Manager provides an enhanced API to manipulate the resource tree.
Definition ResourcesManager.hpp:38
LIEF::PE
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
LIEF::PE::CODE_PAGES
CODE_PAGES
Code page from https://docs.microsoft.com/en-us/windows/win32/intl/code-page-identifiers.
Definition PE/enums.hpp:333
LIEF
LIEF namespace.
Definition Abstract/Binary.hpp:36
visibility.h
LIEF_API
#define LIEF_API
Definition visibility.h:41