35 std::string str_value;
37 str_value =
escape(ss.str());
47 size_t c_pos =
str.find(
SEP, pos);
48 size_t e_pos =
str.find(
ESC, pos);
49 if (c_pos == std::string::npos) {
52 if (e_pos == std::string::npos) {
55 return std::min(c_pos, e_pos);
59 size_t pos, last_pos = 0;
60 std::stringstream escaping;
63 escaping <<
str.substr(last_pos, pos - last_pos);
64 escaping <<
ESC <<
str.substr(pos, 1);
67 if (last_pos !=
str.size()) {
68 escaping <<
str.substr(last_pos);
70 escaped = escaping.str();
71 if (escaped.empty() || (escaped.c_str()[0] ==
QUO && escaped.c_str()[escaped.length() - 1] ==
QUO)) {
74 escaping <<
QUO << escaped <<
QUO;
75 escaped = escaping.str();
81 size_t pos, last_pos = 0;
82 std::stringstream unescaped;
87 while ((pos =
str.find(
ESC, last_pos)) != std::string::npos) {
88 unescaped <<
str.substr(last_pos, pos - last_pos);
89 unescaped <<
str.substr(pos + 1, 1);
92 if (last_pos !=
str.size()) {
93 unescaped <<
str.substr(last_pos);
95 return unescaped.str();
106 }
while (!(sep == (
int)std::string::npos || sep == 0 ||
inBuffer.c_str()[sep - 1] !=
ESC));
109 if (sep == (
int)std::string::npos) {
120 std::string value =
next();
121 std::stringstream ss(value);
138 void set(std::string buf) {