38 std::string str_value;
40 str_value =
escape(ss.str());
50 size_t c_pos =
str.find(
SEP, pos);
51 size_t e_pos =
str.find(
ESC, pos);
52 if (c_pos == std::string::npos) {
55 if (e_pos == std::string::npos) {
58 return std::min(c_pos, e_pos);
62 size_t pos, last_pos = 0;
63 std::stringstream escaping;
66 escaping <<
str.substr(last_pos, pos - last_pos);
67 escaping <<
ESC <<
str.substr(pos, 1);
70 if (last_pos !=
str.size()) {
71 escaping <<
str.substr(last_pos);
73 escaped = escaping.str();
74 if (escaped.empty() || (escaped.c_str()[0] ==
QUO && escaped.c_str()[escaped.length() - 1] ==
QUO)) {
77 escaping <<
QUO << escaped <<
QUO;
78 escaped = escaping.str();
84 size_t pos, last_pos = 0;
85 std::stringstream unescaped;
90 while ((pos =
str.find(
ESC, last_pos)) != std::string::npos) {
91 unescaped <<
str.substr(last_pos, pos - last_pos);
92 unescaped <<
str.substr(pos + 1, 1);
95 if (last_pos !=
str.size()) {
96 unescaped <<
str.substr(last_pos);
98 return unescaped.str();
106 size_t sep = std::string::npos;
109 }
while (!(sep == std::string::npos || sep == 0 ||
inBuffer.c_str()[sep - 1] !=
ESC));
112 if (sep == std::string::npos) {
123 std::string value =
next();
124 std::stringstream ss(value);
141 void set(std::string buf) {
size_t next_escape(std::string str, size_t pos)
ParBuffer & operator<<(const T &v)
std::stringstream outBuffer
std::string unescape(std::string str)
ParBuffer & operator>>(T &v)
std::string escape(std::string str)
void set(std::string buf)