X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=nucleus%2Flibrary%2Fconfiguration%2Fconfiguration_list.h;fp=nucleus%2Flibrary%2Fconfiguration%2Fconfiguration_list.h;h=0aea0ca70ae2fbc3b703181f8a48b4515e9395b4;hb=457b128b77b5b4a0b7dd3094de543de2ce1477ad;hp=0000000000000000000000000000000000000000;hpb=32d7caf45d886d0d24e69eea00511c7815ac15d0;p=feisty_meow.git diff --git a/nucleus/library/configuration/configuration_list.h b/nucleus/library/configuration/configuration_list.h new file mode 100644 index 00000000..0aea0ca7 --- /dev/null +++ b/nucleus/library/configuration/configuration_list.h @@ -0,0 +1,70 @@ +#ifndef CONFIGURATION_LIST_CLASS +#define CONFIGURATION_LIST_CLASS + +/*****************************************************************************\ +* * +* Name : configuration_list * +* Author : Chris Koeritz * +* * +******************************************************************************* +* Copyright (c) 2001-$now By Author. This program is free software; you can * +* redistribute it and/or modify it under the terms of the GNU General Public * +* License as published by the Free Software Foundation; either version 2 of * +* the License or (at your option) any later version. This is online at: * +* http://www.fsf.org/copyleft/gpl.html * +* Please send any updates to: fred@gruntose.com * +\*****************************************************************************/ + +#include + +namespace configuration { + +// forward. +class cl_figlet_list; +class configlet; +#include + +//! Manages a collection of configlet objects. +/*! + This class provides the ability to operate on the collection of configlets + as a whole. They can be retrieved from or stored to a configurator object. +*/ + +class configuration_list : public virtual basis::root_object +{ +public: + configuration_list(); + virtual ~configuration_list(); + + DEFINE_CLASS_NAME("configuration_list"); + + void reset(); //!< removes all items from the list. + + void add(const configlet &new_item); + //!< adds another configuration atom into the list. + + const configlet *find(const configlet &to_find) const; + //!< locates the actual configlet with the section and entry of "to_find". + /*!< note that this might fail if no matching section and entry are found, + thus returning NIL. the returned object is still kept in the list, so + do not try to destroy it. also note that the object passed in must be + the same type as the object to be found; otherwise, NIL will be + returned. */ + + bool zap(const configlet &dead_item); + //!< removes a previously added configuration item. + /*!< the "dead_item" need only provide the section and entry names. */ + + //! reads the values of all the configlets stored in "config" into this. + bool load(configurator &config); + //! writes the current values of all the configlets in "this" into "config". + bool store(configurator &config) const; + +private: + cl_figlet_list *_figs; //!< our list of configlets. +}; + +} //namespace. + +#endif +