00001
00002
00008 #ifndef TRANSLATORS_UTILS_H
00009 #define TRANSLATORS_UTILS_H
00010
00011 #include <string>
00012 #include <vector>
00013 #include <iostream>
00014 #include <sstream>
00015 #include <QueryTranslationException.h>
00016
00017
00018 namespace LcgInfo{
00019
00020
00029 void tokenizeStr(std::string const & pStr, std::vector<std::string>& pTokens,
00030 std::string const& pDelimiters = " \t");
00031
00043 void tokenizeStrWithIndices(std::string const & pStr, std::vector<std::string>& pTokens,
00044 std::vector<short int>& pIndices, std::string const& pDelimiters = " \t");
00045
00055 void delLeadingChars(std::string& pStr, std::string const& pChars = " \t");
00056
00066 void delEndingChars(std::string& pStr, std::string const& pChars = " \t");
00067
00077 void delSurroundingChars(std::string& pStr, std::string const& pChars = " \t");
00078
00086 bool nocaseCompare(std::string const & pStr1, std::string const& pStr2);
00087
00094 bool isNumber(std::string const & pStr);
00095
00103 bool isLiteral(std::string const & pStr);
00104
00111 std::string int2str(int const & pVal);
00112
00119 int str2int(std::string const & pStr);
00120
00125 void escapeLiterals(std::string & pStr, std::string const & pChars=" \t",
00126 char const & pEscape='\\', char const & pDelimiter='\'');
00127
00133 void unescapeLiterals(std::string & pStr, std::string const & pChars=" \t",
00134 char const & pEscape='\\', char const & pDelimiter='\'');
00135
00140 std::string extractTable(std::string const & pStr);
00141
00146 std::string extractRow(std::string const & pStr);
00147
00148 }
00149 #endif