mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Remove c++17 dependency
This commit is contained in:
parent
2d3888b4b4
commit
4990093e3d
@ -67,10 +67,6 @@ macx {
|
|||||||
QT += macextras gui-private
|
QT += macextras gui-private
|
||||||
}
|
}
|
||||||
|
|
||||||
unix {
|
|
||||||
CONFIG += c++1z
|
|
||||||
}
|
|
||||||
|
|
||||||
#CONFIG += release
|
#CONFIG += release
|
||||||
CONFIG -= flat
|
CONFIG -= flat
|
||||||
QT += sql network widgets script
|
QT += sql network widgets script
|
||||||
|
@ -26,7 +26,7 @@ int QueryParser::TreeNode::buildSqlString(std::string &sqlString, int bindPositi
|
|||||||
}
|
}
|
||||||
oss << "UPPER(c.filename) LIKE UPPER(:bindPosition" << bindPosition << ") OR ";
|
oss << "UPPER(c.filename) LIKE UPPER(:bindPosition" << bindPosition << ") OR ";
|
||||||
oss << "UPPER(f.name) LIKE UPPER(:bindPosition" << bindPosition << ")) ";
|
oss << "UPPER(f.name) LIKE UPPER(:bindPosition" << bindPosition << ")) ";
|
||||||
} else if (isIn(fieldType(children[0].t), FieldType::numeric, FieldType::boolean)) {
|
} else if (isIn(fieldType(children[0].t), { FieldType::numeric, FieldType::boolean })) {
|
||||||
oss << "ci." << children[0].t << " = :bindPosition" << bindPosition << " ";
|
oss << "ci." << children[0].t << " = :bindPosition" << bindPosition << " ";
|
||||||
} else if (fieldType(children[0].t) == FieldType::filename) {
|
} else if (fieldType(children[0].t) == FieldType::filename) {
|
||||||
oss << "(UPPER(c." << children[0].t << ") LIKE UPPER(:bindPosition" << bindPosition << ")) ";
|
oss << "(UPPER(c." << children[0].t << ") LIKE UPPER(:bindPosition" << bindPosition << ")) ";
|
||||||
@ -56,7 +56,7 @@ int QueryParser::TreeNode::bindValues(QSqlQuery &selectQuery, int bindPosition)
|
|||||||
if (t == "token") {
|
if (t == "token") {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << ":bindPosition" << ++bindPosition;
|
oss << ":bindPosition" << ++bindPosition;
|
||||||
if (isIn(fieldType(children[0].t), FieldType::numeric, FieldType::boolean)) {
|
if (isIn(fieldType(children[0].t), { FieldType::numeric, FieldType::boolean })) {
|
||||||
selectQuery.bindValue(oss.str().c_str(), std::stoi(children[1].t));
|
selectQuery.bindValue(oss.str().c_str(), std::stoi(children[1].t));
|
||||||
} else {
|
} else {
|
||||||
selectQuery.bindValue(oss.str().c_str(), ("%%" + children[1].t + "%%").c_str());
|
selectQuery.bindValue(oss.str().c_str(), ("%%" + children[1].t + "%%").c_str());
|
||||||
@ -201,7 +201,7 @@ QueryParser::TreeNode QueryParser::andExpression()
|
|||||||
return { "and", { lhs, andExpression() } };
|
return { "and", { lhs, andExpression() } };
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((isIn(tokenType(), TokenType::atWord, TokenType::word, TokenType::quotedWord) || token() == "(") && lcaseToken() != "or") {
|
if ((isIn(tokenType(), { TokenType::atWord, TokenType::word, TokenType::quotedWord }) || token() == "(") && lcaseToken() != "or") {
|
||||||
return { "and", { lhs, andExpression() } };
|
return { "and", { lhs, andExpression() } };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ QueryParser::TreeNode QueryParser::locationExpression()
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if (!isIn(tokenType(), TokenType::atWord, TokenType::word, TokenType::quotedWord)) {
|
if (!isIn(tokenType(), { TokenType::atWord, TokenType::word, TokenType::quotedWord })) {
|
||||||
throw std::invalid_argument("Invalid syntax. Expected a lookup name or a word");
|
throw std::invalid_argument("Invalid syntax. Expected a lookup name or a word");
|
||||||
}
|
}
|
||||||
return baseToken();
|
return baseToken();
|
||||||
|
@ -68,10 +68,10 @@ private:
|
|||||||
bool isEof() const;
|
bool isEof() const;
|
||||||
void advance();
|
void advance();
|
||||||
|
|
||||||
template<typename First, typename... T>
|
template<typename T>
|
||||||
static bool isIn(First &&first, T &&... t)
|
static bool isIn(const T &e, const std::list<T> &v)
|
||||||
{
|
{
|
||||||
return ((first == t) || ...);
|
return std::find(v.begin(), v.end(), e) != v.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class FieldType { unknown,
|
enum class FieldType { unknown,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user