39 std::string str_value;
41 str_value =
escape(ss.str());
51 size_t c_pos =
str.find(
SEP, pos);
52 size_t e_pos =
str.find(
ESC, pos);
53 if (c_pos == std::string::npos) {
56 if (e_pos == std::string::npos) {
59 return std::min(c_pos, e_pos);
63 size_t pos, last_pos = 0;
64 std::stringstream escaping;
67 escaping <<
str.substr(last_pos, pos - last_pos);
68 escaping <<
ESC <<
str.substr(pos, 1);
71 if (last_pos !=
str.size()) {
72 escaping <<
str.substr(last_pos);
74 escaped = escaping.str();
75 if (escaped.empty() || (escaped.c_str()[0] ==
QUO && escaped.c_str()[escaped.length() - 1] ==
QUO)) {
78 escaping <<
QUO << escaped <<
QUO;
79 escaped = escaping.str();
85 size_t pos, last_pos = 0;
86 std::stringstream unescaped;
91 while ((pos =
str.find(
ESC, last_pos)) != std::string::npos) {
92 unescaped <<
str.substr(last_pos, pos - last_pos);
93 unescaped <<
str.substr(pos + 1, 1);
96 if (last_pos !=
str.size()) {
97 unescaped <<
str.substr(last_pos);
99 return unescaped.str();
107 size_t sep = std::string::npos;
110 }
while (!(sep == std::string::npos || sep == 0 ||
inBuffer.c_str()[sep - 1] !=
ESC));
113 if (sep == std::string::npos) {
124 std::string value =
next();
125 std::stringstream ss(value);
142 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)