class

MdfNode

Module
MDF
Header
#include "mdf/mdf_document.h"
Namespace
MDF

Constructors

SignatureNameDescription
MdfNode() = defaultMdfNode
MdfNode(const std::string& type, const std::string& name = "") : m_type(type), m…MdfNode

Public functions

ReturnsNameDescription
const std::string&GetType
const std::string&GetName
voidSetType
voidSetName
boolHasProperty
const MdfValue&GetProperty
const MdfValue*TryGetPropertynullptr when absent.
voidSetProperty
voidSetProperty
voidSetProperty
::value && std::is_constructible<MdfValue, V&&>::value && !std::is_same<typename std::decay<V>::type, MdfValue>::value, int>::type = 0> voidSetPropertyAnything an MdfValue can be built from sets directly, so call sites need not spell MdfValue(...).
boolRemovePropertyKeeps the sorted lookup index consistent.
voidReservePropertiesWorth calling when the final property count is known up front, as in the binary reader.
const std::vector<std::pair<std::string, MdfValue>>&GetProperties
MdfValue&operator[]
const std::vector<std::string>&GetCommentsComments, text encoding only.
std::vector<std::string>&GetComments
voidSetComments
const std::vector<std::string>&GetTrailingComments
voidSetTrailingComments
const MdfPropertyComments&GetPropertyCommentsAt
const MdfPropertyComments&GetPropertyComments
voidSetPropertyCommentsNo-op when the key is absent — set the value first.
voidSetPropertyCommentsAt
MdfNode&AddChild
MdfNode&AddChild
const std::vector<MdfNode>&GetChildren
std::vector<MdfNode>&GetChildren
const MdfNode*FindChild
MdfNode*FindChild
std::vector<const MdfNode*>FindChildren
boolRemoveChild
boolRemoveChildRemoves the first child matching type, and name when non-empty, mirroring FindChild's match rule.
MdfNodeClone
voidSetSourcePosSource position of the node's type identifier, set by the text parser.
uint32_tGetSourceLine
uint32_tGetSourceColumn

Function details

MdfNode

C++
MdfNode() = default

MdfNode

C++
MdfNode(const std::string& type, const std::string& name = "") : m_type(type), m_name(name)

GetType

C++
const std::string& GetType() const

GetName

C++
const std::string& GetName() const

SetType

C++
void SetType(const std::string& type)

SetName

C++
void SetName(const std::string& name)

HasProperty

C++
inline bool HasProperty(const std::string& key) const

GetProperty

C++
inline const MdfValue& GetProperty(const std::string& key) const

TryGetProperty

C++
inline const MdfValue* TryGetProperty(const std::string& key) const

nullptr when absent. Prefer over a HasProperty + GetProperty pair in hot paths.

SetProperty

C++
inline void SetProperty(const std::string& key, const MdfValue& value)

SetProperty

C++
inline void SetProperty(const std::string& key, MdfValue&& value)

SetProperty

C++
inline void SetProperty(std::string&& key, MdfValue&& value)

SetProperty

C++
template<typename K, typename V, typename std::enable_if<std::is_constructible<std::string, K&&>::value && std::is_constructible<MdfValue, V&&>::value && !std::is_same<typename std::decay<V>::type, MdfValue>::value, int>::type = 0> void SetProperty(K&& key, V&& value)

Anything an MdfValue can be built from sets directly, so call sites need not spell MdfValue(...). Constrained so MdfValue arguments keep taking the overloads above.

RemoveProperty

C++
inline bool RemoveProperty(const std::string& key)

Keeps the sorted lookup index consistent. False when the key is absent.

ReserveProperties

C++
void ReserveProperties(size_t count)

Worth calling when the final property count is known up front, as in the binary reader.

GetProperties

C++
const std::vector<std::pair<std::string, MdfValue>>& GetProperties() const

operator[]

C++
inline MdfValue& operator[](const std::string& key)

GetComments

C++
const std::vector<std::string>& GetComments() const

Comments, text encoding only. A node's own comments are the lines above its header; trailing comments sit inside the body after the last child, where a comment has nothing left to attach to. Property comments are indexed the way GetProperties() is, so the writer walks both in one pass; the sparse store costs nothing on the (usual) comment-free node.

GetComments

C++
std::vector<std::string>& GetComments()

SetComments

C++
void SetComments(std::vector<std::string> comments)

GetTrailingComments

C++
const std::vector<std::string>& GetTrailingComments() const

SetTrailingComments

C++
void SetTrailingComments(std::vector<std::string> comments)

GetPropertyCommentsAt

C++
inline const MdfPropertyComments& GetPropertyCommentsAt(size_t index) const

GetPropertyComments

C++
inline const MdfPropertyComments& GetPropertyComments(const std::string& key) const

SetPropertyComments

C++
inline void SetPropertyComments(const std::string& key, MdfPropertyComments comments)

No-op when the key is absent — set the value first.

SetPropertyCommentsAt

C++
inline void SetPropertyCommentsAt(size_t index, MdfPropertyComments comments)

AddChild

C++
inline MdfNode& AddChild(const std::string& type, const std::string& name = "")

AddChild

C++
inline MdfNode& AddChild(MdfNode&& node)

GetChildren

C++
const std::vector<MdfNode>& GetChildren() const

GetChildren

C++
std::vector<MdfNode>& GetChildren()

FindChild

C++
inline const MdfNode* FindChild(const std::string& type, const std::string& name = "") const

FindChild

C++
inline MdfNode* FindChild(const std::string& type, const std::string& name = "")

FindChildren

C++
inline std::vector<const MdfNode*> FindChildren(const std::string& type) const

RemoveChild

C++
inline bool RemoveChild(size_t index)

RemoveChild

C++
inline bool RemoveChild(const std::string& type, const std::string& name = "")

Removes the first child matching type, and name when non-empty, mirroring FindChild's match rule.

Clone

C++
MdfNode Clone() const

SetSourcePos

C++
void SetSourcePos(uint32_t line, uint32_t column)

Source position of the node's type identifier, set by the text parser. 0 means unknown — built in memory, or read from binary.

GetSourceLine

C++
uint32_t GetSourceLine() const

GetSourceColumn

C++
uint32_t GetSourceColumn() const
Generated from mdf/mdf_document.h via mdf.json · Oct 26, 2026Version 1.0.0