Files Classes Functions Hierarchy
#include <iostream>#include <sstream>#include <string>#include <fstream>#include <map>#include <commandline.h>
Go to the source code of this file.
Functions | |
| bool | splitstring (string &sleft, string &sright, stringc &s, char const delim) |
| void | readToMap (map< string, string > &m, int argc, char **argv) |
| void | writeMap (string &s, map< string, string > const &m) |
| void readToMap | ( | map< string, string > & | m, | |
| int | argc, | |||
| char ** | argv | |||
| ) |
Definition at line 220 of file commandline.cpp.
References splitstring().
00221 { 00222 for (uint i=1; i<(uint)argc; ++i) 00223 { 00224 string s1, s2; 00225 if (splitstring(s1,s2,string(argv[i]),'=')) 00226 m[s1] = s2; 00227 } 00228 }
Definition at line 236 of file commandline.cpp.
Referenced by commandline::commandline(), commandline::read(), and readToMap().
00242 { 00243 //cout << "s=*" << s << "*" << endl; 00244 00245 string::size_type k = s.find(delim); 00246 uint len = s.length(); 00247 if (k<1 || (k>=len-1) || len==0) 00248 return false; 00249 00250 sleft = s; 00251 sleft.erase(k); 00252 sright = s; 00253 sright.erase(0,k+1); 00254 00255 //cout << "sright=*" << sright << "*" << endl; 00256 00257 return true; 00258 }
| void writeMap | ( | string & | s, | |
| map< string, string > const & | m | |||
| ) |
Definition at line 261 of file commandline.cpp.
00262 { 00263 string s2; 00264 map<string,string>::const_iterator i=m.begin(); 00265 for(;i!=m.end();++i) 00266 s2 += (i->first + "=" + i->second + " "); 00267 00268 s = s2; 00269 }
1.5.8