75 enum pseudo_element_type
94 void change_name(
const std::string & newname) { class_name = newname; };
97 const std::string &
get_name()
const {
return class_name; };
103 const css &
get_value()
const {
if(class_name.empty())
throw WEBDAR_BUG;
return class_value; };
125 const std::string & descendant =
"");
129 const std::string & descendant =
"");
136 const std::string & descendant =
"");
140 const std::string & descendant =
"");
149 template<
class T>
struct sujet
154 sujet(T t): type(t) { subcomp.clear(); };
155 sujet(T t,
const std::string & sub): type(t), subcomp(sub) {};
156 sujet(
const sujet & ref) =
default;
157 sujet(sujet && ref) =
default;
158 sujet & operator = (
const sujet & ref) =
default;
159 sujet & operator = (sujet && ref) =
default;
163 bool operator < (
const sujet & ref)
const;
166 std::string class_name;
167 std::string descendant;
169 std::map<sujet<selector_type>,
css> selectors;
170 std::map<sujet<pseudo_element_type>,
css> pseudo_elements;
173 static std::string get_pseudo_element_name(pseudo_element_type pe);
176template<
class T>
bool css_class::sujet<T>::operator < (
const sujet & ref)
const
180 else if(type == ref.type)
181 return subcomp < ref.subcomp;
class css_class gather css attributed under a given label
Definition: css_class.hpp:51
void clear()
clear all css definition, including those provided with selector, only the css name is kept
Definition: css_class.hpp:143
const std::string & get_name() const
get the css_class name
Definition: css_class.hpp:97
void set_selector(selector_type sel, const css &ref, const std::string &descendant="")
defines the value for a given css_selector on that class (or pseudo-class in CSS parlance)
Definition: css_class.cpp:58
void set_value(const css &ref)
defines or overwirte the css_class value from a css object
Definition: css_class.hpp:100
selector_type
selector_type is ordered for :hover being defined after :link and :visited
Definition: css_class.hpp:56
std::string get_definition() const
returns the css class definition
Definition: css_class.cpp:107
void set_pseudo_element(pseudo_element_type pe, const css &val, const std::string &descendant="")
defines the value of a given pseudo-element
Definition: css_class.cpp:83
void change_name(const std::string &newname)
change css_class name
Definition: css_class.hpp:94
void clear_pseudo_element(pseudo_element_type pe, const std::string &descendant="")
remove definition for the given pseudo-element
Definition: css_class.cpp:96
void clear_selector(selector_type sel, const std::string &descendant="")
remove definition for the given selector type
Definition: css_class.cpp:71
void clear_value()
clear css_class value and all selector values
Definition: css_class.hpp:106
const css & get_value() const
obtain the current value
Definition: css_class.hpp:103
class managing Cascading Style Sheets attributes
Definition: css.hpp:48
void clear()
set css attributes to their default
Definition: css.cpp:116