1 #ifndef CONFIGURATION_LIST_CLASS
2 #define CONFIGURATION_LIST_CLASS
4 /*****************************************************************************\
6 * Name : configuration_list *
7 * Author : Chris Koeritz *
9 *******************************************************************************
10 * Copyright (c) 2001-$now By Author. This program is free software; you can *
11 * redistribute it and/or modify it under the terms of the GNU General Public *
12 * License as published by the Free Software Foundation; either version 2 of *
13 * the License or (at your option) any later version. This is online at: *
14 * http://www.fsf.org/copyleft/gpl.html *
15 * Please send any updates to: fred@gruntose.com *
16 \*****************************************************************************/
18 #include <basis/contracts.h>
20 namespace configuration {
25 #include <configuration/configurator.h>
27 //! Manages a collection of configlet objects.
29 This class provides the ability to operate on the collection of configlets
30 as a whole. They can be retrieved from or stored to a configurator object.
33 class configuration_list : public virtual basis::root_object
37 virtual ~configuration_list();
39 DEFINE_CLASS_NAME("configuration_list");
41 void reset(); //!< removes all items from the list.
43 void add(const configlet &new_item);
44 //!< adds another configuration atom into the list.
46 const configlet *find(const configlet &to_find) const;
47 //!< locates the actual configlet with the section and entry of "to_find".
48 /*!< note that this might fail if no matching section and entry are found,
49 thus returning NIL. the returned object is still kept in the list, so
50 do not try to destroy it. also note that the object passed in must be
51 the same type as the object to be found; otherwise, NIL will be
54 bool zap(const configlet &dead_item);
55 //!< removes a previously added configuration item.
56 /*!< the "dead_item" need only provide the section and entry names. */
58 //! reads the values of all the configlets stored in "config" into this.
59 bool load(configurator &config);
60 //! writes the current values of all the configlets in "this" into "config".
61 bool store(configurator &config) const;
64 cl_figlet_list *_figs; //!< our list of configlets.