[cgma-dev] r2774 - cgm/trunk/itaps
kraftche at cae.wisc.edu
kraftche at cae.wisc.edu
Sun Mar 29 11:09:55 CDT 2009
Author: kraftche
Date: 2009-03-29 11:09:55 -0500 (Sun, 29 Mar 2009)
New Revision: 2774
Modified:
cgm/trunk/itaps/iGeom_CGMA.cc
Log:
conform to ITAPS spec for string options: no pre-defined deliminator, string must begin with user-specified deliminator
Modified: cgm/trunk/itaps/iGeom_CGMA.cc
===================================================================
--- cgm/trunk/itaps/iGeom_CGMA.cc 2009-03-27 22:07:28 UTC (rev 2773)
+++ cgm/trunk/itaps/iGeom_CGMA.cc 2009-03-29 16:09:55 UTC (rev 2774)
@@ -137,8 +137,7 @@
int* err);
static void tokenize( const std::string& str,
- std::vector<std::string>& tokens,
- const char* delimiters = ":,\n\t" );
+ std::vector<std::string>& tokens );
// Expect option of the form "NAME=VALUE".
// If NAME portion matches, pass back VALUE and return true.
@@ -5823,15 +5822,15 @@
/********************* HELPER FUNCTION IMPLEMENTATIONS ***************************/
static void tokenize( const std::string& str,
- std::vector<std::string>& tokens,
- const char* delimiters )
+ std::vector<std::string>& tokens )
{
- std::string::size_type last = str.find_first_not_of( delimiters, 0 );
- std::string::size_type pos = str.find_first_of( delimiters, last );
+ char delim = str[0];
+ std::string::size_type last = str.find_first_not_of( delim, 1 );
+ std::string::size_type pos = str.find_first_of( delim, last );
while (std::string::npos != pos && std::string::npos != last) {
tokens.push_back( str.substr( last, pos - last ) );
- last = str.find_first_not_of( delimiters, pos );
- pos = str.find_first_of( delimiters, last );
+ last = str.find_first_not_of( delim, pos );
+ pos = str.find_first_of( delim, last );
}
}
More information about the cgma-dev
mailing list