// Copyright (C) 2023 The Qt Company Ltd. // Copyright (C) 2018 Pelagicore AG // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QTIFQUERYPARSER_P_H #define QTIFQUERYPARSER_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include #include #include #include "qifqueryparsertable_p.h" QT_BEGIN_NAMESPACE class Q_QTINTERFACEFRAMEWORK_EXPORT QIfQueryParser: protected QIfQueryParserTable { public: union Value { int i; float f; const QString *s; }; public: QIfQueryParser(); virtual ~QIfQueryParser(); QIfAbstractQueryTerm *parse(); void setQuery(const QString& query) { m_query = query; } QString lastError() { return m_error; } void setAllowedIdentifiers(const QSet &list) { m_identifierList = list; } QList orderTerms() const { return m_orderList; } protected: inline void reallocateStack(); inline QVariant &sym(int index) { return sym_stack [tos + index - 1]; } void initBuffer(); void setErrorString(const QString &error); void calcCurrentColumn(); int nextToken(); void handleConjunction(bool bangOperator); void handleScope(bool bang); void negateLeftMostTerm(QIfAbstractQueryTerm *term); bool checkIdentifier(const QString &identifer); protected: QString m_query; unsigned int m_offset; QString m_error; QSet m_identifierList; int column; int tos; QVector sym_stack; QVector state_stack; QVariant yylval; QStack m_termStack; QStack m_operatorStack; QStack m_conjunctionStack; QList m_orderList; }; #endif // QTIFQUERYPARSER_P_H QT_END_NAMESPACE