00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef BESKeys_h_
00034 #define BESKeys_h_ 1
00035
00036 #include <fstream>
00037 #include <map>
00038 #include <string>
00039
00040 using std::string ;
00041 using std::map ;
00042 using std::ifstream ;
00043
00044 #include "BESObj.h"
00045
00082 class BESKeys : public BESObj
00083 {
00084 private:
00085 ifstream * _keys_file ;
00086 string _keys_file_name ;
00087 map<string,string> *_the_keys ;
00088
00089 void clean() ;
00090 void load_keys() ;
00091 bool break_pair( const char* b,
00092 string& key,
00093 string &value ) ;
00094 bool only_blanks( const char *line ) ;
00095 BESKeys() {}
00096 protected:
00097 BESKeys( const string &keys_file_name ) ;
00098 public:
00099 ~BESKeys() ;
00100
00101 string keys_file_name() { return _keys_file_name ; }
00102
00103 string set_key( const string &key, const string &val ) ;
00104 string set_key( const string &pair ) ;
00105 string get_key( const string& s, bool &found ) ;
00106 void show_keys();
00107
00108 typedef map< string, string >::const_iterator Keys_citer ;
00109 Keys_citer keys_begin() { return _the_keys->begin() ; }
00110 Keys_citer keys_end() { return _the_keys->end() ; }
00111
00112 virtual void dump( ostream &strm ) const ;
00113 };
00114
00115 #endif // BESKeys_h_
00116