Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
Loading...
Searching...
No Matches
ConditionalProcessingComponent.h File Reference
#include <optional>
#include <span>
#include <string_view>
#include <vector>
#include "donner/base/RcString.h"
#include "donner/base/xml/XMLQualifiedName.h"
Include dependency graph for ConditionalProcessingComponent.h:

Classes

struct  donner::svg::components::ConditionalProcessingComponent
 Stores the SVG conditional-processing attributes (requiredFeatures, requiredExtensions, systemLanguage) for an element. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.
namespace  donner::svg
 Donner SVG library, which can load, manipulate and render SVG files.
namespace  donner::svg::components
 Contains the implementation of the Donner ECS,.

Functions

bool donner::svg::components::IsConditionalProcessingAttribute (const xml::XMLQualifiedNameRef &name)
 Return true if name is one of the SVG conditional-processing attributes.
bool donner::svg::components::SetConditionalProcessingAttribute (ConditionalProcessingComponent &conditional, const xml::XMLQualifiedNameRef &name, std::string_view value)
 Store a conditional-processing attribute value.
bool donner::svg::components::RemoveConditionalProcessingAttribute (ConditionalProcessingComponent &conditional, const xml::XMLQualifiedNameRef &name)
 Clear a conditional-processing attribute value.
bool donner::svg::components::HasConditionalProcessingAttributes (const ConditionalProcessingComponent &conditional)
 Return true if any conditional-processing attribute is still present on conditional.
bool donner::svg::components::EvaluateConditionalProcessing (const ConditionalProcessingComponent &conditional, std::span< const RcString > userLanguages)
 Evaluates an element's conditional-processing attributes.
bool donner::svg::components::EvaluateConditionalProcessing (const ConditionalProcessingComponent &conditional)
 Overload of EvaluateConditionalProcessing that uses the default user language list of {"en"}, matching resvg's default (the resvg-test-suite goldens are rendered with it).
bool donner::svg::components::SystemLanguageMatches (std::string_view systemLanguage, std::string_view userLanguage)
 Evaluates a single systemLanguage attribute value against the user-preferred language.

Class Documentation

◆ donner::svg::components::ConditionalProcessingComponent

struct donner::svg::components::ConditionalProcessingComponent

Stores the SVG conditional-processing attributes (requiredFeatures, requiredExtensions, systemLanguage) for an element.

Attached only when at least one of the attributes is present.

These attributes control whether an element renders: on a direct child of <switch> they select the first matching child, and on any other rendered element they disable rendering of the element (and its subtree) when they evaluate to false.

See https://www.w3.org/TR/SVG2/struct.html#ConditionalProcessing

Class Members
optional< RcString > requiredExtensions Raw requiredExtensions attribute value, a whitespace-separated list of extension IRIs.

Donner supports no extensions, so any non-empty value evaluates to false.

optional< RcString > requiredFeatures Raw requiredFeatures attribute value.

Deprecated in SVG2; always evaluates to true, matching resvg's behavior. Stored so the DOM state reflects the document.

optional< RcString > systemLanguage Raw systemLanguage attribute value, a comma-separated list of BCP 47 language tags.

Evaluates to true if any listed tag matches a user-preferred language.