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

Maintains a map of attribute names to values for use in JavaScript Closely related to Style.h, which is for CSS-values. More...

#include <Attributes.h>

Public Member Functions

 Attributes ()
 
 Attributes (const Attributes &)=default
 
Attributesoperator= (const Attributes &)=default
 
int GetSize () const
 Return a count of the number of attributes that have been set. More...
 
AttributesDoSet (const std::string &in_set, const std::string &in_val)
 
template<typename SET_TYPE >
AttributesSet (const std::string &s, SET_TYPE v)
 Record that attribute "a" is set to value "v" (converted to string) and return this object. More...
 
AttributesInsert (const Attributes &in_attr)
 Set all values from in_attr 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 Attributes obj. More...
 
const std::string & Get (const std::string &setting)
 
const std::map< std::string, std::string > & GetMap () const
 
void Remove (const std::string &setting)
 
void Clear ()
 Remove all setting values. More...
 
void Apply (const std::string &widget_id)
 Apply ALL of the Attribute's settings to dom element "widget_id". More...
 
void Apply (const std::string &widget_id, const std::string &setting)
 Apply onlay a SPECIFIC attributes setting from the setting library to widget_id. More...
 
 operator bool () const
 Convert to true if there are any setting, false otherwise. 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 attributes setting with a specifid value! More...
 

Detailed Description

Maintains a map of attribute names to values for use in JavaScript Closely related to Style.h, which is for CSS-values.

Constructor & Destructor Documentation

emp::web::Attributes::Attributes ( )
inline
emp::web::Attributes::Attributes ( const Attributes )
default

Member Function Documentation

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

Apply ALL of the Attribute's settings to dom element "widget_id".

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

Apply onlay a SPECIFIC attributes setting from the setting library to widget_id.

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

Apply onlay a SPECIFIC attributes setting with a specifid value!

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

Remove all setting values.

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

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

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

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

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

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

Attributes& emp::web::Attributes::Insert ( const Attributes in_attr)
inline

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

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

Convert to true if there are any setting, false otherwise.

Attributes& emp::web::Attributes::operator= ( const Attributes )
default
void emp::web::Attributes::Remove ( const std::string &  setting)
inline
template<typename SET_TYPE >
Attributes& emp::web::Attributes::Set ( const std::string &  s,
SET_TYPE  v 
)
inline

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


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