00001 #ifndef CXXTLS_RESOURCES 00002 #define CXXTLS_RESOURCES 00003 // 00004 // Copyright 2002, Lowell Boggs Jr. 00005 // 00006 // This file or directory, containing source code for a computer program, 00007 // is Copyrighted by Lowell Boggs, Jr. 987 Regency Drive, Lewisville 00008 // TX (USA), 75067. You may use, copy, modify, and distribute this 00009 // source file without charge or obligation so long as you agree to 00010 // the following: 00011 // 00012 // 1. You must indemnify Lowell Boggs against any and all financial 00013 // obligations caused by its use, misuse, function, or malfunction. 00014 // Further, you acknowledge that there is no warranty of any kind, 00015 // whatsoever. 00016 // 00017 // 2. You agree not to attempt to patent any portion of this original 00018 // work -- though you may attempt to patent your own extensions to 00019 // it if you so choose. 00020 // 00021 // 3. You keep this copyright notice with the file and all copies 00022 // of the file and do not change it anyway except language translation. 00023 // 00024 // You are responsible for enforcing your own compliance with these 00025 // conditions and may not use this source file if you cannot agree to the 00026 // above terms and conditions. 00027 // 00028 // Warning: not all files in this directory structure are covered by the 00029 // same copyright. Some of them are part of the GNU source distribution 00030 // and you must obey the GPL copyright for those files. 00031 00035 00036 #include <string> 00037 #include <list> 00038 #include <map> 00039 #include <iosfwd> 00040 00041 namespace cxxtls 00042 { 00043 00044 class Resources 00083 { 00084 public: 00085 00086 typedef std::string string; 00088 00089 typedef std::list<string> StringList; 00091 00092 typedef std::pair<string, bool> ReturnString; 00098 00099 typedef std::map<string,string> Settings; 00101 00102 Resources(StringList const &files); 00106 00107 Resources(); 00110 00111 void read(StringList const &files); 00114 00115 ~Resources(); 00117 00118 ReturnString find(string const &name) const; 00121 00122 void set(string const &name, string const &value); 00124 00125 friend std::ostream &operator<< (std::ostream &s, Resources const &); 00128 00129 00130 void print() const; 00132 00133 private: 00134 00135 Settings map_; 00137 }; 00138 00139 } // namespace cxxtls 00140 00141 #endif