mirror of
https://github.com/YACReader/yacreader
synced 2025-06-03 09:08:20 -04:00
Remove c++17 dependency
This commit is contained in:
parent
2d3888b4b4
commit
4990093e3d
@ -67,10 +67,6 @@ macx {
|
||||
QT += macextras gui-private
|
||||
}
|
||||
|
||||
unix {
|
||||
CONFIG += c++1z
|
||||
}
|
||||
|
||||
#CONFIG += release
|
||||
CONFIG -= flat
|
||||
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(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 << " ";
|
||||
} else if (fieldType(children[0].t) == FieldType::filename) {
|
||||
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") {
|
||||
std::ostringstream oss;
|
||||
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));
|
||||
} else {
|
||||
selectQuery.bindValue(oss.str().c_str(), ("%%" + children[1].t + "%%").c_str());
|
||||
@ -201,7 +201,7 @@ QueryParser::TreeNode QueryParser::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() } };
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ QueryParser::TreeNode QueryParser::locationExpression()
|
||||
}
|
||||
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");
|
||||
}
|
||||
return baseToken();
|
||||
|
@ -68,10 +68,10 @@ private:
|
||||
bool isEof() const;
|
||||
void advance();
|
||||
|
||||
template<typename First, typename... T>
|
||||
static bool isIn(First &&first, T &&... t)
|
||||
template<typename 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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user