Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Configuration.h

Go to the documentation of this file.
00001 /*
00002  * Configuration.h
00003  *
00004  * Smalltalk like class library for C++
00005  * Application configuration holder. Header.
00006  *
00007  * Copyright (c) 2004 Milan Cermak, Petr Stepanek
00008  */
00009 /*
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2.1 of the License, or (at your option) any later version.
00014  *
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  */
00024 #ifndef __CONFIGURATION_H
00025 #define __CONFIGURATION_H
00026 
00027 #include <stlib/Object.h>
00028 
00029 #include <stlib/Dictionary.h>
00030 #include <stlib/Set.h>
00031 #include <stlib/String.h>
00032 #include <stlib/Stream.h>
00033 
00034 namespace Tools {
00035 
00036 class ConfigurationReader;
00037 
00038 class Configuration : public Core::Object
00039 {
00040   protected:
00041     Dictionary *bindings;
00042     static Dictionary *_instances;
00043     static ConfigurationReader *_reader;
00044 
00045   public:
00046     Configuration(void);
00047     Configuration(String *name);
00048     virtual ~Configuration(void);
00049 
00050     /* Instance creation protocol */
00051     static Object *namedAt(String *name, String *item);
00052     static Configuration *named(String *name);
00053     static Configuration *fromFile(String *filename);
00054 
00055     /* Class-accessing protocol */
00056     virtual String *className(void) const;
00057     static ConfigurationReader *configurationReader(void);
00058     static void configurationReader(ConfigurationReader *reader);
00059     static Dictionary *instances(void);
00060 
00061     /* Accessing protocol */
00062     virtual Object *at(String *key);
00063     virtual Object *at(const char *key);
00064     virtual Object *at(String *key, Object *ifAbsentValue);
00065     virtual Object *at(const char *key, const char *ifAbsentValue);
00066     virtual void put(String *key, Object *value);
00067     virtual Set *keys(void);
00068 
00069     /* Printing protocol */
00070     virtual void printOn(Stream *stream) const;
00071 
00072     /* Removing protocol */
00073     virtual Object *removeKey(String *key);
00074 
00075     /* Testing protocol */
00076     virtual bool includesKey(String *key);
00077     virtual bool isEmpty(void);
00078 
00079     /* Utilities protocol */
00080     static void reloadAll(void);
00081 };
00082 
00083 };
00084 
00085 #endif /* __CONFIGURATION_H */

Generated on Mon Nov 27 09:47:54 2006 for Smalltalk like C++ Class Library by  doxygen 1.4.2