/* * File: QCefQuery.h * Project: QCefView * Created: 29th March 2016 * Author: Sheen * Source: https://github.com/cefview/qcefview * Docs: https://cefview.github.io/QCefView/ */ #ifndef QCEFQUERY_H #define QCEFQUERY_H #pragma once #include #pragma region stl_headers #include #pragma endregion #pragma region qt_headers #include #include #pragma endregion class QCefQueryPrivate; class QCefViewPrivate; /// /// Represents the query request sent from the web content(Javascript) /// class QCEFVIEW_EXPORT QCefQuery { Q_DECLARE_PRIVATE(QCefQuery) QSharedPointer d_ptr; friend class QCefViewPrivate; protected: /// /// Constructs a query instance with request context and query id /// /// The source CefView /// The request context /// The query id QCefQuery(QCefViewPrivate* source, const QString& req, const int64_t query); /// /// Marks the query as replied (for internal use only) /// void markAsReplied() const; public: /// /// Constructs a query instance /// QCefQuery(); /// /// Destructs a query instance /// ~QCefQuery(); /// /// Gets the query content /// /// The content string const QString request() const; /// /// Gets the query id /// /// The query id const qint64 id() const; /// /// Gets the response content string /// /// The response content string const QString response() const; /// /// Gets the response result /// /// The respone result const bool result() const; /// /// Gets the response error /// /// The response error const int error() const; /// /// Sets the response /// /// True if the query is successful; otherwise false /// The response content string /// The response error void setResponseResult(bool success, const QString& response, int error = 0) const; /// /// Replies the query /// /// The result /// The response data /// The error code void reply(bool success, const QString& response, int error = 0) const; }; Q_DECLARE_METATYPE(QCefQuery); #endif // QCEFQUERY_H