Donner
C++20 SVG rendering library
Loading...
Searching...
No Matches
donner::css::Declaration Struct Reference

A declaration is a CSS name/value pair, such as color: red;. More...

#include "donner/css/Declaration.h"

Collaboration diagram for donner::css::Declaration:
[legend]

Public Member Functions

 Declaration (RcString name, std::vector< ComponentValue > values={}, const FileOffset &sourceOffset=FileOffset::Offset(0), bool important=false)
 Construct a new Declaration object.
 ~Declaration ()=default
 Destructor.
 Declaration (const Declaration &other)=default
 Copy constructor.
 Declaration (Declaration &&other) noexcept=default
 Move constructor.
Declarationoperator= (const Declaration &other)=default
 Copy assignment operator.
Declarationoperator= (Declaration &&other) noexcept=default
 Move assignment operator.
bool operator== (const Declaration &other) const =default
 Equality operator.

Public Attributes

RcString name
 Name of the declaration.
std::vector< ComponentValuevalues
 List of component values for the declaration.
FileOffset sourceOffset
 Offset of the declaration name in the source string.
bool important = false
 Whether the declaration ends with !important.

Friends

std::ostream & operator<< (std::ostream &os, const Declaration &declaration)
 Output a human-readable representation of the declaration to a stream.

Detailed Description

A declaration is a CSS name/value pair, such as color: red;.

The name is a CSS identifier, and the value is a list of component values which can be parsed into higher-level constructs, such as a transform: transform: translate(10px, 20px);.

The important flag is set if the declaration ends with !important, and the tokens for !important are not included in the values list.

Constructor & Destructor Documentation

◆ Declaration()

donner::css::Declaration::Declaration ( RcString name,
std::vector< ComponentValue > values = {},
const FileOffset & sourceOffset = FileOffset::Offset(0),
bool important = false )
inline

Construct a new Declaration object.

Parameters
nameName of the declaration.
valuesList of component values for the declaration.
sourceOffsetOffset of the declaration name in the source string.
importantWhether the declaration ends with !important.

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const Declaration & declaration )
friend

Output a human-readable representation of the declaration to a stream.

Parameters
osOutput stream.
declarationDeclaration to output.

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