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

Manages XML namespace state for a document. More...

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

Public Member Functions

 XMLNamespaceContext (Registry &registry)
 Constructor, this should only be called once to construct on the given Registry, with registry.ctx().emplace<XMLNamespaceContext>(registry).
 
void addNamespaceOverride (Entity entity, const XMLQualifiedName &name, const RcString &uri)
 Add a namespace override for the given entity.
 
void removeNamespaceOverride (Entity entity, const XMLQualifiedName &name)
 Removes a namespace override for the given entity.
 
std::optional< RcStringgetNamespaceUri (Registry &registry, Entity entity, const RcString &prefix) const
 Get the URI for the given namespace prefix.
 

Detailed Description

Manages XML namespace state for a document.

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 namespace state for a document.
Definition XMLNamespaceContext.h:23

Constructor & Destructor Documentation

◆ XMLNamespaceContext()

donner::xml::components::XMLNamespaceContext::XMLNamespaceContext ( Registry & registry)
inlineexplicit

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

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

Parameters
registryUnderlying registry for the document.

Member Function Documentation

◆ addNamespaceOverride()

void donner::xml::components::XMLNamespaceContext::addNamespaceOverride ( Entity entity,
const XMLQualifiedName & name,
const RcString & uri )
inline

Add a namespace override for the given entity.

If the attribute has changed this may be called again with the same name but different URI.

Parameters
entityEntity to add the namespace override for.
prefixNamespace prefix to override.
uriNamespace URI to use for the prefix.

◆ getNamespaceUri()

std::optional< RcString > donner::xml::components::XMLNamespaceContext::getNamespaceUri ( Registry & registry,
Entity entity,
const RcString & prefix ) const
inline

Get the URI for the given namespace prefix.

Parameters
registryRegistry to use for the lookup.
entityEntity to get the namespace URI for.
prefixNamespace prefix to get the URI for.
Returns
The URI for the given namespace prefix, or an empty string if the prefix is not found.

◆ removeNamespaceOverride()

void donner::xml::components::XMLNamespaceContext::removeNamespaceOverride ( Entity entity,
const XMLQualifiedName & name )
inline

Removes a namespace override for the given entity.

Parameters
entityEntity to remove the namespace override for.
prefixNamespace prefix to remove.

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