Classes | |
class | functions::Exporter |
class | functions::Importer |
Write brief comment for Importer here. More... | |
class | BadConversion |
Write brief comment for BadConversion here. More... | |
class | log |
Write brief comment for log here. More... | |
Functions | |
std::string | stringify (const char *c) |
Write brief comment for stringify here. | |
template<typename T> | |
void | convert (const std::string &s, T &x, bool failIfLeftoverChars=true) |
Write brief comment for convert here. | |
template<typename T> | |
T | convertTo (const std::string &s, bool failIfLeftoverChars=true) |
Write brief comment for convertTo here. | |
void | Tokenize (const string &str, vector< string > &tokens, const string &delimiters=" ") |
Write brief comment for Tokenize here. |
|
Write brief comment for convert here.
Definition at line 91 of file func.h. Referenced by convertTo(). 00091 { 00092 std::istringstream i(s); 00093 char c; 00094 if (!(i >> x) || (failIfLeftoverChars && i.get(c))) { 00095 throw BadConversion(s); 00096 } 00097 }
|
|
Write brief comment for convertTo here.
Definition at line 124 of file func.h. References convert(). 00124 { 00125 T x; 00126 convert(s, x, failIfLeftoverChars); 00127 return x; 00128 }
|
Here is the call graph for this function:
|
Write brief comment for stringify here.
Definition at line 58 of file func.h. 00059 { 00060 std::ostringstream o; 00061 if (!(o << c)) 00062 throw BadConversion("stringify(const char*)"); 00063 return o.str(); 00064 }
|
|
Write brief comment for Tokenize here.
Definition at line 154 of file func.h. Referenced by model::Model::load(), model::Analyzer::load(), and functions::Importer::readAttributes(). 00154 { 00155 // Skip delimiters at beginning. 00156 string::size_type lastPos = str.find_first_not_of(delimiters, 0); 00157 // Find first "non-delimiter". 00158 string::size_type pos = str.find_first_of(delimiters, lastPos); 00159 00160 while (string::npos != pos || string::npos != lastPos) 00161 { 00162 // Found a token, add it to the vector. 00163 string tmp = str.substr(lastPos, pos - lastPos); 00164 string::size_type loc = tmp.find( "\n", 0 ); 00165 if(loc != string::npos) { 00166 tmp.erase(loc,1); 00167 } 00168 tokens.push_back(tmp); 00169 //cout << "Token: " << tokens[tokens.size()-1] << "\n"; 00170 // Skip delimiters. Note the "not_of" 00171 lastPos = str.find_first_not_of(delimiters, pos); 00172 00173 // Find next "non-delimiter" 00174 pos = str.find_first_of(delimiters, lastPos); 00175 00176 } 00177 }
|