MDF

MDF module API reference: 11 headers · 33 types · 402 symbols.

Generated from mdf.json · Oct 26, 2026Version 1.0.0
Build name
MowoEngine.MDF
Source
Engine/Source/Runtime/MDF/Public
Category
Runtime
Contents
11 headers · 33 types · 402 symbols

mdf/mdf_binary.h

KindTypeSummary
structMdfbHeader
enumMdfbType
classFMdfCrc
classFMdfAtomicFileEvery document save in both encodings lands here. Writing in place truncates the target the moment the stream opens, and a bare temp-then-rename is atomic against a crash but not against lost power, so the write goes thr
classMdfBinaryWriter
classMdfBinaryReader

Free functions

SignatureDescription
constexpr uint32_t MDFB_MAGIC = 0x4246444D"MDFB" little-endian
constexpr uint32_t MDFB_VERSION = 1
constexpr uint32_t MDFB_NO_STRING = 0xFFFFFFFF
constexpr uint64_t MDFB_STRING_TABLE_CRC_PRESENT = 1ull << 32The data CRC covers the node stream only, so a flipped byte in the string table used to pass the check and come out as a wrong type name or a wrong asset path. The table's own CRC32 lives in the low 32 bits of the formerly unused stringTableChecksum slot (reserved in v1 readers, which ignore it), with this bit set so a table whose CRC happens to be zero still reads as "present, verify".
static_assert(sizeof(MdfbHeader) == 56, "MdfbHeader must be 56 bytes")
constexpr uint32_t MDFB_BYTES_ALIGNMENT = 16
inline std::vector<uint8_t> MdfBinaryWriter::Write(const MdfDocument& doc)
inline bool MdfBinaryWriter::WriteToFile(const MdfDocument& doc, const std::string& filepath)
inline void MdfBinaryWriter::CollectStrings(const MdfDocument& doc)
inline void MdfBinaryWriter::CollectStringsFromNode(const MdfNode& node)
inline void MdfBinaryWriter::CollectStringsFromValue(const MdfValue& value)
inline void MdfBinaryWriter::WriteNode(const MdfNode& node)
inline void MdfBinaryWriter::WriteValue(const MdfValue& value)
inline void MdfBinaryWriter::WriteBlob(const std::vector<uint8_t>& bytes)
inline bool MdfBinaryReader::Read(const uint8_t* data, size_t size, MdfDocument& outDoc, std::string* outError)
inline bool MdfBinaryReader::Read(const std::vector<uint8_t>& data, MdfDocument& outDoc, std::string* outError)
inline bool MdfBinaryReader::ReadFromFile(const std::string& filepath, MdfDocument& outDoc, std::string* outError)
inline bool MdfBinaryReader::ReadDocument(MdfDocument& doc)
inline bool MdfBinaryReader::ReadNode(MdfNode& outNode)
inline bool MdfBinaryReader::ReadValue(MdfValue& outValue)
inline bool MdfBinaryReader::ReadBlob(MdfValue& outValue)

mdf/mdf_document.h

KindTypeSummary
structMdfPropertyCommentsComments the text parser found around one property, kept verbatim with their delimiters so the writer can put them back where they were. Leading are the lines above the property; SameLine is the one after its value.
classMdfNode
classMdfDocument

Free functions

SignatureDescription
constexpr const char* MPKG_SUMMARY_NODE = "Package"The type of the first root of a text package (mdf_package.h).
inline size_t MdfNode::PropOrderPos(const std::string& key) const
inline size_t MdfNode::PropIndex(const std::string& key) const
inline bool MdfNode::HasProperty(const std::string& key) const
inline const MdfValue& MdfNode::GetProperty(const std::string& key) const
inline const MdfValue* MdfNode::TryGetProperty(const std::string& key) const
inline void MdfNode::SetProperty(const std::string& key, const MdfValue& value)
inline void MdfNode::SetProperty(const std::string& key, MdfValue&& value)
inline void MdfNode::SetProperty(std::string&& key, MdfValue&& value)
inline bool MdfNode::RemoveProperty(const std::string& key)
inline MdfValue& MdfNode::operator[](const std::string& key)
inline const MdfPropertyComments& MdfNode::GetPropertyCommentsAt(size_t index) const
inline const MdfPropertyComments& MdfNode::GetPropertyComments(const std::string& key) const
inline void MdfNode::SetPropertyCommentsAt(size_t index, MdfPropertyComments comments)
inline void MdfNode::SetPropertyComments(const std::string& key, MdfPropertyComments comments)
inline MdfNode& MdfNode::AddChild(const std::string& type, const std::string& name)
inline MdfNode& MdfNode::AddChild(MdfNode&& node)
inline const MdfNode* MdfNode::FindChild(const std::string& type, const std::string& name) const
inline MdfNode* MdfNode::FindChild(const std::string& type, const std::string& name)
inline std::vector<const MdfNode*> MdfNode::FindChildren(const std::string& type) const
inline bool MdfNode::RemoveChild(size_t index)
inline bool MdfNode::RemoveChild(const std::string& type, const std::string& name)
inline MdfNode& MdfDocument::CreateRoot(const std::string& type, const std::string& name)
inline MdfNode& MdfDocument::Root()Root() never throws: the mutable overload self-heals by creating an unnamed root, the const overload hands back a shared empty node. Check HasRoot() when the distinction matters. A text package (mdf_package.h) leads with its summary node; Root() is the document's own root behind it, so a reader written for the plain document reads the package form unchanged and a writer that edits Root() and writes the document back keeps the summary — and with it the asset's id. Code that wants the summary takes Roots().front().
inline const MdfNode& MdfDocument::Root() const

mdf/mdf_lexer.h

KindTypeSummary
enumMdfTokenType
structMdfToken
classMdfLexer

Free functions

SignatureDescription
inline std::vector<MdfToken> MdfLexer::Tokenize()
inline MdfToken MdfLexer::NextToken()
inline MdfToken MdfLexer::ReadString()
inline MdfToken MdfLexer::ReadNumber()
inline MdfToken MdfLexer::ReadIdentifier()
inline MdfToken MdfLexer::ReadHexLiteral()
inline MdfToken MdfLexer::ReadComment()Carriage returns are dropped from the text so a CRLF file and its LF twin produce the same token, and so the writer — which always emits LF — reproduces the comment byte-for-byte on either host.

mdf/mdf_merge.h

KindTypeSummary
enumMdfDiffKind
structMdfDiffEntryProperty empty = the whole node was added or removed.
structMdfMergeConflict
classMdfStructuralDiff
classMdfMerge

mdf/mdf_package.h

KindTypeSummary
structMdfPackageHeader
structMdfPackageImportA reference to another asset. The path survives a rename through the registry's redirectors; the id is what resolves it.
structMdfPackageExportOne object the package defines: the payload root of the same index.
structMdfPackageBulkA bulk chunk. Editor-only chunks (source geometry, the uncompressed texture a reimport compares against) are what the cook strips.
structMdfPackageThumbnailThe browser's picture of the asset, carried in the summary so a content browser shows it from the registry's read without loading or rendering the asset. Format names the bytes: "png" (encoded) or "rgba8" (Width*Height*4
classMdfPackage

Free functions

SignatureDescription
constexpr uint32_t MPKG_MAGIC = 0x474B504D"MPKG" little-endian
constexpr uint32_t MPKG_VERSION = 1
constexpr uint32_t MPKG_BULK_ALIGNMENT = 16
static_assert(sizeof(MdfPackageHeader) == 56, "MdfPackageHeader must be 56 bytes")
inline uint64_t MdfPackage::HashBytes(const std::vector<uint8_t>& bytes)
inline std::string MdfPackage::EncodeBase64(const std::vector<uint8_t>& bytes)MDF has no byte-string value, and the summary is the one part of a binary package the registry decodes — so the thumbnail rides there as base64.
inline bool MdfPackage::DecodeBase64(const std::string& text, std::vector<uint8_t>& out)
inline MdfNode MdfPackage::BuildSummaryNode(bool binary, const std::vector<std::pair<uint64_t, uint64_t>>& bulkSpans) const
inline bool MdfPackage::ParseSummaryNode(const MdfNode& node, MdfPackage& out, std::string* error)
inline void MdfPackage::DeriveExports(MdfPackage& out)
inline std::vector<uint8_t> MdfPackage::WriteBinary() const
inline bool MdfPackage::WriteText(std::string& out, std::string* error) const
inline bool MdfPackage::ReadSummary(const uint8_t* data, size_t size, MdfPackage& out, std::string* error, uint64_t fileSize)
inline bool MdfPackage::Read(const uint8_t* data, size_t size, MdfPackage& out, std::string* error)
inline std::string MdfPackage::Dump() const

mdf/mdf_package_text.h

KindTypeSummary
classMdfPackageText

mdf/mdf_parser.h

KindTypeSummary
classMdfParser

Free functions

SignatureDescription
inline bool MdfParser::Parse(const std::string& source, MdfDocument& outDoc, std::string* outError)
inline bool MdfParser::Parse(const std::vector<MdfToken>& tokens, MdfDocument& outDoc, std::string* outError)
inline bool MdfParser::Expect(MdfTokenType type, const std::string& context)
inline bool MdfParser::ParseDocument(MdfDocument& doc)
inline bool MdfParser::ParseNode(MdfNode& outNode)
inline bool MdfParser::ParseNodeBody(MdfNode& node)
inline bool MdfParser::ParseValue(MdfValue& outValue)
inline bool MdfParser::ParseConstructorCall(const std::string& name, MdfValue& outValue)
inline bool MdfParser::ParseArray(MdfValue& outValue)
inline bool MdfParser::ParseNumberValue(double& out)

mdf/mdf_types.h

KindTypeSummary
structMdfVec2
structMdfVec3
structMdfVec4
structMdfQuat

mdf/mdf_value.h

KindTypeSummary
enumMdfValueType
classMdfBase64The Base64 the text encoding writes Bytes as (standard alphabet, padded) — the same bytes Core's FBase64 produces, so a blob written either way reads back through either.
classMdfValueA single typed value in an MDF document.

mdf/mdf_writer.h

KindTypeSummary
classMdfWriter

Free functions

SignatureDescription
inline std::string MdfWriter::Write(const MdfDocument& doc)
inline void MdfWriter::WriteComments(const std::vector<std::string>& comments, int depth)Verbatim, one per line at the owner's indent. A block comment keeps its inner newlines and whatever indentation its continuation lines had, so a file written at the indent it was read at comes back byte-identical.
inline std::string MdfWriter::WriteNode(const MdfNode& node)
inline std::string MdfWriter::SanitizeIdentifier(std::string_view raw)Node types and property keys are written RAW — unquoted and unescaped — so anything that is not an identifier produces a file the parser cannot read back (a display name with a space cost a whole scene once). Sanitising here keeps a bad name from destroying the document: the type still round-trips as an identifier, and the mismatch surfaces as an unknown-type warning on load rather than a parse failure that takes the file with it.
inline void MdfWriter::WriteNodeInternal(const MdfNode& node, int depth)
inline void MdfWriter::WriteValue(const MdfValue& value)
inline std::string MdfWriter::EscapeString(const std::string& str)
inline std::string MdfWriter::FormatFloat(double val)Shortest round-trip, at the width the value actually came from. Every engine float reaches here promoted to double, so 0.35f arrives as 0.34999999403953552 and a fixed eight significant digits wrote it back as 0.34999999 — a number nobody typed, re-quantized on every save. Integer- valued floats < 1e15 still print as "<int>.0", and ".0" is appended when the shortest form has neither '.' nor 'e'.

mdf/mdf.h

Free functions

SignatureDescription
inline bool MdfDocument::ParseFromString(const std::string& source, MdfDocument& outDoc, std::string* outError)
inline bool MdfDocument::ParseFromFile(const std::string& filepath, MdfDocument& outDoc, std::string* outError)
inline std::string MdfDocument::WriteToString(int indentSize) const
inline bool MdfDocument::WriteToFile(const std::string& filepath, int indentSize) const

Page feedback

Was this page helpful?