SVG for C++
Loading...
Searching...
No Matches
SVG::AttributeMap Class Reference

Base class for anything that has attributes (e.g. SVG elements, CSS stylesheets). More...

#include <svg.hpp>

Inherited by SVG::Element.

Classes

struct  AttrSetter

Public Member Functions

 AttributeMap (SVGAttrib _attr)
const SVGAttrib & attrs () const
bool has_attr (const std::string &key) const
std::string get_attr (const std::string &key, const std::string &fallback="") const
template<typename T>
std::enable_if< detail::is_numeric_attr_type< T >::value, T >::type get_attr (const std::string &key, T fallback) const
template<typename T>
AttributeMap & set_attr (const std::string key, T value)
AttributeMap & set_attr (const std::string key, const Color &value)
AttributeMap & set_attrs (std::initializer_list< std::pair< std::string, std::string > > values)
AttributeMap & set_attrs (const SVGAttrib &values)
AttrSetter set_attr (const std::string key)
ClassList class_list ()
ClassList class_list () const
TransformList transform_list ()
TransformList transform_list () const
TransformList transform ()
TransformList transform () const
template<>
AttributeMap & set_attr (const std::string key, const double value)
template<>
AttributeMap & set_attr (const std::string key, const char *value)
template<>
AttributeMap & set_attr (const std::string key, const std::string value)

Protected Member Functions

virtual void set_attr_value (const std::string &key, const std::string &value)
virtual AttrSetter make_attr_setter (const std::string &key)
SVGAttrib & mutable_attrs ()

Detailed Description

Base class for anything that has attributes (e.g. SVG elements, CSS stylesheets).

Member Function Documentation

◆ get_attr()

template<typename T>
std::enable_if< detail::is_numeric_attr_type< T >::value, T >::type SVG::AttributeMap::get_attr ( const std::string & key,
T fallback ) const
inline

Return a numeric attribute value, or fallback when unset or not parseable as a number.

◆ set_attr() [1/4]

template<>
AttributeMap & SVG::AttributeMap::set_attr ( const std::string key,
const char * value )
inline

Modify the attribute specified by key

◆ set_attr() [2/4]

AttributeMap & SVG::AttributeMap::set_attr ( const std::string key,
const Color & value )
inline

Set an attribute to a serialized color token.

◆ set_attr() [3/4]

template<>
AttributeMap & SVG::AttributeMap::set_attr ( const std::string key,
const double value )
inline

Modify the attribute specified by key

◆ set_attr() [4/4]

template<>
AttributeMap & SVG::AttributeMap::set_attr ( const std::string key,
const std::string value )
inline

Modify the attribute specified by key

◆ set_attrs() [1/2]

AttributeMap & SVG::AttributeMap::set_attrs ( const SVGAttrib & values)
inline

Set multiple attributes from an existing attribute map.

◆ set_attrs() [2/2]

AttributeMap & SVG::AttributeMap::set_attrs ( std::initializer_list< std::pair< std::string, std::string > > values)
inline

Set multiple attributes at once


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