Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

swconfig.h

00001 /******************************************************************************
00002  *  swconfig.h   - definition of Class SWConfig used for saving and retrieval
00003  *                              of configuration information
00004  *
00005  * $Id: swconfig_8h-source.html,v 1.1 2003/02/28 21:21:57 mgruner Exp $
00006  *
00007  * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
00008  *      CrossWire Bible Society
00009  *      P. O. Box 2528
00010  *      Tempe, AZ  85280-2528
00011  *
00012  * This program is free software; you can redistribute it and/or modify it
00013  * under the terms of the GNU General Public License as published by the
00014  * Free Software Foundation version 2.
00015  *
00016  * This program is distributed in the hope that it will be useful, but
00017  * WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * General Public License for more details.
00020  *
00021  */
00022 
00023 #ifndef SWCONFIG_H
00024 #define SWCONFIG_H
00025 
00026 #include <stdio.h>
00027 
00028 #include <string>
00029 #include <map>
00030 
00031 #include <defs.h>
00032 #include <multimapwdef.h>
00033 
00034 
00035 SWORD_NAMESPACE_START
00036 
00037 typedef multimapwithdefault < std::string, std::string, std::less < std::string > >ConfigEntMap;
00038 typedef std::map < std::string, ConfigEntMap, std::less < std::string > >SectionMap;
00039 
00043 class SWDLLEXPORT SWConfig {
00044 private:
00045         char getline(FILE * fp, std::string & line);
00046 public:
00050         std::string filename;
00054         SectionMap Sections;
00055 
00059         SWConfig(const char *ifilename);
00060         virtual ~SWConfig();
00061 
00065         virtual void Load();
00066 
00070         virtual void Save();
00071 
00075         virtual void augment(SWConfig &addFrom);
00076         virtual SWConfig & operator +=(SWConfig &addFrom) { augment(addFrom); return *this; }
00077 
00087         virtual ConfigEntMap & operator [](const char *section);
00088         };
00089 SWORD_NAMESPACE_END
00090 #endif

Generated on Fri Feb 28 22:01:38 2003 for The Sword Project by doxygen1.3-rc3