feisty meow concerns codebase  2.140
configuration::string_configlet Class Reference

a string_configlet holds onto a character string value. More...

#include <configlet.h>

Inheritance diagram for configuration::string_configlet:
Collaboration diagram for configuration::string_configlet:

Public Member Functions

 string_configlet (const basis::astring &section, const basis::astring &entry, const basis::astring &current_value=basis::astring::empty_string(), const basis::astring &default_value=basis::astring::empty_string())
 
 string_configlet (const string_configlet &to_copy)
 
virtual ~string_configlet ()
 
string_configletoperator= (const string_configlet &to_copy)
 
const basis::astringcurrent_value () const
 
const basis::astringdefault_value () const
 
void current_value (const basis::astring &new_current)
 
void default_value (const basis::astring &new_default)
 
virtual bool load (configurator &config)
 retrieves the configlet's information from the "config". More...
 
virtual bool store (configurator &config) const
 writes the configlet's information out to the "config". More...
 
configletduplicate () const
 a virtual copy constructor for configlets. More...
 
- Public Member Functions inherited from configuration::configlet
 configlet (const basis::astring &section, const basis::astring &entry)
 creates a configlet that lives in the "section" at the "entry". More...
 
 configlet (const configlet &to_copy)
 
virtual ~configlet ()
 
 DEFINE_CLASS_NAME ("configlet")
 
configletoperator= (const configlet &to_copy)
 
const basis::astringsection () const
 observes the section of this configlet. More...
 
const basis::astringentry () const
 observes the entry name of this configlet. More...
 
void section (const basis::astring &new_section) const
 modifies the configlet section location. More...
 
void entry (const basis::astring &new_entry) const
 modifies the configlet entry name. More...
 

Detailed Description

a string_configlet holds onto a character string value.

it has a current value, which could change due to updates to the configuration, and a default value that probably won't change as often. if the "load" operation fails, the default value will be used.

Definition at line 84 of file configlet.h.

Constructor & Destructor Documentation

◆ string_configlet() [1/2]

configuration::string_configlet::string_configlet ( const basis::astring section,
const basis::astring entry,
const basis::astring current_value = basis::astring::empty_string(),
const basis::astring default_value = basis::astring::empty_string() 
)

Definition at line 65 of file configlet.cpp.

Referenced by duplicate().

◆ string_configlet() [2/2]

configuration::string_configlet::string_configlet ( const string_configlet to_copy)

Definition at line 72 of file configlet.cpp.

◆ ~string_configlet()

configuration::string_configlet::~string_configlet ( )
virtual

Definition at line 79 of file configlet.cpp.

References basis::WHACK().

Member Function Documentation

◆ current_value() [1/2]

const astring & configuration::string_configlet::current_value ( ) const

Definition at line 94 of file configlet.cpp.

◆ current_value() [2/2]

void configuration::string_configlet::current_value ( const basis::astring new_current)

Definition at line 98 of file configlet.cpp.

◆ default_value() [1/2]

const astring & configuration::string_configlet::default_value ( ) const

Definition at line 96 of file configlet.cpp.

◆ default_value() [2/2]

void configuration::string_configlet::default_value ( const basis::astring new_default)

Definition at line 101 of file configlet.cpp.

◆ duplicate()

configlet * configuration::string_configlet::duplicate ( ) const
virtual

a virtual copy constructor for configlets.

the returned object will be a new copy of this configlet.

Implements configuration::configlet.

Definition at line 117 of file configlet.cpp.

References configuration::configlet::entry(), configuration::configlet::section(), and string_configlet().

◆ load()

bool configuration::string_configlet::load ( configurator config)
virtual

retrieves the configlet's information from the "config".

true is returned when this is successful. note that false is returned if the entry was not originally present; if the configurator has the AUTO_STORE behavior, then we will write out the default value on failure. the next load() would be a success in that case, but would return the default.

Implements configuration::configlet.

Definition at line 104 of file configlet.cpp.

References configuration::configurator::AUTO_STORE, configuration::configurator::behavior(), configuration::configlet::entry(), configuration::configurator::get(), configuration::configurator::put(), and configuration::configlet::section().

◆ operator=()

string_configlet & configuration::string_configlet::operator= ( const string_configlet to_copy)

Definition at line 85 of file configlet.cpp.

◆ store()

bool configuration::string_configlet::store ( configurator config) const
virtual

writes the configlet's information out to the "config".

Implements configuration::configlet.

Definition at line 114 of file configlet.cpp.

References configuration::configlet::entry(), configuration::configurator::put(), and configuration::configlet::section().


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