class

MdfPackageText

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

Public functions

ReturnsNameDescription
std::stringStripSummaryRemoves a leading package summary and returns its class; empty (and doc untouched) when the document is not a package.
std::stringClassOfThe class a package's bytes declare in any encoding — binary package, mdfb (a cooked text package) or text.
std::stringIdOf
voidCollectReferencesAsset references under node: @-reference values and strings that name a Content/ path — what a package lists as its imports.
boolWrapThe text package around payloadText (the document the type writes): class assetClass, the id existingBytes already carries (a save over the asset) or newId, and the payload's references as imports.

Function details

StripSummary

C++
static std::string StripSummary(MdfDocument& doc)

Removes a leading package summary and returns its class; empty (and doc untouched) when the document is not a package.

ClassOf

C++
static std::string ClassOf(const std::string& bytes)

The class a package's bytes declare in any encoding — binary package, mdfb (a cooked text package) or text. Empty when it is not a package.

IdOf

C++
static std::string IdOf(const std::string& bytes)

CollectReferences

C++
static void CollectReferences(const MdfNode& node, std::vector<std::string>& out)

Asset references under node: @-reference values and strings that name a Content/ path — what a package lists as its imports.

Wrap

C++
static bool Wrap(const std::string& payloadText, const std::string& assetClass, const std::string& existingBytes, const std::string& newId, std::string& outText, std::string* error = nullptr)

The text package around payloadText (the document the type writes): class assetClass, the id existingBytes already carries (a save over the asset) or newId, and the payload's references as imports. A payload that already leads with a summary is re-wrapped, not nested.

Generated from mdf/mdf_package_text.h via mdf.json · Oct 26, 2026Version 1.0.0