Definition at line 151 of file Message.cpp. 00152 { 00153 string temp = myString; 00154 vector<string> temp_tokens; 00155 string::size_type last_pos = 0; 00156 string::size_type pos = 0; 00157 do { 00158 if ( pos != 0 ) { 00159 last_pos = pos + DELIMETER.length(); 00160 } 00161 pos = temp.find(DELIMETER, last_pos); 00162 if (pos != string::npos) { 00163 temp_tokens.push_back(temp.substr(last_pos, pos - last_pos)); 00164 } 00165 else { 00166 temp_tokens.push_back(temp.substr(last_pos, temp.length() - last_pos)); 00167 } 00168 } while (pos != string::npos); 00169 string temp2 = ""; 00170 for ( int i = 0; i < (int)temp_tokens.size(); i++ ) { 00171 // append the current token to the rest of last round 00172 temp2 += temp_tokens.at(i); 00173 int length = temp2.length()-ESCAPE.length(); 00174 // if the temp2 doesn't end with ESCAPE 00175 if (length < 0 || temp2.substr(length).compare(ESCAPE)!=0 ) { 00176 // write temp2 back as a real token 00177 unescapeString(temp2); 00178 tokens.push_back(temp2); 00179 // delete temp2 again 00180 temp2 = ""; 00181 } 00182 else { 00183 // the last token can be writen bac keven with a delimeter at the end 00184 if (i == (int)temp_tokens.size()) { 00185 // write temp2 back as a real token 00186 unescapeString(temp2); 00187 tokens.push_back(temp2); 00188 // delete temp2 again 00189 temp2 = ""; 00190 } 00191 // add a delimeter at temp2's end and save it for next round 00192 else { 00193 temp2 += DELIMETER; 00194 } 00195 } 00196 } 00197 }
|
1.5.1