first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / core / library / configuration / configurable.h
1 #ifndef CONFIGURABLE_CLASS
2 #define CONFIGURABLE_CLASS
3
4 /*****************************************************************************\
5 *                                                                             *
6 *  Name   : configurable                                                      *
7 *  Author : Chris Koeritz                                                     *
8 *                                                                             *
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 \*****************************************************************************/
17
18 //! base class for objects that support configuration_list updates.
19 /*!
20   The configuration_list implements a set of configuration items and it can
21   be used to represent a "delta" between the current configuration of an
22   object and a new configuration that is desired.  Objects based on the
23   configurable class support taking that delta chunk of configuration info
24   and adapting their current internal configuration to meet the request, if
25   possible.  These objects also support querying their current configuration,
26   which reports all configuration item names and current settings.
27 */
28
29 #include <basis/contracts.h>
30
31
32 // forward.
33 class configuration_list;
34
35 class configurable : public virtual root_object
36 {
37 public:
38   virtual ~configurable() {}
39
40   DEFINE_CLASS_NAME("configurable");
41
42   virtual void get_config(configuration_list &to_fill, bool append) const = 0;
43     //!< interprets the contents of this object as a configuration list.
44     /*!< the list of configlets can be stored in any configurator object.
45     if the "append" flag is true, then the list is added to.  otherwise it
46     is cleared first.  this method can also be used to retrieve the configlets
47     that this class defines as its configuration interface.  that list can
48     then be filled in using a configurator and passed to set_config(). */
49
50   virtual bool set_config(const configuration_list &to_use) = 0;
51     //!< retrieves the config items from "to_use" and stores them here.
52     /*!< false is returned if any of the key items are missing or if the
53     new key cannot be decoded. */
54 };
55
56 #endif
57