Changeset 9929
- Timestamp:
- 2005-05-23T16:18:43+12:00 (19 years ago)
- Location:
- trunk/gsdl/src/colservr
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/colservr/collectserver.cpp
r9904 r9929 29 29 #include "OIDtools.h" 30 30 #include <assert.h> 31 #include "display.h" 31 32 32 33 … … 86 87 else if (key == "numbytes") collectinfo.numBytes = value.getint(); 87 88 else if (key == "collectionmeta") { 88 if (cfgline.size() == 2) 89 collectinfo.collectionmeta[cfgline[0]] = cfgline[1]; 90 else if (cfgline.size() == 3 && 91 collectinfo.collectionmeta[cfgline[0]].empty() ) 92 collectinfo.collectionmeta[cfgline[0]] = cfgline[2]; 93 } else if (key == "collectionmacro") { 89 text_t params; 90 if (cfgline.size() == 3) { 91 // get the params for later 92 text_t::const_iterator first=cfgline[1].begin()+1; 93 text_t::const_iterator last=cfgline[1].end()-1; 94 params=substr(first, last); 95 } 96 97 text_t meta_name = cfgline[0]; 98 if (*(meta_name.begin())=='.') { 99 // a .xxx collectionmeta. strip off the . and 100 // look it up in the indexmap to get the actual value 101 102 text_t name = substr(cfgline[0].begin()+1,cfgline[0].end()); 103 text_t new_name; 104 if (indexmap.from2to(name, new_name)) { 105 meta_name = new_name; 106 } 107 } else { 108 // add them to collectionmeta 109 text_tmap lang_map = collectinfo.collectionmeta[cfgline[0]]; 110 if (cfgline.size() == 2) { 111 lang_map[g_EmptyText] = cfgline[1]; 112 } else if (cfgline.size() == 3 ) { 113 // get the lang out of params 114 paramhashtype params_hash; 115 splitparams(params, params_hash); 116 117 text_t lang = params_hash["l"]; 118 lang_map[lang] = cfgline[2]; 119 if (lang_map[g_EmptyText].empty()) { 120 // want the first one as the default if no default specified 121 lang_map[g_EmptyText] = cfgline[2]; 122 } 123 } 124 collectinfo.collectionmeta[cfgline[0]] = lang_map; 125 126 } 127 128 // add all collectionmeta to macro list 129 if (cfgline.size() == 2) // no params for this macro 130 collectinfo.collection_macros 131 .insert( make_pair(meta_name, make_pair(g_EmptyText,cfgline[1])) ); 132 else if (cfgline.size() == 3) {// has params 133 // can we somehow add this is with no params if there is not already 134 // a no params entry?? 135 collectinfo.collection_macros 136 .insert( make_pair(meta_name, make_pair(params,cfgline[2])) ); 137 } 138 } 139 else if (key == "collectionmacro") { 140 text_t nobrackets; 141 // add all to macro list 94 142 if (cfgline.size() == 2) // no params for this macro 95 143 collectinfo.collection_macros … … 99 147 text_t::const_iterator first=cfgline[1].begin()+1; 100 148 text_t::const_iterator last=cfgline[1].end()-1; 101 text_tnobrackets=substr(first, last);149 nobrackets=substr(first, last); 102 150 collectinfo.collection_macros 103 151 .insert( make_pair(cfgline[0], make_pair(nobrackets,cfgline[2])) ); … … 141 189 } 142 190 191 // store all the mappings for use when collection meta is read later 192 // (build.cfg read before collect.cfg) 193 else if (key == "indexmap" || key == "indexfieldmap" || key == "subcollectionmap" || key == "languagemap") { 194 indexmap.importmap (cfgline, true); 195 196 } 143 197 // In the map the key-value pair contain the same 144 198 // data i.e key == data, if key is 2 then data is 2 … … 176 230 } 177 231 } 178 232 179 233 // configure the filters 180 234 filtermapclass::iterator filter_here = filters.begin(); … … 200 254 } 201 255 256 202 257 void collectserver::configure (const text_t &key, const text_t &value) { 203 258 text_tarray cfgline; … … 228 283 229 284 bool collectserver::init (ostream &logout) { 285 // delete the indexmap 286 indexmap.clear(); 287 230 288 // init the filters 231 289 filtermapclass::iterator filter_here = filters.begin(); -
trunk/gsdl/src/colservr/collectserver.h
r4774 r9929 38 38 #include "cfgread.h" 39 39 #include "cnfgable.h" 40 #include "maptools.h" 40 41 41 42 #if defined(GSDL_USE_OBJECTSPACE) … … 71 72 filtermapclass filters; 72 73 sourcelistclass sources; 74 75 // some stuff to remember while we are configuring 76 stringmap indexmap; 73 77 74 78 public: -
trunk/gsdl/src/colservr/maptools.cpp
r9620 r9929 34 34 35 35 void stringmap::importmap (const text_tarray &maparray) { 36 clear (); 36 importmap(maparray, false); 37 } 38 39 void stringmap::importmap (const text_tarray &maparray, bool keepold) { 40 if (!keepold) { 41 clear (); 42 } 37 43 38 44 text_tarray::const_iterator here = maparray.begin(); -
trunk/gsdl/src/colservr/maptools.h
r1285 r9929 43 43 44 44 void importmap (const text_tarray &maparray); 45 void importmap (const text_tarray &maparray, bool keepold); 45 46 void exportmap (text_tarray &maparray) const; 46 47
Note:
See TracChangeset
for help on using the changeset viewer.