SVG for C++
Loading...
Searching...
No Matches
SVG::Variables< T > Class Template Reference

#include <svg.hpp>

Inherits detail::TypedNames< T >.

Public Member Functions

 Variables (AttributeMap &target, std::initializer_list< VariableSpec< T > > specs)
std::string var (T key) const
Variables & set (T key, const std::string &value)
Variables & set (T key, const char *value)
template<typename... Keys>
std::string format (const std::string &pattern, Keys... keys) const

Detailed Description

template<typename T>
class SVG::Variables< T >

Typed helper for defining and referencing CSS custom properties without stringly lookups.

Constructor & Destructor Documentation

◆ Variables()

template<typename T>
SVG::Variables< T >::Variables ( AttributeMap & target,
std::initializer_list< VariableSpec< T > > specs )
inline

Validate the enum-to-name map and apply any initial values to the target style block.

Member Function Documentation

◆ format()

template<typename T>
template<typename... Keys>
std::string SVG::Variables< T >::format ( const std::string & pattern,
Keys... keys ) const
inline

Replace numbered placeholders like "{0}" with typed var() references.

◆ set() [1/2]

template<typename T>
Variables & SVG::Variables< T >::set ( T key,
const char * value )
inline

Set a CSS custom property value from a string literal.

◆ set() [2/2]

template<typename T>
Variables & SVG::Variables< T >::set ( T key,
const std::string & value )
inline

Set a CSS custom property value in the bound style block.

◆ var()

template<typename T>
std::string SVG::Variables< T >::var ( T key) const
inline

Return a CSS var() reference for a typed key.


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