21 using namespace basis;
30 : _section(new
astring(section)),
35 : _section(new
astring(*to_copy._section)),
36 _entry(new
astring(*to_copy._entry))
47 if (
this == &to_copy)
return *
this;
48 *_section = *to_copy._section;
49 *_entry = *to_copy._entry;
58 { *_section = new_section; }
61 { *_entry = new_entry; }
68 _current(new
astring(current_value)),
69 _default(new
astring(default_value))
73 :
configlet(to_copy.section(), to_copy.entry()),
74 _current(new
astring(*to_copy._current)),
75 _default(new
astring(*to_copy._default))
87 if (
this == &to_copy)
return *
this;
89 *_current = *to_copy._current;
90 *_default = *to_copy._default;
99 { *_current = new_current; }
102 { *_default = new_default; }
108 *_current = *_default;
123 int current_value,
int default_value)
125 _current(current_value),
126 _default(default_value)
133 { _current = new_current; }
154 const astring &entry,
int current_value,
int default_value,
156 :
int_configlet(section, entry, current_value, default_value),
166 if (new_current < _minimum)
168 if (new_current > _maximum)
Provides a dynamically resizable ASCII character string.
bounded_int_configlet(const basis::astring §ion, const basis::astring &entry, int current_value, int default_value, int minimum, int maximum)
configlet * duplicate() const
a virtual copy constructor for configlets.
virtual ~bounded_int_configlet()
Represents an atom of configuration info.
configlet & operator=(const configlet &to_copy)
const basis::astring & section() const
observes the section of this configlet.
configlet(const basis::astring §ion, const basis::astring &entry)
creates a configlet that lives in the "section" at the "entry".
const basis::astring & entry() const
observes the entry name of this configlet.
Provides a base class for configuration repositories.
bool store(const basis::astring §ion, const basis::astring &entry, const basis::astring &to_store)
a synonym for put.
virtual bool put(const basis::astring §ion, const basis::astring &entry, const basis::astring &to_store)=0
Places an item into the configuration store.
treatment_of_defaults behavior() const
observes the behavior chosen for the load() function.
virtual bool get(const basis::astring §ion, const basis::astring &entry, basis::astring &found)=0
Retrieves an item from the configuration store.
basis::astring load(const basis::astring §ion, const basis::astring &entry, const basis::astring &default_value)
a synonym for get that implements the auto-store behavior.
Stores a simple integer in a configuration repository.
int_configlet(const basis::astring §ion, const basis::astring &entry, int current_value=0, int default_value=0)
int default_value() const
virtual bool store(configurator &config) const
writes the configlet's information out to the "config".
configlet * duplicate() const
a virtual copy constructor for configlets.
virtual bool load(configurator &config)
retrieves the configlet's information from the "config".
int current_value() const
a string_configlet holds onto a character string value.
const basis::astring & current_value() const
virtual bool store(configurator &config) const
writes the configlet's information out to the "config".
virtual bool load(configurator &config)
retrieves the configlet's information from the "config".
configlet * duplicate() const
a virtual copy constructor for configlets.
string_configlet & operator=(const string_configlet &to_copy)
virtual ~string_configlet()
string_configlet(const basis::astring §ion, const basis::astring &entry, const basis::astring ¤t_value=basis::astring::empty_string(), const basis::astring &default_value=basis::astring::empty_string())
const basis::astring & default_value() const
The guards collection helps in testing preconditions and reporting errors.
void WHACK(contents *&ptr)
deletion with clearing of the pointer.
type maximum(type a, type b)
minimum returns the lesser of two values.
type minimum(type a, type b)
maximum returns the greater of two values.
const astring bogus_default