diff options
Diffstat (limited to 'src/translators/pilotdb/strop.cpp')
-rw-r--r-- | src/translators/pilotdb/strop.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/translators/pilotdb/strop.cpp b/src/translators/pilotdb/strop.cpp index b8c7f55..3b0deeb 100644 --- a/src/translators/pilotdb/strop.cpp +++ b/src/translators/pilotdb/strop.cpp @@ -167,7 +167,7 @@ std::string StrOps::strip_front(const std::string& str,const std::string& what) StrOps::string_list_t StrOps::csv_to_array(const std::string& str, char delim, bool quoted_string) { - enum { STATE_NORMAL, STATE_QUOTES } state; + enum { STATE_NORMAL, STATE_TQUOTES } state; StrOps::string_list_t result; std::string elem; @@ -176,7 +176,7 @@ StrOps::string_list_t StrOps::csv_to_array(const std::string& str, char delim, b switch (state) { case STATE_NORMAL: if (quoted_string && *p == '"') { - state = STATE_QUOTES; + state = STATE_TQUOTES; } else if (*p == delim) { result.push_back(elem); elem = ""; @@ -185,7 +185,7 @@ StrOps::string_list_t StrOps::csv_to_array(const std::string& str, char delim, b } break; - case STATE_QUOTES: + case STATE_TQUOTES: if (quoted_string && *p == '"') { if ((p + 1) != str.end() && *(p+1) == '"') { ++p; @@ -204,7 +204,7 @@ StrOps::string_list_t StrOps::csv_to_array(const std::string& str, char delim, b case STATE_NORMAL: result.push_back(elem); break; - case STATE_QUOTES: + case STATE_TQUOTES: kdDebug() << "unterminated quotes" << endl; break; } @@ -216,8 +216,8 @@ StrOps::string_list_t StrOps::str_to_array(const std::string& str, const std::string& delim, bool multiple_delim, bool handle_comments) { - enum { STATE_NORMAL, STATE_COMMENT, STATE_QUOTE_DOUBLE, STATE_QUOTE_SINGLE, - STATE_BACKSLASH, STATE_BACKSLASH_DOUBLEQUOTE } state; + enum { STATE_NORMAL, STATE_COMMENT, STATE_TQUOTE_DOUBLE, STATE_TQUOTE_SINGLE, + STATE_BACKSLASH, STATE_BACKSLASH_DOUBLETQUOTE } state; StrOps::string_list_t result; std::string elem; @@ -226,9 +226,9 @@ StrOps::str_to_array(const std::string& str, const std::string& delim, switch (state) { case STATE_NORMAL: if (*p == '"') { - state = STATE_QUOTE_DOUBLE; + state = STATE_TQUOTE_DOUBLE; } else if (*p == '\'') { - state = STATE_QUOTE_SINGLE; + state = STATE_TQUOTE_SINGLE; } else if (std::find(delim.begin(), delim.end(), *p) != delim.end()) { if (multiple_delim) { ++p; @@ -252,16 +252,16 @@ StrOps::str_to_array(const std::string& str, const std::string& delim, case STATE_COMMENT: break; - case STATE_QUOTE_DOUBLE: + case STATE_TQUOTE_DOUBLE: if (*p == '"') state = STATE_NORMAL; else if (*p == '\\') - state = STATE_BACKSLASH_DOUBLEQUOTE; + state = STATE_BACKSLASH_DOUBLETQUOTE; else elem += *p; break; - case STATE_QUOTE_SINGLE: + case STATE_TQUOTE_SINGLE: if (*p == '\'') state = STATE_NORMAL; else @@ -273,7 +273,7 @@ StrOps::str_to_array(const std::string& str, const std::string& delim, state = STATE_NORMAL; break; - case STATE_BACKSLASH_DOUBLEQUOTE: + case STATE_BACKSLASH_DOUBLETQUOTE: switch (*p) { case '\\': elem += '\\'; @@ -329,7 +329,7 @@ StrOps::str_to_array(const std::string& str, const std::string& delim, } // Escape is done. Go back to the normal double quote state. - state = STATE_QUOTE_DOUBLE; + state = STATE_TQUOTE_DOUBLE; break; } } @@ -339,16 +339,16 @@ StrOps::str_to_array(const std::string& str, const std::string& delim, result.push_back(elem); break; - case STATE_QUOTE_DOUBLE: + case STATE_TQUOTE_DOUBLE: kdDebug() << "unterminated double quotes" << endl; break; - case STATE_QUOTE_SINGLE: + case STATE_TQUOTE_SINGLE: kdDebug() << "unterminated single quotes" << endl; break; case STATE_BACKSLASH: - case STATE_BACKSLASH_DOUBLEQUOTE: + case STATE_BACKSLASH_DOUBLETQUOTE: kdDebug() << "an escape character must follow a backslash" << endl; break; |