Empirical
Public Member Functions | Static Public Member Functions | List of all members
emp::web::Style Class Reference

#include <Style.h>

Public Member Functions

 Style ()
 
 Style (const Style &)=default
 
 Style (Style &&)=default
 
Styleoperator= (const Style &)=default
 
Styleoperator= (Style &&)=default
 
size_t GetSize () const
 Return a count of the number of settings that have been set. More...
 
StyleDoSet (const std::string &in_set, const std::string &in_val)
 
template<typename SET_TYPE >
StyleSet (const std::string &s, SET_TYPE v)
 Record that setting "s" is set to value "v" (converted to string) and return this object. More...
 
StyleInsert (const Style &in_css)
 Set all values from in_css here as well. Return this object. More...
 
bool Has (const std::string &setting) const
 Return true/false based on whether "setting" has been given a value in this Style. More...
 
const std::string & Get (const std::string &setting)
 
const std::map< std::string, std::string > & GetMap () const
 
void Clear ()
 Remove all setting values. More...
 
void Remove (const std::string &setting)
 Remove a specific setting value. More...
 
void Apply (const std::string &widget_id)
 Apply ALL of the style settings to a specified widget. More...
 
void Apply (const std::string &widget_id, const std::string &setting)
 Apply only a SPECIFIC style setting from the setting library. More...
 
 operator bool () const
 Have any settings be set? More...
 

Static Public Member Functions

static void Apply (const std::string &widget_id, const std::string &setting, const std::string &value)
 Apply onlay a SPECIFIC style setting with a specifid value! More...
 

Detailed Description

Class to maintain a map of setting names to values that can be easily ported over to JavaScript. A companial class, Attributes, also exists.

Constructor & Destructor Documentation

emp::web::Style::Style ( )
inline
emp::web::Style::Style ( const Style )
default
emp::web::Style::Style ( Style &&  )
default

Member Function Documentation

void emp::web::Style::Apply ( const std::string &  widget_id)
inline

Apply ALL of the style settings to a specified widget.

void emp::web::Style::Apply ( const std::string &  widget_id,
const std::string &  setting 
)
inline

Apply only a SPECIFIC style setting from the setting library.

static void emp::web::Style::Apply ( const std::string &  widget_id,
const std::string &  setting,
const std::string &  value 
)
inlinestatic

Apply onlay a SPECIFIC style setting with a specifid value!

void emp::web::Style::Clear ( )
inline

Remove all setting values.

Style& emp::web::Style::DoSet ( const std::string &  in_set,
const std::string &  in_val 
)
inline
const std::string& emp::web::Style::Get ( const std::string &  setting)
inline

Return the (string) value of "setting" that has been recorded in this Style. If setting did not exist, this does create an empty entry and return it.

const std::map<std::string, std::string>& emp::web::Style::GetMap ( ) const
inline
size_t emp::web::Style::GetSize ( ) const
inline

Return a count of the number of settings that have been set.

bool emp::web::Style::Has ( const std::string &  setting) const
inline

Return true/false based on whether "setting" has been given a value in this Style.

Style& emp::web::Style::Insert ( const Style in_css)
inline

Set all values from in_css here as well. Return this object.

emp::web::Style::operator bool ( ) const
inline

Have any settings be set?

Style& emp::web::Style::operator= ( const Style )
default
Style& emp::web::Style::operator= ( Style &&  )
default
void emp::web::Style::Remove ( const std::string &  setting)
inline

Remove a specific setting value.

template<typename SET_TYPE >
Style& emp::web::Style::Set ( const std::string &  s,
SET_TYPE  v 
)
inline

Record that setting "s" is set to value "v" (converted to string) and return this object.


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