#include "ResourceFileWriter.h"
#include "llvm/Object/WindowsResource.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"
usingnamespacellvm::support;
#define RETURN_IF_ERROR(Expr) …
namespace llvm {
namespace rc {
class ContextKeeper { … };
static Error createError(const Twine &Message,
std::errc Type = std::errc::invalid_argument) { … }
static Error checkNumberFits(uint32_t Number, size_t MaxBits,
const Twine &FieldName) { … }
template <typename FitType>
static Error checkNumberFits(uint32_t Number, const Twine &FieldName) { … }
template <typename FitType>
static Error checkSignedNumberFits(uint32_t Number, const Twine &FieldName,
bool CanBeNegative) { … }
static Error checkRCInt(RCInt Number, const Twine &FieldName) { … }
static Error checkIntOrString(IntOrString Value, const Twine &FieldName) { … }
static bool stripQuotes(StringRef &Str, bool &IsLongString) { … }
static UTF16 cp1252ToUnicode(unsigned char C) { … }
enum class NullHandlingMethod { … };
static Error processString(StringRef Str, NullHandlingMethod NullHandler,
bool &IsLongString, SmallVectorImpl<UTF16> &Result,
int CodePage) { … }
uint64_t ResourceFileWriter::writeObject(const ArrayRef<uint8_t> Data) { … }
Error ResourceFileWriter::writeCString(StringRef Str, bool WriteTerminator) { … }
Error ResourceFileWriter::writeIdentifier(const IntOrString &Ident) { … }
Error ResourceFileWriter::writeIntOrString(const IntOrString &Value) { … }
void ResourceFileWriter::writeRCInt(RCInt Value) { … }
Error ResourceFileWriter::appendFile(StringRef Filename) { … }
void ResourceFileWriter::padStream(uint64_t Length) { … }
Error ResourceFileWriter::handleError(Error Err, const RCResource *Res) { … }
Error ResourceFileWriter::visitNullResource(const RCResource *Res) { … }
Error ResourceFileWriter::visitAcceleratorsResource(const RCResource *Res) { … }
Error ResourceFileWriter::visitBitmapResource(const RCResource *Res) { … }
Error ResourceFileWriter::visitCursorResource(const RCResource *Res) { … }
Error ResourceFileWriter::visitDialogResource(const RCResource *Res) { … }
Error ResourceFileWriter::visitIconResource(const RCResource *Res) { … }
Error ResourceFileWriter::visitCaptionStmt(const CaptionStmt *Stmt) { … }
Error ResourceFileWriter::visitClassStmt(const ClassStmt *Stmt) { … }
Error ResourceFileWriter::visitHTMLResource(const RCResource *Res) { … }
Error ResourceFileWriter::visitMenuResource(const RCResource *Res) { … }
Error ResourceFileWriter::visitMenuExResource(const RCResource *Res) { … }
Error ResourceFileWriter::visitStringTableResource(const RCResource *Base) { … }
Error ResourceFileWriter::visitUserDefinedResource(const RCResource *Res) { … }
Error ResourceFileWriter::visitVersionInfoResource(const RCResource *Res) { … }
Error ResourceFileWriter::visitCharacteristicsStmt(
const CharacteristicsStmt *Stmt) { … }
Error ResourceFileWriter::visitExStyleStmt(const ExStyleStmt *Stmt) { … }
Error ResourceFileWriter::visitFontStmt(const FontStmt *Stmt) { … }
Error ResourceFileWriter::visitLanguageStmt(const LanguageResource *Stmt) { … }
Error ResourceFileWriter::visitStyleStmt(const StyleStmt *Stmt) { … }
Error ResourceFileWriter::visitVersionStmt(const VersionStmt *Stmt) { … }
Error ResourceFileWriter::visitMenuStmt(const MenuStmt *Stmt) { … }
Error ResourceFileWriter::writeResource(
const RCResource *Res,
Error (ResourceFileWriter::*BodyWriter)(const RCResource *)) { … }
Error ResourceFileWriter::writeNullBody(const RCResource *) { … }
Error ResourceFileWriter::writeSingleAccelerator(
const AcceleratorsResource::Accelerator &Obj, bool IsLastItem) { … }
Error ResourceFileWriter::writeAcceleratorsBody(const RCResource *Base) { … }
Error ResourceFileWriter::writeBitmapBody(const RCResource *Base) { … }
struct IconResDir { … };
struct CursorDir { … };
struct ResourceDirEntryStart { … };
struct BitmapInfoHeader { … };
struct GroupIconDir { … };
enum class IconCursorGroupType { … };
class SingleIconCursorResource : public RCResource { … };
class IconCursorGroupResource : public RCResource { … };
Error ResourceFileWriter::writeSingleIconOrCursorBody(const RCResource *Base) { … }
Error ResourceFileWriter::writeIconOrCursorGroupBody(const RCResource *Base) { … }
Error ResourceFileWriter::visitSingleIconOrCursor(const RCResource *Res) { … }
Error ResourceFileWriter::visitIconOrCursorGroup(const RCResource *Res) { … }
Error ResourceFileWriter::visitIconOrCursorResource(const RCResource *Base) { … }
Error ResourceFileWriter::writeSingleDialogControl(const Control &Ctl,
bool IsExtended) { … }
Error ResourceFileWriter::writeDialogBody(const RCResource *Base) { … }
Error ResourceFileWriter::writeHTMLBody(const RCResource *Base) { … }
Error ResourceFileWriter::writeMenuDefinition(
const std::unique_ptr<MenuDefinition> &Def, uint16_t Flags) { … }
Error ResourceFileWriter::writeMenuExDefinition(
const std::unique_ptr<MenuDefinition> &Def, uint16_t Flags) { … }
Error ResourceFileWriter::writeMenuDefinitionList(
const MenuDefinitionList &List) { … }
Error ResourceFileWriter::writeMenuExDefinitionList(
const MenuDefinitionList &List) { … }
Error ResourceFileWriter::writeMenuBody(const RCResource *Base) { … }
Error ResourceFileWriter::writeMenuExBody(const RCResource *Base) { … }
class BundleResource : public RCResource { … };
Error ResourceFileWriter::visitStringTableBundle(const RCResource *Res) { … }
Error ResourceFileWriter::insertStringIntoBundle(
StringTableInfo::Bundle &Bundle, uint16_t StringID,
const std::vector<StringRef> &String) { … }
Error ResourceFileWriter::writeStringTableBundleBody(const RCResource *Base) { … }
Error ResourceFileWriter::dumpAllStringTables() { … }
Error ResourceFileWriter::writeUserDefinedBody(const RCResource *Base) { … }
Error ResourceFileWriter::writeVersionInfoBlock(const VersionInfoBlock &Blk) { … }
Error ResourceFileWriter::writeVersionInfoValue(const VersionInfoValue &Val) { … }
template <typename Ty>
static Ty getWithDefault(const StringMap<Ty> &Map, StringRef Key,
const Ty &Default) { … }
Error ResourceFileWriter::writeVersionInfoBody(const RCResource *Base) { … }
Expected<std::unique_ptr<MemoryBuffer>>
ResourceFileWriter::loadFile(StringRef File) const { … }
}
}