29 #ifndef LLVM_INCLUDE_LLVM_OBJECT_RESFILE_H
30 #define LLVM_INCLUDE_LLVM_OBJECT_RESFILE_H
48 class WindowsResource;
154 template <
typename T>
155 using Children = std::map<T, std::unique_ptr<TreeNode>>;
167 return StringChildren;
176 static std::unique_ptr<TreeNode> createStringNode();
177 static std::unique_ptr<TreeNode> createIDNode();
178 static std::unique_ptr<TreeNode> createDataNode(uint16_t MajorVersion,
179 uint16_t MinorVersion,
182 explicit TreeNode(
bool IsStringNode);
183 TreeNode(uint16_t MajorVersion, uint16_t MinorVersion,
187 bool &IsNewNameString);
192 uint16_t MajorVersion = 0, uint16_t MinorVersion = 0,
196 bool IsDataNode =
false;
201 uint16_t MajorVersion = 0;
202 uint16_t MinorVersion = 0;
208 std::vector<std::vector<uint8_t>>
Data;
209 std::vector<std::vector<UTF16>> StringTable;
const TreeNode & getTree() const
const size_t WIN_RES_NULL_ENTRY_SIZE
An implementation of BinaryStream which holds its entire data set in a single contiguous buffer...
const Children< uint32_t > & getIDChildren() const
Error parse(WindowsResource *WR)
ArrayRef< uint8_t > getData() const
uint16_t getNameID() const
const ArrayRef< std::vector< uint8_t > > getData() const
support::ulittle16_t NameID
uint16_t getLanguage() const
void setName(uint16_t ID)
support::ulittle16_t TypeID
uint16_t getMajorVersion() const
uint32_t getCharacteristics() const
uint32_t getTreeSize() const
uint32_t getStringIndex() const
uint16_t getTypeID() const
Tagged union holding either a T or a Error.
uint16_t getMinorVersion() const
static bool classof(const Binary *V)
ArrayRef< UTF16 > getTypeString() const
static Expected< std::unique_ptr< WindowsResource > > createWindowsResource(MemoryBufferRef Source)
Expected< ResourceEntryRef > getHeadEntry()
void print(ScopedPrinter &Writer, StringRef Name) const
uint32_t getDataIndex() const
uint16_t getMajorVersion() const
The instances of the Type class are immutable: once they are created, they are never changed...
uint32_t getCharacteristics() const
static const unsigned End
const uint16_t WIN_RES_PURE_MOVEABLE
Error moveNext(bool &End)
const uint32_t WIN_RES_HEADER_ALIGNMENT
void setType(uint16_t ID)
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
uint16_t getMinorVersion() const
const Children< std::string > & getStringChildren() const
const size_t WIN_RES_MAGIC_SIZE
Expected< std::unique_ptr< MemoryBuffer > > writeWindowsResourceCOFF(llvm::COFF::MachineTypes MachineType, const WindowsResourceParser &Parser)
bool checkNameString() const
COFFYAML::WeakExternalCharacteristics Characteristics
std::map< T, std::unique_ptr< TreeNode >> Children
bool checkIsDataNode() const
const uint32_t WIN_RES_DATA_ALIGNMENT
bool checkTypeString() const
Lightweight error class with error context and mandatory checking.
void printTree(raw_ostream &OS) const
This class implements an extremely fast bulk output stream that can only output to a stream...
Provides read only access to a subclass of BinaryStream.
StringRef - Represent a constant reference to a string, i.e.
ArrayRef< UTF16 > getNameString() const
const ArrayRef< std::vector< UTF16 > > getStringTable() const