blob: 3388c3e74b7b03170aed51f03c4e664f78bf9ec0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
/* Benjamin DELPY `gentilkiwi`
http://blog.gentilkiwi.com
benjamin@gentilkiwi.com
Licence : http://creativecommons.org/licenses/by/3.0/fr/
*/
#include "mod_parseur.h"
vector<wstring> mod_parseur::parse(const wstring & line)
{
vector<wstring> result;
wstring item;
wstringstream ss(line);
while(ss >> item)
{
if (item[0] == L'"')
{
if (item[item.length() - 1] == L'"')
{
result.push_back(item.substr(1, item.length() -2));
}
else
{
wstring restOfItem;
getline(ss, restOfItem, L'"');
result.push_back(item.substr(1) + restOfItem);
}
}
else
{
result.push_back(item);
}
}
return result;
}
|