clang-format

This commit is contained in:
whaffman 2025-09-24 12:04:43 +02:00
parent 901f766599
commit ba831957d4
20 changed files with 116 additions and 92 deletions

View File

@ -1,14 +1,16 @@
#include <webserv/client/Client.hpp> #include <webserv/client/Client.hpp>
#include <webserv/log/Log.hpp> // for Log
#include <stdint.h> // for uint8_t
#include <sys/types.h> // for ssize_t
#include <webserv/http/HttpHeaders.hpp> // for HttpHeaders #include <webserv/http/HttpHeaders.hpp> // for HttpHeaders
#include <webserv/log/Log.hpp> // for Log
#include <webserv/server/Server.hpp> // for Server #include <webserv/server/Server.hpp> // for Server
#include <webserv/socket/Socket.hpp> // for Socket #include <webserv/socket/Socket.hpp> // for Socket
#include <functional> // for reference_wrapper, cref, ref #include <functional> // for reference_wrapper, cref, ref
#include <map> // for map #include <map> // for map
#include <utility> // for pair, move #include <utility> // for pair, move
#include <stdint.h> // for uint8_t
#include <sys/types.h> // for ssize_t
Client::Client(std::unique_ptr<Socket> socket, Server &server, const ServerConfig &server_config) Client::Client(std::unique_ptr<Socket> socket, Server &server, const ServerConfig &server_config)
: client_socket_(std::move(socket)), server_(std::ref(server)), server_config_(std::cref(server_config)), : client_socket_(std::move(socket)), server_(std::ref(server)), server_config_(std::cref(server_config)),
httpRequest_(std::make_unique<HttpRequest>(&server_config, this)) httpRequest_(std::make_unique<HttpRequest>(&server_config, this))

View File

@ -2,11 +2,13 @@
#include <webserv/config/ServerConfig.hpp> // for ServerConfig #include <webserv/config/ServerConfig.hpp> // for ServerConfig
#include <webserv/config/utils.hpp> // for trim, findCorrespondingClosingBrace, trimSemi #include <webserv/config/utils.hpp> // for trim, findCorrespondingClosingBrace, trimSemi
#include <webserv/log/Log.hpp> // for Log #include <webserv/log/Log.hpp> // for Log
#include <stddef.h> // for size_t
#include <fstream> // for basic_ifstream, basic_istream, basic_filebuf, basic_ostream::operator<<, ifstream, istringstream, stringstream #include <fstream> // for basic_ifstream, basic_istream, basic_filebuf, basic_ostream::operator<<, ifstream, istringstream, stringstream
#include <sstream> // for basic_stringstream, basic_istringstream #include <sstream> // for basic_stringstream, basic_istringstream
#include <stdexcept> // for runtime_error #include <stdexcept> // for runtime_error
#include <stddef.h> // for size_t
ConfigManager::ConfigManager() : initialized_(false) {} ConfigManager::ConfigManager() : initialized_(false) {}
ConfigManager::~ConfigManager() {} ConfigManager::~ConfigManager() {}

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <webserv/config/ServerConfig.hpp> #include <webserv/config/ServerConfig.hpp>
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -1,6 +1,7 @@
#include <webserv/config/LocationConfig.hpp> #include <webserv/config/LocationConfig.hpp>
#include <webserv/config/utils.hpp> #include <webserv/config/utils.hpp>
#include <webserv/log/Log.hpp> #include <webserv/log/Log.hpp>
#include <sstream> #include <sstream>
#include <string> #include <string>

View File

@ -2,12 +2,14 @@
#include <webserv/config/ServerConfig.hpp> #include <webserv/config/ServerConfig.hpp>
#include <webserv/config/utils.hpp> // for findCorrespondingClosingBrace, trim #include <webserv/config/utils.hpp> // for findCorrespondingClosingBrace, trim
#include <webserv/log/Log.hpp> // for Log, LOCATION #include <webserv/log/Log.hpp> // for Log, LOCATION
#include <stddef.h> // for size_t
#include <sstream> // for basic_istringstream, basic_istream, istringstream #include <sstream> // for basic_istringstream, basic_istream, istringstream
#include <string> // for basic_string, char_traits, operator+, allocator, string, operator==, operator>>, operator<=>, to_string, stoi, getline
#include <stdexcept> // for runtime_error #include <stdexcept> // for runtime_error
#include <string> // for basic_string, char_traits, operator+, allocator, string, operator==, operator>>, operator<=>, to_string, stoi, getline
#include <utility> // for pair #include <utility> // for pair
#include <stddef.h> // for size_t
ServerConfig::ServerConfig(std::string const &serverBlock) : port_(80) ServerConfig::ServerConfig(std::string const &serverBlock) : port_(80)
{ {
parseServerBlock(serverBlock); parseServerBlock(serverBlock);

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <webserv/config/LocationConfig.hpp> #include <webserv/config/LocationConfig.hpp>
#include <map> #include <map>
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -1,4 +1,5 @@
#include <webserv/config/utils.hpp> #include <webserv/config/utils.hpp>
#include <string> #include <string>
std::string trim(const std::string &str) std::string trim(const std::string &str)

View File

@ -1,8 +1,9 @@
#pragma once #pragma once
#include <stddef.h> // for size_t
#include <string> // for string #include <string> // for string
#include <stddef.h> // for size_t
std::string trimSemi(const std::string &str); std::string trimSemi(const std::string &str);
std::string trim(const std::string &str); std::string trim(const std::string &str);
size_t findCorrespondingClosingBrace(const std::string &str, size_t openPos); size_t findCorrespondingClosingBrace(const std::string &str, size_t openPos);

View File

@ -1,10 +1,11 @@
#pragma once #pragma once
#include <stddef.h> // for size_t
#include <optional> // for optional #include <optional> // for optional
#include <string> // for basic_string, string, hash #include <string> // for basic_string, string, hash
#include <unordered_map> // for unordered_map #include <unordered_map> // for unordered_map
#include <stddef.h> // for size_t
/** /**
* @file HttpHeaders.hpp * @file HttpHeaders.hpp
* @brief Declaration of the HttpHeaders class for managing HTTP headers. * @brief Declaration of the HttpHeaders class for managing HTTP headers.

View File

@ -1,10 +1,11 @@
#include <webserv/http/HttpConstants.hpp> // for CRLF, DOUBLE_CRLF #include <webserv/http/HttpConstants.hpp> // for CRLF, DOUBLE_CRLF
#include <webserv/http/HttpRequest.hpp> #include <webserv/http/HttpRequest.hpp>
#include <webserv/log/Log.hpp> // for Log, LOCATION #include <webserv/log/Log.hpp> // for Log, LOCATION
#include <sstream> // for basic_stringstream, basic_istream, stringstream
#include <vector> // for vector
#include <exception> // for exception #include <exception> // for exception
#include <optional> // for optional, operator> #include <optional> // for optional, operator>
#include <sstream> // for basic_stringstream, basic_istream, stringstream
#include <vector> // for vector
class ServerConfig; class ServerConfig;

View File

@ -1,4 +1,5 @@
#include <webserv/log/Channel.hpp> #include <webserv/log/Channel.hpp>
#include <iomanip> // for operator<<, setfill, setw #include <iomanip> // for operator<<, setfill, setw
#include <sstream> // for basic_ostream, operator<<, basic_stringstream, basic_istream, basic_istringstream, right, istringstream, stringstream #include <sstream> // for basic_ostream, operator<<, basic_stringstream, basic_istream, basic_istringstream, right, istringstream, stringstream
#include <utility> // for get #include <utility> // for get

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <webserv/log/Log.hpp> #include <webserv/log/Log.hpp>
#include <map> #include <map>
#include <string> #include <string>

View File

@ -1,9 +1,10 @@
#include <webserv/log/FileChannel.hpp> #include <webserv/log/FileChannel.hpp>
#include <webserv/log/Log.hpp> // for Log #include <webserv/log/Log.hpp> // for Log
#include <chrono> // for system_clock #include <chrono> // for system_clock
#include <iostream> // for cerr
#include <iomanip> // for operator<<, put_time
#include <ctime> // for localtime, tm #include <ctime> // for localtime, tm
#include <iomanip> // for operator<<, put_time
#include <iostream> // for cerr
struct tm; struct tm;

View File

@ -1,14 +1,15 @@
#pragma once #pragma once
#include <stdint.h> // for uint8_t
#include <array> // for array #include <array> // for array
#include <chrono> // for steady_clock #include <chrono> // for steady_clock
#include <ios> // for ios_base
#include <map> // for map #include <map> // for map
#include <memory> // for unique_ptr #include <memory> // for unique_ptr
#include <string> // for string, basic_string, hash #include <string> // for string, basic_string, hash
#include <string_view> // for string_view #include <string_view> // for string_view
#include <unordered_map> // for unordered_map #include <unordered_map> // for unordered_map
#include <ios> // for ios_base
#include <stdint.h> // for uint8_t
class Channel; // Forward declaration class Channel; // Forward declaration

View File

@ -1,5 +1,6 @@
#include <webserv/log/Log.hpp> // for Log #include <webserv/log/Log.hpp> // for Log
#include <webserv/log/StdoutChannel.hpp> #include <webserv/log/StdoutChannel.hpp>
#include <iomanip> // for operator<<, setfill, setw #include <iomanip> // for operator<<, setfill, setw
#include <iostream> // for basic_ostream, operator<<, basic_ostream::operator<<, cerr, cout, flush, ostream #include <iostream> // for basic_ostream, operator<<, basic_ostream::operator<<, cerr, cout, flush, ostream

View File

@ -1,9 +1,10 @@
#include <webserv/config/ConfigManager.hpp> // for ConfigManager #include <webserv/config/ConfigManager.hpp> // for ConfigManager
#include <webserv/log/Log.hpp> // for Log, LOCATION #include <webserv/log/Log.hpp> // for Log, LOCATION
#include <webserv/server/Server.hpp> // for Server #include <webserv/server/Server.hpp> // for Server
#include <iostream> // for basic_ostream, operator<<, cerr, ios_base #include <iostream> // for basic_ostream, operator<<, cerr, ios_base
#include <string> // for basic_string, char_traits, allocator, operator+, operator<=>
#include <map> // for map #include <map> // for map
#include <string> // for basic_string, char_traits, allocator, operator+, operator<=>
#include <utility> // for pair #include <utility> // for pair
int main(int argc, char **argv) int main(int argc, char **argv)

View File

@ -1,20 +1,22 @@
#include <webserv/client/Client.hpp> // for Client
#include <webserv/config/ConfigManager.hpp> // for ConfigManager
#include <webserv/log/Log.hpp> // for Log #include <webserv/log/Log.hpp> // for Log
#include <webserv/server/Server.hpp> #include <webserv/server/Server.hpp>
#include <webserv/socket/Socket.hpp> // for Socket #include <webserv/socket/Socket.hpp> // for Socket
#include <sys/epoll.h> // for epoll_event, epoll_ctl, EPOLLIN, EPOLLOUT, epoll_create1, epoll_wait, EPOLLERR, EPOLLHUP, EPOLL_CTL_ADD, EPOLL_CTL_DEL, EPOLL_CTL_MOD
#include <sys/socket.h> // for send, SOMAXCONN
#include <unistd.h> // for close
#include <errno.h> // for errno
#include <sys/types.h> // for ssize_t
#include <webserv/client/Client.hpp> // for Client
#include <webserv/config/ConfigManager.hpp> // for ConfigManager
#include <cstring> // for strerror, strlen #include <cstring> // for strerror, strlen
#include <memory> // for unique_ptr, allocator, make_unique
#include <vector> // for vector
#include <exception> // for exception #include <exception> // for exception
#include <memory> // for unique_ptr, allocator, make_unique
#include <stdexcept> // for runtime_error #include <stdexcept> // for runtime_error
#include <string> // for operator+, to_string, basic_string, char_traits, string #include <string> // for operator+, to_string, basic_string, char_traits, string
#include <utility> // for move, pair #include <utility> // for move, pair
#include <vector> // for vector
#include <errno.h> // for errno
#include <sys/epoll.h> // for epoll_event, epoll_ctl, EPOLLIN, EPOLLOUT, epoll_create1, epoll_wait, EPOLLERR, EPOLLHUP, EPOLL_CTL_ADD, EPOLL_CTL_DEL, EPOLL_CTL_MOD
#include <sys/socket.h> // for send, SOMAXCONN
#include <sys/types.h> // for ssize_t
#include <unistd.h> // for close
Server::Server(const ConfigManager &configManager) : epoll_fd_(epoll_create1(0)), configManager_(configManager) Server::Server(const ConfigManager &configManager) : epoll_fd_(epoll_create1(0)), configManager_(configManager)
{ {

View File

@ -1,12 +1,14 @@
#include <webserv/log/Log.hpp> #include <webserv/log/Log.hpp>
#include <webserv/socket/Socket.hpp> #include <webserv/socket/Socket.hpp>
#include <memory>
#include <stdexcept>
#include <arpa/inet.h> // For inet_addr #include <arpa/inet.h> // For inet_addr
#include <fcntl.h> // For fcntl()" #include <fcntl.h> // For fcntl()"
#include <netinet/in.h> // For sockaddr_in #include <netinet/in.h> // For sockaddr_in
#include <sys/socket.h> #include <sys/socket.h>
#include <unistd.h> // For close() #include <unistd.h> // For close()
#include <memory>
#include <stdexcept>
Socket::Socket() : fd_(socket(AF_INET, SOCK_STREAM, 0)) Socket::Socket() : fd_(socket(AF_INET, SOCK_STREAM, 0))
{ {

View File

@ -1,10 +1,11 @@
#pragma once #pragma once
#include <sys/types.h> // for ssize_t
#include <stddef.h> // for size_t
#include <memory> // for unique_ptr #include <memory> // for unique_ptr
#include <string> // for string #include <string> // for string
#include <stddef.h> // for size_t
#include <sys/types.h> // for ssize_t
class Socket class Socket
{ {
public: public: