C++ Web Framework  3.0
cppwebapplication.h
1 /*
2  Copyright 2017 Herik Lima de Castro and Marcelo Medeiros Eler
3  Distributed under MIT license, or public domain if desired and
4  recognized in your jurisdiction.
5  See file LICENSE for detail.
6 */
7 
30 #ifndef CPPWEBAPPLICATION_H
31 #define CPPWEBAPPLICATION_H
32 
33 #include <QString>
34 #include <QCoreApplication>
35 #include <QMessageLogContext>
36 #include "cppwebserver.h"
37 #include "cppwebframework_global.h"
38 
39 CWF_BEGIN_NAMESPACE
44 class CPPWEBFRAMEWORKSHARED_EXPORT CppWebApplication
45 {
46  QCoreApplication application;
47  Configuration configuration;
48  CppWebServer *server;
49  bool valid = false;
50  CppWebApplication(const CppWebApplication &other) = delete;
51  CppWebApplication &operator=(const CppWebApplication &other) = delete;
52 public:
61  CppWebApplication(int argc, char *argv[], const QString &serverPath, Filter *filter = nullptr);
84  template<typename CONTROLLER>
85  void addController(const QString &url) noexcept
86  {
87  server->addController<CONTROLLER>(url);
88  }
93  int start();
94 };
95 
96 CWF_END_NAMESPACE
97 
98 #endif // CPPWEBAPPLICATION_H
This class is responsible for encapsulating the QCoreApplication, the CppWebServer and configure the ...
Definition: cppwebapplication.h:44
void addController(const QString &url) noexcept
Hitches a url to a Controller.
Definition: cppwebserver.h:62
The CppWebServer class is a HTTP server, responsable to receive and dispatch the requisitions.
Definition: cppwebserver.h:33
The Filter class works like a filter. You can use this class to validate sessions or measuring runtim...
Definition: filter.h:23
All classes of C++ Web Framework are contained within the namespace CWF.
Definition: configuration.h:24
void addController(const QString &url) noexcept
Hitches a url to a Controller.
Definition: cppwebapplication.h:85