From 5a22af3c5a298bfb81b6dd9c0e003ca1c2ae5174 Mon Sep 17 00:00:00 2001 From: y-syo Date: Tue, 29 Apr 2025 14:59:21 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=E2=9C=A8=E3=80=8D=20feat(Resource):?= =?UTF-8?q?=20added=20resource=20abstract=20class=20:D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/server/Resource.hpp | 34 +++++++++++++++++++++++++++++ src/server/Resource.cpp | 42 ++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 includes/server/Resource.hpp create mode 100644 src/server/Resource.cpp diff --git a/includes/server/Resource.hpp b/includes/server/Resource.hpp new file mode 100644 index 0000000..6a874c0 --- /dev/null +++ b/includes/server/Resource.hpp @@ -0,0 +1,34 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* Resource.hpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: mmoussou +#include + +namespace webserv { +namespace server { + +class ClientResource { +public: + virtual ~ClientResource() {} + + void addFileDescriptor(struct pollfd fd); + struct pollfd getFileDescriptor(); + +private: + struct pollfd _fd; + +}; + +} // -namepsace server +} // -namespace webserv diff --git a/src/server/Resource.cpp b/src/server/Resource.cpp new file mode 100644 index 0000000..2d92030 --- /dev/null +++ b/src/server/Resource.cpp @@ -0,0 +1,42 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* Resource.cpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: mmoussou + +/* +class ClientResource { +public: + virtual void handleResource() = 0; + virtual ~HttpClientResource() {} + + void addFileDescriptor(int fd); + void getFileDescriptors(); + +private: + struct pollfd fd; + +} +*/ + +using namespace webserv; +using namespace server; + +void ClientResource::addFileDescriptor(struct pollfd fd) +{ + this->_fd = fd; +} + + +struct pollfd ClientResource::getFileDescriptor() +{ + return (this->_fd); +}