Apply clang-format

This commit is contained in:
Luis Ángel San Martín
2019-09-23 18:02:23 +02:00
committed by Luis Ángel San Martín
parent 9a660350d2
commit 7ccb338455
2 changed files with 135 additions and 102 deletions

View File

@ -38,24 +38,29 @@
*
* selectQuery.exec();
*/
class QueryParser {
class QueryParser
{
public:
enum class TokenType {eof, opcode, atWord, word, quotedWord, space};
enum class TokenType { eof,
opcode,
atWord,
word,
quotedWord,
space };
struct TreeNode {
std::string t;
std::vector<TreeNode> children;
int buildSqlString(std::string& sqlString, int bindPosition = 0) const;
int bindValues(QSqlQuery& selectQuery, int bindPosition = 0) const;
int buildSqlString(std::string &sqlString, int bindPosition = 0) const;
int bindValues(QSqlQuery &selectQuery, int bindPosition = 0) const;
};
explicit QueryParser();
TreeNode parse(const std::string& expr);
TreeNode parse(const std::string &expr);
private:
static std::string toLower(const std::string& string);
static std::string toLower(const std::string &string);
std::string token(bool advance = false);
std::string lcaseToken(bool advance = false);
@ -63,15 +68,24 @@ private:
bool isEof() const;
void advance();
template<typename First, typename ... T>
static bool isIn(First &&first, T && ... t) {return ((first == t) || ...);}
template<typename First, typename... T>
static bool isIn(First &&first, T &&... t)
{
return ((first == t) || ...);
}
enum class FieldType {unknown, numeric, text, boolean, date, folder, filename};
static FieldType fieldType(const std::string& str);
enum class FieldType { unknown,
numeric,
text,
boolean,
date,
folder,
filename };
static FieldType fieldType(const std::string &str);
void tokenize (const std::string& expr);
static std::string join(const std::vector<std::string>& strings, const std::string& delim);
static std::vector<std::string> split(const std::string& string, char delim);
void tokenize(const std::string &expr);
static std::string join(const std::vector<std::string> &strings, const std::string &delim);
static std::vector<std::string> split(const std::string &string, char delim);
TreeNode orExpression();
TreeNode andExpression();