Donner
C++20 SVG rendering library
Loading...
Searching...
No Matches
donner::xml::components::EntityDeclarationsContext Class Reference

Manages XML entity declarations for a document. More...

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

Public Member Functions

 EntityDeclarationsContext ()=default
 Constructor, should only be called once to construct on the given Registry, with registry.ctx().emplace<EntityDeclarationsContext>().
 
void addEntityDeclaration (EntityType type, const RcStringOrRef &name, const RcString &value, bool isExternal=false)
 Adds an entity declaration.
 
std::optional< std::pair< RcString, bool > > getEntityDeclaration (EntityType type, const RcStringOrRef &name) const
 Gets the replacement text for a general entity by name.
 

Detailed Description

Manages XML entity declarations for a document.

Stores general and parameter entity declarations from DOCTYPE sections. Currently used to store entity declarations, but complete entity expansion in the parsed XML content is not yet implemented (TODO).

Access via the Registry::ctx API:

A parser result, which may contain a result of type T, or an error, or both.
Definition ParseResult.h:17
Manages XML entity declarations for a document.
Definition EntityDeclarationsContext.h:28

Constructor & Destructor Documentation

◆ EntityDeclarationsContext()

donner::xml::components::EntityDeclarationsContext::EntityDeclarationsContext ( )
default

Constructor, should only be called once to construct on the given Registry, with registry.ctx().emplace<EntityDeclarationsContext>().

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

Member Function Documentation

◆ addEntityDeclaration()

void donner::xml::components::EntityDeclarationsContext::addEntityDeclaration ( EntityType type,
const RcStringOrRef & name,
const RcString & value,
bool isExternal = false )
inline

Adds an entity declaration.

Parameters
typeThe type of the entity (general or parameter).
nameThe name of the entity.
valueThe replacement text for the entity.
isExternalWhether this is an external entity.

◆ getEntityDeclaration()

std::optional< std::pair< RcString, bool > > donner::xml::components::EntityDeclarationsContext::getEntityDeclaration ( EntityType type,
const RcStringOrRef & name ) const
inline

Gets the replacement text for a general entity by name.

Parameters
typeThe type of the entity (general or parameter).
nameThe name of the entity.
Returns
The replacement text and whether it's external, or std::nullopt if not found.

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