Donner SVG main
0.8.0 ยท 382bd0190.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::xml::components::XMLDocumentContext Class Reference

Holds global state of an XML document, such as the root element. More...

#include "donner/base/xml/components/XMLDocumentContext.h"

Classes

struct  UnreparsedSpan
 One source span the live tree does not reflect, with the failure that reported it. More...

Public Member Functions

 XMLDocumentContext (InternalCtorTag ctorTag)
 Internal constructor, creates a context on the given XMLDocument.

Public Attributes

Entity rootEntity = entt::null
 Root entity of the document.
const std::shared_ptr< XMLSourceStoreHolder > sourceStoreHolder
 Source store for parsed documents that own their source projection. The holder is created with the context and never replaced; only the store inside it is.
bool declaredDoctypeInternalSubset = false
 Whether the parse that built this document resolved a DOCTYPE internal subset. Set by the XML parser while it consumes the DOCTYPE, and cleared only when whole new source is installed, since incremental fragment reparses never see the prolog.
bool sourceRequiresDocumentEntityParser = false
 Entity policy or expansion limits require document-wide parsing, not isolated fragments.
bool sourceRequiresDocumentReparse = false
 A Document-scope failed source edit invalidated global context until a full parse.
std::shared_ptr< const XMLSourceParseOptions > sourceParserOptions
 Immutable original parser policy, weakly bound to the source store it built.
std::vector< UnreparsedSpan > unreparsedSpans
 Source spans the live tree does not reflect.
std::uint64_t unreparsedSpanSequence = 0
 Monotonic recency counter for unreparsedSpans; the newest reason is surfaced.
std::uint64_t maximumSourceEditTreeNodes = kDefaultMaximumSourceEditTreeNodes
 Maximum live non-document XML nodes admitted by one incremental source edit.
int maximumSourceEditTreeDepth = kDefaultMaximumSourceEditTreeDepth
 Maximum attached element depth admitted by one incremental source edit.
std::uint64_t maximumSourceEditTotalAttributes = kDefaultMaximumSourceEditTotalAttributes
 Maximum live attributes admitted by one incremental source edit.

Static Public Attributes

static constexpr std::uint64_t kDefaultMaximumSourceEditTreeNodes = 8'192
 Bounded incremental-edit defaults, kept in sync with XMLParser::Options.
static constexpr int kDefaultMaximumSourceEditTreeDepth = 256
 Default maximum attached element depth after an incremental source edit.
static constexpr std::uint64_t kDefaultMaximumSourceEditTotalAttributes = 100'000
 Default maximum live attributes after an incremental source edit.

Friends

class donner::xml::XMLDocument
class donner::xml::XMLNode

Detailed Description

Holds global state of an XML document, such as the root element.

One instance of this class is created per XML document.

Access the document context via the Registry::ctx API:

XMLDocumentContext& context = registry.ctx().get<XMLDocumentContext>();
XMLDocumentContext(InternalCtorTag ctorTag)
Internal constructor, creates a context on the given XMLDocument.
Definition XMLDocumentContext.h:74

Class Documentation

◆ donner::xml::components::XMLDocumentContext::UnreparsedSpan

struct donner::xml::components::XMLDocumentContext::UnreparsedSpan

One source span the live tree does not reflect, with the failure that reported it.

Class Members
ParseDiagnostic diagnostic Failure that marked the span; surfaced verbatim while pending. Its range tracks the span across later edits.
size_t end = 0 End byte offset in current source coordinates (exclusive).
uint64_t sequence = 0 Recency order for surfacing; higher is a newer failure.
size_t start = 0 Start byte offset in current source coordinates (inclusive).

Constructor & Destructor Documentation

◆ XMLDocumentContext()

donner::xml::components::XMLDocumentContext::XMLDocumentContext ( InternalCtorTag ctorTag)
inlineexplicit

Internal constructor, creates a context on the given XMLDocument.

To use this class, access it via the Registry::ctx API.

XMLDocumentContext& context = registry.ctx().get<XMLDocumentContext>();
Parameters
ctorTagInternal tag to allow construction.

Member Data Documentation

◆ sourceStoreHolder

const std::shared_ptr<XMLSourceStoreHolder> donner::xml::components::XMLDocumentContext::sourceStoreHolder
Initial value:
=
std::make_shared<XMLSourceStoreHolder>()

Source store for parsed documents that own their source projection. The holder is created with the context and never replaced; only the store inside it is.

◆ unreparsedSpans

std::vector<UnreparsedSpan> donner::xml::components::XMLDocumentContext::unreparsedSpans

Source spans the live tree does not reflect.

Empty means the tree matches the source.

Spans are mapped across every source change and removed only when a successful reparse covers them, so an empty set is the sound staleness signal for consumers that slice current source bytes: a later success elsewhere never clears an unrelated broken span.


The documentation for this class was generated from the following file: