From 31eff45ecc2a24916618649e264ff33574662877 Mon Sep 17 00:00:00 2001 From: molhot Date: Thu, 7 Sep 2023 18:14:58 +0900 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HandlingString.cpp | 0 .../HandlingString.hpp | 0 srcs/includes/BaseKeyValueMap.hpp | 19 --- srcs/includes/HttpRequest.hpp | 155 ------------------ srcs/includes/RequestLine.hpp | 31 ---- srcs/includes/TwoValueSet.hpp | 27 --- srcs/includes/ValueArraySet.hpp | 27 --- srcs/includes/ValueDateSet.hpp | 39 ----- srcs/includes/ValueMap.hpp | 34 ---- srcs/includes/ValueSet.hpp | 27 --- srcs/includes/ValueWeightArraySet.hpp | 27 --- 11 files changed, 386 deletions(-) rename srcs/{HandleString => HandlingString}/HandlingString.cpp (100%) rename srcs/{includes => HandlingString}/HandlingString.hpp (100%) delete mode 100644 srcs/includes/BaseKeyValueMap.hpp delete mode 100644 srcs/includes/HttpRequest.hpp delete mode 100644 srcs/includes/RequestLine.hpp delete mode 100644 srcs/includes/TwoValueSet.hpp delete mode 100644 srcs/includes/ValueArraySet.hpp delete mode 100644 srcs/includes/ValueDateSet.hpp delete mode 100644 srcs/includes/ValueMap.hpp delete mode 100644 srcs/includes/ValueSet.hpp delete mode 100644 srcs/includes/ValueWeightArraySet.hpp diff --git a/srcs/HandleString/HandlingString.cpp b/srcs/HandlingString/HandlingString.cpp similarity index 100% rename from srcs/HandleString/HandlingString.cpp rename to srcs/HandlingString/HandlingString.cpp diff --git a/srcs/includes/HandlingString.hpp b/srcs/HandlingString/HandlingString.hpp similarity index 100% rename from srcs/includes/HandlingString.hpp rename to srcs/HandlingString/HandlingString.hpp diff --git a/srcs/includes/BaseKeyValueMap.hpp b/srcs/includes/BaseKeyValueMap.hpp deleted file mode 100644 index b19ff7fe..00000000 --- a/srcs/includes/BaseKeyValueMap.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef BASEKEYVALUEMAP_HPP -#define BASEKEYVALUEMAP_HPP - -#include -#include - -class BaseKeyValueMap -{ - private: - - public: - BaseKeyValueMap(void); - BaseKeyValueMap(const BaseKeyValueMap &other); - virtual ~BaseKeyValueMap(); - - virtual void show_value() = 0; -}; - -#endif \ No newline at end of file diff --git a/srcs/includes/HttpRequest.hpp b/srcs/includes/HttpRequest.hpp deleted file mode 100644 index 23024b6a..00000000 --- a/srcs/includes/HttpRequest.hpp +++ /dev/null @@ -1,155 +0,0 @@ -#ifndef HTTPREQUEST_HPP -#define HTTPREQUEST_HPP - -#include -#include -#include -#include -#include - -#include "BaseKeyValueMap.hpp" -#include "HandlingString.hpp" -#include "RequestLine.hpp" -#include "ValueWeightArraySet.hpp" -#include "ValueArraySet.hpp" -#include "ValueSet.hpp" -#include "TwoValueSet.hpp" -#include "ValueMap.hpp" -#include "ValueDateSet.hpp" - -class BaseKeyValueMap; - -class RequestLine; -class ValueWeightArraySet; -class ValueArraySet; -class ValueSet; -class TwoValueSet; -class ValueMap; -class ValueDateSet; - -class HttpRequest -{ - private: - RequestLine _requestline; - std::map inputvalue_functionmap; - std::map request_keyvalue_map; - - HttpRequest(); - HttpRequest(const HttpRequest &other); - - bool check_keyword_exist(const std::string &key); - std::string obtain_request_key(const std::string value); - std::string obtain_request_value(const std::string value); - - TwoValueSet *ready_TwoValueSet(const std::string &value); - TwoValueSet *ready_TwoValueSet(const std::string &value, char delimiter); - ValueArraySet *ready_ValueArraySet(const std::string &value); - ValueDateSet *ready_ValueDateSet(const std::string &value); - ValueMap *ready_ValueMap(const std::string &value); - ValueMap *ready_ValueMap(const std::string &only_value, const std::string &value); - ValueSet *ready_ValueSet(const std::string &value); - ValueWeightArraySet *ready_ValueWeightArraySet(const std::string &value); - void ready_functionmap(void); - - double _status_code; - - public: - - HttpRequest(const std::string &all_request_text); - ~HttpRequest(); - - // void set_all_method(); - void set_accept(const std::string &key, const std::string &value); - void set_accept_ch(const std::string &key,const std::string &value); - void set_accept_charset(const std::string &key,const std::string &value); - void set_accept_encoding(const std::string &key,const std::string &value); - void set_accept_language(const std::string &key,const std::string &value); - bool check_accept_langage_valueword(const std::string &value); - // void set_//方かわからん - void set_accept_post(const std::string &key,const std::string &value); - void set_accept_ranges(const std::string &key,const std::string &value); - void set_access_control_allow_credentials(const std::string &key,const std::string &value); - void set_access_control_allow_headers(const std::string &key,const std::string &value); - void set_access_control_allow_methods(const std::string &key,const std::string &value); - void set_access_control_allow_origin(const std::string &key,const std::string &value); - void set_access_control_expose_headers(const std::string &key,const std::string &value); - void set_access_control_max_age(const std::string &key,const std::string &value); - void set_access_control_request_headers(const std::string &key,const std::string &value); - void set_access_control_request_method(const std::string &key,const std::string &value); - void set_age(const std::string &key,const std::string &value); - void set_allow(const std::string &key,const std::string &value); - void set_alt_svc(const std::string &key,const std::string &value); - void set_alt_used(const std::string &key,const std::string &value); - void set_authorization(const std::string &key, const std::string &value); - // void set//か全くわからない うまく分けられん - void set_clear_site_data(const std::string &key,const std::string &value); - void set_connection(const std::string &key,const std::string &value); - void set_content_disponesition(const std::string &key,const std::string &value); - void set_content_encoding(const std::string &key,const std::string &value); - void set_content_language(const std::string &key,const std::string &value); - void set_content_length(const std::string &key,const std::string &value); - void set_content_location(const std::string &key,const std::string &value); - void set_content_range(const std::string &key,const std::string &value); - void set_content_security_policy(const std::string &key,const std::string &value); - void set_content_security_policy_report_only(const std::string &key,const std::string &value); - void set_content_type(const std::string &key,const std::string &value); - void set_cookie(const std::string &key,const std::string &value); - void set_cross_origin_embedder_policy(const std::string &key,const std::string &value); - void set_cross_origin_opener_policy(const std::string &key,const std::string &value); - void set_cross_origin_resource_policy(const std::string &key,const std::string &value); - void set_date(const std::string &key,const std::string &value); - void set_etag(const std::string &key,const std::string &value); - void set_expect(const std::string &key,const std::string &value); - // void set//ているっぽくて対応したくない - void set_expires(const std::string &key,const std::string &value); - void set_forwarded(const std::string &key,const std::string &value); - void set_email(const std::string &key,const std::string &value); - void set_from(const std::string &key,const std::string &value); - void set_host(const std::string &key,const std::string &value); - void set_if_match(const std::string &key,const std::string &value); - void set_if_modified_since(const std::string &key,const std::string &value); - void set_if_none_match(const std::string &key,const std::string &value); - void set_if_range(const std::string &key,const std::string &value); - void set_if_unmodified_since(const std::string &key,const std::string &value); - void set_keep_alive(const std::string &key,const std::string &value); - void set_last_modified(const std::string &key,const std::string &value); - void set_link(const std::string &key,const std::string &value); - void set_location(const std::string &key,const std::string &value); - void set_max_forwards(const std::string &key,const std::string &value); - void set_origin(const std::string &key,const std::string &value); - void set_permission_policy(const std::string &key,const std::string &value); - void set_proxy_authenticate(const std::string &key,const std::string &value); - void set_proxy_authorization(const std::string &key,const std::string &value); - // void set//れどれが当てはまるかわからん - void set_referer(const std::string &key,const std::string &value); - void set_referrer_policy(const std::string &key,const std::string &value); - void set_retry_after(const std::string &key,const std::string &value); - void set_sec_fetch_dest(const std::string &key,const std::string &value); - void set_sec_fetch_mode(const std::string &key,const std::string &value); - void set_sec_fetch_site(const std::string &key,const std::string &value); - void set_sec_fetch_user(const std::string &key,const std::string &value); - void set_sec_purpose(const std::string &key,const std::string &value); - void set_sec_websocket_accept(const std::string &key,const std::string &value); - void set_server(const std::string &key,const std::string &value); - void set_servertiming(const std::string &key,const std::string &value); - void set_service_worker_navigation_preload(const std::string &key,const std::string &value); - void set_set_cookie(const std::string &key,const std::string &value); - void set_sourcemap(const std::string &key,const std::string &value); - void set_strict_transport_security(const std::string &key,const std::string &value); - void set_te(const std::string &key,const std::string &value); - void set_timing_allow_origin(const std::string &key,const std::string &value); - void set_trailer(const std::string &key,const std::string &value); - void set_transfer_encoding(const std::string &key,const std::string &value); - void set_upgrade(const std::string &key,const std::string &value); - void set_upgrade_insecure_requests(const std::string &key,const std::string &value); - void set_user_agent(const std::string &key,const std::string &value); - void set_vary(const std::string &key,const std::string &value); - void set_via(const std::string &key,const std::string &value); - void set_www_authenticate(const std::string &key,const std::string &value); - void set_x_xss_protection(const std::string &key,const std::string &value); - - //debug関数 - void show_requestinfs(void); -}; - -#endif \ No newline at end of file diff --git a/srcs/includes/RequestLine.hpp b/srcs/includes/RequestLine.hpp deleted file mode 100644 index d0ce9149..00000000 --- a/srcs/includes/RequestLine.hpp +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef REQUESTLINE_HPP -#define REQUESTLINE_HPP - -#include -#include -#include - -class RequestLine -{ - private: - std::string _method; - std::string _target_page; - std::string _version; - - RequestLine(const RequestLine &other); - RequestLine& operator=(const RequestLine &other); - - public: - RequestLine(); - ~RequestLine(); - - void set_value(const std::string &line); - - std::string get_method(void) const; - std::string get_target_page(void) const; - std::string get_version(void) const; - - void show_requestline(void) const; -}; - -#endif \ No newline at end of file diff --git a/srcs/includes/TwoValueSet.hpp b/srcs/includes/TwoValueSet.hpp deleted file mode 100644 index da47b21b..00000000 --- a/srcs/includes/TwoValueSet.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef TWOVALUESET_HPP -#define TWOVALUESET_HPP - -#include -#include -#include "BaseKeyValueMap.hpp" - -class TwoValueSet: public BaseKeyValueMap -{ - private: - std::string _firstvalue; - std::string _secondValue; - - public: - TwoValueSet(); - TwoValueSet(std::string const &first_value); - TwoValueSet(const std::string &first_value, const std::string &second_value); - TwoValueSet& operator=(const TwoValueSet &other); - ~TwoValueSet(); - - std::string get_firstvalue(void) const; - std::string get_secondvalue(void) const; - - void show_value(void); -}; - -#endif \ No newline at end of file diff --git a/srcs/includes/ValueArraySet.hpp b/srcs/includes/ValueArraySet.hpp deleted file mode 100644 index 1b1f970c..00000000 --- a/srcs/includes/ValueArraySet.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef VALUEARRAYSET_HPP -#define VALUEARRAYSET_HPP - -#include -#include -#include - -#include "BaseKeyValueMap.hpp" - -class ValueArraySet: public BaseKeyValueMap -{ - private: - std::vector _value_array; - - public: - ValueArraySet(); - ValueArraySet(const ValueArraySet &other); - ValueArraySet(const std::vector &value_array); - ValueArraySet &operator=(const ValueArraySet &other); - ~ValueArraySet(); - - std::vector get_value_array(void) const; - - void show_value(void); -}; - -#endif \ No newline at end of file diff --git a/srcs/includes/ValueDateSet.hpp b/srcs/includes/ValueDateSet.hpp deleted file mode 100644 index 455acf57..00000000 --- a/srcs/includes/ValueDateSet.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef VALUEDATESET_HPP -#define VALUEDATESET_HPP - -#include -#include -#include - -#include "BaseKeyValueMap.hpp" - -class ValueDateSet: public BaseKeyValueMap -{ - private: - std::string _day_name; - std::string _day; - std::string _month; - std::string _year; - std::string _hour; - std::string _minute; - std::string _second; - - public: - ValueDateSet(); - ValueDateSet(const ValueDateSet &other); - ValueDateSet& operator=(const ValueDateSet &other); - ValueDateSet(const std::string &date_format); - ~ValueDateSet(); - - std::string get_valuedateset_day_name() const; - std::string get_valuedateset_day() const; - std::string get_valuedateset_month() const; - std::string get_valuedateset_year() const; - std::string get_valuedateset_hour() const; - std::string get_valuedateset_minute() const; - std::string get_valuedateset_second() const; - - void show_value(); -}; - -#endif \ No newline at end of file diff --git a/srcs/includes/ValueMap.hpp b/srcs/includes/ValueMap.hpp deleted file mode 100644 index 0f17d980..00000000 --- a/srcs/includes/ValueMap.hpp +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef VALUEMAP_HPP -#define VALUEMAP_HPP - -#include -#include -#include - -#include "BaseKeyValueMap.hpp" - -class ValueMap: public BaseKeyValueMap -{ - private: - std::string _only_value; - std::map _value_map; - - public: - ValueMap(); - ValueMap(const ValueMap &other); - ValueMap& operator=(const ValueMap &other); - ValueMap(const std::string &value, std::map value_map); - ValueMap(std::map value_map); - ~ValueMap(); - - void set_value(const std::string &only_value, const std::map &value_map); - void set_value(const std::string &only_value); - void set_value(const std::map &value_map); - - std::string get_only_value(void) const; - std::map get_value_map(void) const; - - void show_value(); -}; - -#endif \ No newline at end of file diff --git a/srcs/includes/ValueSet.hpp b/srcs/includes/ValueSet.hpp deleted file mode 100644 index 018a01f4..00000000 --- a/srcs/includes/ValueSet.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef VALUESET_HPP -#define VALUESET_HPP - -#include -#include -#include - -#include "BaseKeyValueMap.hpp" - -class ValueSet: public BaseKeyValueMap -{ - private: - std::string _value; - - public: - ValueSet(); - ValueSet(const ValueSet &other); - ValueSet &operator=(const ValueSet &other); - ValueSet(const std::string &value); - ~ValueSet(); - - std::string get_value_set(void) const; - - void show_value(); -}; - -#endif \ No newline at end of file diff --git a/srcs/includes/ValueWeightArraySet.hpp b/srcs/includes/ValueWeightArraySet.hpp deleted file mode 100644 index f4de72e9..00000000 --- a/srcs/includes/ValueWeightArraySet.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef VALUEWEIGHTARRAYSET_HPP -#define VALUEWEIGHTARRAYSET_HPP - -#include -#include -#include "HandlingString.hpp" - -#include "BaseKeyValueMap.hpp" - -class ValueWeightArraySet: public BaseKeyValueMap -{ - private: - std::map _valueweight_set;//map型で入れるが、どうせなら重みを加味したようなインプットの流れにしておけば取り出す時に非常に楽になるのでは? - - public: - ValueWeightArraySet(); - ValueWeightArraySet(const ValueWeightArraySet &other); - ValueWeightArraySet &operator=(const ValueWeightArraySet &other); - ValueWeightArraySet(std::map &valueweight_set); - ~ValueWeightArraySet(); - - std::map get_valueweight_set(void) const; - - void show_value(); -}; - -#endif \ No newline at end of file