00001 /*------------------------------------------------------------------------------ 00002 00003 Copyright (c) 2000 Tyrell Corporation. All rights reserved. 00004 00005 Tyrell Config 00006 00007 File : DarkIceConfig.h 00008 Version : $Revision: 1.2 $ 00009 Author : $Author: darkeye $ 00010 Location : $Source: /cvsroot/darkice/darkice/src/DarkIceConfig.h,v $ 00011 00012 Copyright notice: 00013 00014 This program is free software; you can redistribute it and/or 00015 modify it under the terms of the GNU General Public License 00016 as published by the Free Software Foundation; either version 2 00017 of the License, or (at your option) any later version. 00018 00019 This program is distributed in the hope that it will be useful, 00020 but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 GNU General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License 00025 along with this program; if not, write to the Free Software 00026 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00027 00028 ------------------------------------------------------------------------------*/ 00029 #ifndef CONFIG_H 00030 #define CONFIG_H 00031 00032 #ifndef __cplusplus 00033 #error This is a C++ include file 00034 #endif 00035 00036 00037 /* ============================================================ include files */ 00038 00039 #include <map> 00040 #include <string> 00041 00042 #include <iostream> 00043 00044 #include "Referable.h" 00045 #include "ConfigSection.h" 00046 00047 00048 /* ================================================================ constants */ 00049 00050 00051 /* =================================================================== macros */ 00052 00053 00054 /* =============================================================== data types */ 00055 00079 class Config : public virtual Referable 00080 { 00081 private: 00082 00086 typedef std::map<std::string, ConfigSection> TableType; 00087 00093 TableType table; 00094 00100 std::string currentSection; 00101 00102 00103 protected: 00104 00105 00106 public: 00107 00113 inline 00114 Config ( void ) throw ( Exception ) 00115 { 00116 } 00117 00125 inline 00126 Config ( std::istream & is ) throw ( Exception ) 00127 { 00128 read( is ); 00129 } 00130 00136 inline virtual 00137 ~Config ( void ) throw ( Exception ) 00138 { 00139 } 00140 00141 00142 /* TODO 00143 00144 inline 00145 Config ( const Config & di ) throw ( Exception ) 00146 { 00147 } 00148 00149 00150 inline Config & 00151 operator= ( const Config * di ) throw ( Exception ) 00152 { 00153 } 00154 */ 00155 00162 inline virtual void 00163 reset ( void ) throw ( Exception ) 00164 { 00165 table.clear(); 00166 currentSection = ""; 00167 } 00168 00176 virtual bool 00177 addLine ( const char * line ) throw ( Exception ); 00178 00186 virtual void 00187 read ( std::istream & is ) throw ( Exception ); 00188 00196 virtual const ConfigSection * 00197 get ( const char * key ) const throw ( Exception ); 00198 }; 00199 00200 00201 /* ================================================= external data structures */ 00202 00203 00204 /* ====================================================== function prototypes */ 00205 00206 00207 00208 #endif /* CONFIG_H */ 00209 00210 00211 /*------------------------------------------------------------------------------ 00212 00213 $Source: /cvsroot/darkice/darkice/src/DarkIceConfig.h,v $ 00214 00215 $Log: DarkIceConfig.h,v $ 00216 Revision 1.2 2005/04/14 11:53:17 darkeye 00217 fixed API documentation issues 00218 00219 Revision 1.1 2005/04/04 08:36:17 darkeye 00220 commited changes to enable Jack support 00221 thanks to Nicholas J. Humfrey, njh@ecs.soton.ac.uk 00222 00223 Revision 1.5 2002/05/28 12:35:41 darkeye 00224 code cleanup: compiles under gcc-c++ 3.1, using -pedantic option 00225 00226 Revision 1.4 2001/09/05 20:11:15 darkeye 00227 removed dependency on locally stored SGI STL header files 00228 now compiler-supplied C++ library STL header files are used 00229 compiles under GNU C++ 3 00230 hash_map (an SGI extension to STL) replaced with map 00231 std:: namespace prefix added to all STL class references 00232 00233 Revision 1.3 2000/11/13 18:46:50 darkeye 00234 added kdoc-style documentation comments 00235 00236 Revision 1.2 2000/11/09 22:07:19 darkeye 00237 added constructor with istream 00238 00239 Revision 1.1 2000/11/08 17:29:50 darkeye 00240 added configuration file reader 00241 00242 Revision 1.1.1.1 2000/11/05 10:05:50 darkeye 00243 initial version 00244 00245 00246 ------------------------------------------------------------------------------*/ 00247