|
a/HelperStructs/Helper.cpp |
|
b/HelperStructs/Helper.cpp |
|
... |
|
... |
273 |
#else
|
273 |
#else
|
274 |
return Qt::escape(in);
|
274 |
return Qt::escape(in);
|
275 |
#endif
|
275 |
#endif
|
276 |
}
|
276 |
}
|
277 |
|
277 |
|
278 |
template <class T> void stringsToString(const T &tokens, string &s)
|
|
|
279 |
{
|
|
|
280 |
for (typename T::const_iterator it = tokens.begin();
|
|
|
281 |
it != tokens.end(); it++) {
|
|
|
282 |
bool hasblanks = false;
|
|
|
283 |
if (it->find_first_of(" \t\n") != string::npos)
|
|
|
284 |
hasblanks = true;
|
|
|
285 |
if (it != tokens.begin())
|
|
|
286 |
s.append(1, ' ');
|
|
|
287 |
if (hasblanks)
|
|
|
288 |
s.append(1, '"');
|
|
|
289 |
for (unsigned int i = 0; i < it->length(); i++) {
|
|
|
290 |
char car = it->at(i);
|
|
|
291 |
if (car == '"') {
|
|
|
292 |
s.append(1, '\\');
|
|
|
293 |
s.append(1, car);
|
|
|
294 |
} else {
|
|
|
295 |
s.append(1, car);
|
|
|
296 |
}
|
|
|
297 |
}
|
|
|
298 |
if (hasblanks)
|
|
|
299 |
s.append(1, '"');
|
|
|
300 |
}
|
|
|
301 |
}
|
|
|
302 |
template void stringsToString<list<string> >(const list<string> &, string &);
|
|
|
303 |
template void stringsToString<vector<string> >(const vector<string> &,string &);
|
|
|
304 |
template void stringsToString<set<string> >(const set<string> &, string &);
|
|
|
305 |
template <class T> string stringsToString(const T &tokens)
|
|
|
306 |
{
|
|
|
307 |
string out;
|
|
|
308 |
stringsToString<T>(tokens, out);
|
|
|
309 |
return out;
|
|
|
310 |
}
|
|
|
311 |
template string stringsToString<list<string> >(const list<string> &);
|
|
|
312 |
template string stringsToString<vector<string> >(const vector<string> &);
|
|
|
313 |
template string stringsToString<set<string> >(const set<string> &);
|
|
|
314 |
|
|
|
315 |
string ivtos(const vector<int>& nids)
|
278 |
string ivtos(const vector<int>& nids)
|
316 |
{
|
279 |
{
|
317 |
string sids;
|
280 |
string sids;
|
318 |
for (unsigned int i = 0; i < nids.size(); i++) {
|
281 |
for (unsigned int i = 0; i < nids.size(); i++) {
|
319 |
char cbuf[30];
|
282 |
char cbuf[30];
|