Split VWeb into smaller headers
We have no make install support... so we don't need to have everything as a single-header and lib file.
This commit is contained in:
parent
4367534a33
commit
5bb68a7d02
43 changed files with 902 additions and 685 deletions
15
Source/CMakeLists.txt
Normal file
15
Source/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
add_sources(
|
||||
EPollManager.cpp
|
||||
RequestHandler.cpp
|
||||
Server.cpp
|
||||
SocketManager.cpp
|
||||
ThreadPool.cpp
|
||||
Router.cpp
|
||||
MiddleWare.cpp
|
||||
Route.cpp
|
||||
StringUtils.cpp
|
||||
Cookie.cpp
|
||||
Session.cpp
|
||||
Response.cpp
|
||||
InbuildMiddleWare.cpp
|
||||
)
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
#include "Includes/VWeb.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
#include <VWeb.h>
|
||||
|
||||
namespace VWeb {
|
||||
void Cookies::Remove(const std::string &name) {
|
||||
if (Data.contains(name))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#include <VWeb.h>
|
||||
#include "Includes/VWeb.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
namespace VWeb {
|
||||
EPollManager::EPollManager() {
|
||||
m_EpollID = epoll_create1(0);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "Includes/PreMiddleWare.h"
|
||||
#include "StringUtils.h"
|
||||
#include "VWeb.h"
|
||||
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include <VWeb.h>
|
||||
#include "Includes/VWeb.h"
|
||||
|
||||
namespace VWeb {
|
||||
std::optional<Ref<Response>>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#include "Includes/VWeb.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
#include <VWeb.h>
|
||||
|
||||
namespace VWeb {
|
||||
|
||||
HttpMethod StringToHTTPMethod(std::string &method) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include <VWeb.h>
|
||||
#include "Includes/VWeb.h"
|
||||
|
||||
namespace VWeb {
|
||||
// clang-format off
|
||||
|
|
@ -87,7 +87,7 @@ void Response::SetHeader(const std::string &key, ParameterValue &value) {
|
|||
m_Headers[key] = value;
|
||||
}
|
||||
void Response::AddHeaders(const std::string &key,
|
||||
const Vector<std::string> &values) {
|
||||
const std::vector<std::string> &values) {
|
||||
auto &element = m_Headers[key];
|
||||
for (const auto &value : values)
|
||||
element.Add(value);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include <VWeb.h>
|
||||
#include <algorithm>
|
||||
#include "Includes/VWeb.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace VWeb {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "Includes/VWeb.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
#include <VWeb.h>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ Ref<Route> Router::FindRoute(Ref<Request> &request) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void Router::AddToArgs(Ref<Request> &request, Vector<std::string> &items) {
|
||||
void Router::AddToArgs(Ref<Request> &request, std::vector<std::string> &items) {
|
||||
request->URLParameters.push_back(items[items.size() - 1]);
|
||||
items.pop_back();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#include <VWeb.h>
|
||||
#include "Includes/PreMiddleWare.h"
|
||||
#include "Includes/VWeb.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace VWeb {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include <VWeb.h>
|
||||
#include "Includes/VWeb.h"
|
||||
|
||||
namespace VWeb {
|
||||
bool Session::IsValid() {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#include <VWeb.h>
|
||||
#include "Includes/VWeb.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
namespace VWeb {
|
||||
#pragma region VWebSocketUtils
|
||||
|
|
@ -89,7 +91,8 @@ void SocketManager::Init() {
|
|||
if (listen(m_SocketID, SOMAXCONN) < 0)
|
||||
return Errored("Socket Failed to Listen");
|
||||
|
||||
if (!m_ServerConfig->EPoll->Dispatch(m_SocketID,EPOLLIN | EPOLLET | EPOLLOUT))
|
||||
if (!m_ServerConfig->EPoll->Dispatch(m_SocketID,
|
||||
EPOLLIN | EPOLLET | EPOLLOUT))
|
||||
return Errored("Cannot Add Event");
|
||||
}
|
||||
void SocketManager::Errored(const std::string &data) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include <VWeb.h>
|
||||
#include "Includes/VWeb.h"
|
||||
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue