feisty meow concerns codebase  2.140
configuration::int_configlet Class Reference

Stores a simple integer in a configuration repository. More...

#include <configlet.h>

Inheritance diagram for configuration::int_configlet:
Collaboration diagram for configuration::int_configlet:

Public Member Functions

 int_configlet (const basis::astring &section, const basis::astring &entry, int current_value=0, int default_value=0)
 
virtual ~int_configlet ()
 
int current_value () const
 
virtual void current_value (int new_current)
 the modifier function is virtual so derived classes can extend. More...
 
int default_value () const
 
void default_value (int 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

Stores a simple integer in a configuration repository.

Definition at line 115 of file configlet.h.

Constructor & Destructor Documentation

◆ int_configlet()

configuration::int_configlet::int_configlet ( const basis::astring section,
const basis::astring entry,
int  current_value = 0,
int  default_value = 0 
)

Definition at line 122 of file configlet.cpp.

Referenced by duplicate().

◆ ~int_configlet()

configuration::int_configlet::~int_configlet ( )
virtual

Definition at line 130 of file configlet.cpp.

Member Function Documentation

◆ current_value() [1/2]

int configuration::int_configlet::current_value ( ) const
inline

Definition at line 122 of file configlet.h.

Referenced by configuration::bounded_int_configlet::current_value(), and load().

◆ current_value() [2/2]

void configuration::int_configlet::current_value ( int  new_current)
virtual

the modifier function is virtual so derived classes can extend.

Reimplemented in configuration::bounded_int_configlet.

Definition at line 132 of file configlet.cpp.

◆ default_value() [1/2]

int configuration::int_configlet::default_value ( ) const
inline

Definition at line 127 of file configlet.h.

Referenced by configuration::bounded_int_configlet::current_value().

◆ default_value() [2/2]

void configuration::int_configlet::default_value ( int  new_default)
inline

Definition at line 128 of file configlet.h.

◆ duplicate()

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

a virtual copy constructor for configlets.

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

Implements configuration::configlet.

Reimplemented in configuration::bounded_int_configlet.

Definition at line 148 of file configlet.cpp.

References int_configlet().

◆ load()

bool configuration::int_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 135 of file configlet.cpp.

References current_value(), configuration::configlet::entry(), configuration::configurator::get(), configuration::configurator::load(), and configuration::configlet::section().

◆ store()

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

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

Implements configuration::configlet.

Definition at line 145 of file configlet.cpp.

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


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