36 std::string str_value;
38 str_value =
escape(ss.str());
48 size_t c_pos = str.find(
SEP, pos);
49 size_t e_pos = str.find(
ESC, pos);
50 if (c_pos == std::string::npos) {
53 if (e_pos == std::string::npos) {
56 return std::min(c_pos, e_pos);
60 size_t pos, last_pos = 0;
61 std::stringstream escaping;
63 while ((pos =
next_escape(str, last_pos)) != std::string::npos) {
64 escaping << str.substr(last_pos, pos - last_pos);
65 escaping <<
ESC << str.substr(pos, 1);
68 if (last_pos != str.size()) {
69 escaping << str.substr(last_pos);
71 escaped = escaping.str();
72 if (escaped.empty() || (escaped.c_str()[0] ==
QUO && escaped.c_str()[escaped.length() - 1] ==
QUO)) {
75 escaping <<
QUO << escaped <<
QUO;
76 escaped = escaping.str();
82 size_t pos, last_pos = 0;
83 std::stringstream unescaped;
85 if (str.c_str()[0] ==
QUO && str.c_str()[str.length() - 1] ==
QUO) {
86 str = str.substr(1, str.length() - 2);
88 while ((pos = str.find(
ESC, last_pos)) != std::string::npos) {
89 unescaped << str.substr(last_pos, pos - last_pos);
90 unescaped << str.substr(pos + 1, 1);
93 if (last_pos != str.size()) {
94 unescaped << str.substr(last_pos);
96 return unescaped.str();
107 }
while (!(sep == (
int)std::string::npos || sep == 0 ||
inBuffer.c_str()[sep - 1] !=
ESC));
110 if (sep == (
int)std::string::npos) {
115 inBuffer = inBuffer.substr(sep + 1);
121 std::string value =
next();
122 std::stringstream ss(value);
139 void set(std::string buf) {
ParBuffer & operator>>(T &v)
std::string unescape(std::string str)
ParBuffer & operator<<(const T &v)
size_t next_escape(std::string str, size_t pos)
std::stringstream outBuffer
std::string escape(std::string str)