From 0d43ee7076e26ab51338608e6c2abb7bf84a2e28 Mon Sep 17 00:00:00 2001 From: buinsky Date: Tue, 6 Jan 2015 22:42:44 +0300 Subject: [PATCH] Follow project coding style. Issue #2192. --- src/webui/abstractrequesthandler.h | 66 +++++++++++++++--------------- src/webui/webapplication.h | 46 ++++++++++----------- 2 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/webui/abstractrequesthandler.h b/src/webui/abstractrequesthandler.h index 9f2c3b605..b279d1272 100644 --- a/src/webui/abstractrequesthandler.h +++ b/src/webui/abstractrequesthandler.h @@ -37,53 +37,53 @@ struct WebSession; class AbstractRequestHandler { - friend class WebApplication; + friend class WebApplication; public: - AbstractRequestHandler( - const HttpRequest& request, const HttpEnvironment& env, - WebApplication* app); + AbstractRequestHandler( + const HttpRequest& request, const HttpEnvironment& env, + WebApplication* app); - HttpResponse run(); + HttpResponse run(); protected: - virtual void processRequest() = 0; + virtual void processRequest() = 0; - void status(uint code, const QString& text); - void header(const QString& name, const QString& value); - void print(const QString& text, const QString& type = CONTENT_TYPE_HTML); - void print(const QByteArray& data, const QString& type = CONTENT_TYPE_HTML); - void printFile(const QString& path); + void status(uint code, const QString& text); + void header(const QString& name, const QString& value); + void print(const QString& text, const QString& type = CONTENT_TYPE_HTML); + void print(const QByteArray& data, const QString& type = CONTENT_TYPE_HTML); + void printFile(const QString& path); - // Session management - bool sessionActive() const { return session_ != 0; } - void sessionInitialize(); - void sessionStart(); - void sessionEnd(); + // Session management + bool sessionActive() const { return session_ != 0; } + void sessionInitialize(); + void sessionStart(); + void sessionEnd(); - // Ban management - bool isBanned() const; - int failedAttempts() const; - void resetFailedAttempts(); - void increaseFailedAttempts(); + // Ban management + bool isBanned() const; + int failedAttempts() const; + void resetFailedAttempts(); + void increaseFailedAttempts(); - bool isAuthNeeded(); + bool isAuthNeeded(); - // save data to temporary file on disk and return its name (or empty string if fails) - static QString saveTmpFile(const QByteArray& data); + // save data to temporary file on disk and return its name (or empty string if fails) + static QString saveTmpFile(const QByteArray& data); - inline WebSession* session() { return session_; } - inline HttpRequest request() const { return request_; } - inline HttpEnvironment env() const { return env_; } + inline WebSession* session() { return session_; } + inline HttpRequest request() const { return request_; } + inline HttpEnvironment env() const { return env_; } private: - WebApplication* app_; - WebSession* session_; - const HttpRequest request_; - const HttpEnvironment env_; - HttpResponse response_; + WebApplication* app_; + WebSession* session_; + const HttpRequest request_; + const HttpEnvironment env_; + HttpResponse response_; - void print_impl(const QByteArray& data, const QString& type); + void print_impl(const QByteArray& data, const QString& type); }; #endif // ABSTRACTREQUESTHANDLER_H diff --git a/src/webui/webapplication.h b/src/webui/webapplication.h index 0e005f0b3..be03f6b17 100644 --- a/src/webui/webapplication.h +++ b/src/webui/webapplication.h @@ -36,9 +36,9 @@ struct WebSession { - const QString id; + const QString id; - WebSession(const QString& id): id(id) {} + WebSession(const QString& id): id(id) {} }; const QString C_SID = "SID"; // name of session id cookie @@ -49,39 +49,39 @@ class AbstractRequestHandler; class WebApplication: public QObject { - Q_OBJECT - Q_DISABLE_COPY(WebApplication) + Q_OBJECT + Q_DISABLE_COPY(WebApplication) public: - WebApplication(QObject* parent = 0); - virtual ~WebApplication(); + WebApplication(QObject* parent = 0); + virtual ~WebApplication(); - static WebApplication* instance(); + static WebApplication* instance(); - bool isBanned(const AbstractRequestHandler* _this) const; - int failedAttempts(const AbstractRequestHandler *_this) const; - void resetFailedAttempts(AbstractRequestHandler* _this); - void increaseFailedAttempts(AbstractRequestHandler* _this); + bool isBanned(const AbstractRequestHandler* _this) const; + int failedAttempts(const AbstractRequestHandler *_this) const; + void resetFailedAttempts(AbstractRequestHandler* _this); + void increaseFailedAttempts(AbstractRequestHandler* _this); - bool sessionStart(AbstractRequestHandler* _this); - bool sessionEnd(AbstractRequestHandler* _this); - bool sessionInitialize(AbstractRequestHandler* _this); + bool sessionStart(AbstractRequestHandler* _this); + bool sessionEnd(AbstractRequestHandler* _this); + bool sessionInitialize(AbstractRequestHandler* _this); - bool readFile(const QString &path, QByteArray& data, QString& type); + bool readFile(const QString &path, QByteArray& data, QString& type); private slots: - void UnbanTimerEvent(); + void UnbanTimerEvent(); private: - QMap sessions_; - QHash clientFailedAttempts_; - QMap translatedFiles_; + QMap sessions_; + QHash clientFailedAttempts_; + QMap translatedFiles_; - QString generateSid(); - static void translateDocument(QString& data); + QString generateSid(); + static void translateDocument(QString& data); - static const QStringMap CONTENT_TYPE_BY_EXT; - static QStringMap initializeContentTypeByExtMap(); + static const QStringMap CONTENT_TYPE_BY_EXT; + static QStringMap initializeContentTypeByExtMap(); }; #endif // WEBAPPLICATION_H