Donner SVG main
0.8.0 ยท 766e862a0.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
CssSourceReference.h File Reference
#include <functional>
#include <optional>
#include <span>
#include <string_view>
#include "donner/css/ComponentValue.h"
Include dependency graph for CssSourceReference.h:

Classes

struct  donner::editor::CssSourceReference
 A named reference as written in an authored CSS declaration. More...
struct  donner::editor::CssSourceReferenceHooks
 Optional accounting and fallback boundaries when indexing authored references. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Functions

bool donner::editor::VisitCssSourceReferences (std::span< const css::ComponentValue > values, std::string_view cssSource, const std::function< bool(const CssSourceReference &)> &visit, const std::function< std::optional< bool >(std::string_view)> &hasValue={}, const CssSourceReferenceHooks &hooks={})
 Visit CSS references in lexical order. The visitor returns false to stop traversal. When available, the prepared-value predicate selects the active var() fallback. A missing answer leaves the fallback unvisited. Without a predicate all authored fallbacks are visited.

Function Documentation

◆ VisitCssSourceReferences()

bool donner::editor::VisitCssSourceReferences ( std::span< const css::ComponentValue > values,
std::string_view cssSource,
const std::function< bool(const CssSourceReference &)> & visit,
const std::function< std::optional< bool >(std::string_view)> & hasValue = {},
const CssSourceReferenceHooks & hooks = {} )

Visit CSS references in lexical order. The visitor returns false to stop traversal. When available, the prepared-value predicate selects the active var() fallback. A missing answer leaves the fallback unvisited. Without a predicate all authored fallbacks are visited.

Parameters
valuesParsed CSS component values to inspect.
cssSourceAuthored CSS against which the components' offsets were measured.
visitCallback for each reference. Borrowed names are valid only during traversal.
hasValueOptional predicate for a usable prepared custom-property value.
hooksOptional callbacks to charge work and track entry to and exit from fallbacks.
Returns
True if traversal completed, or false if the visitor or accounting stopped it.