2121#define _HTTP_ENDPOINT_HPP_
2222
2323#include < vector>
24+ #include < utility>
2425#include < regex.h>
2526#include < string>
2627
@@ -35,48 +36,15 @@ class webserver;
3536class http_endpoint
3637{
3738 public:
38- /* *
39- * Default constructor of the class.
40- * @param family boolean that indicates if the endpoint is a family endpoint.
41- * A family endpoint is an endpoint that identifies a root and all its child like the same resource.
42- * For example, if I identify "/path/" like a family endpoint and I associate to it the resource "A", also
43- * "/path/to/res/" is automatically associated to resource "A".
44- **/
45- http_endpoint (bool family = false ):
46- url_complete (" /" ),
47- url_modded (" /" ),
48- family_url (family),
49- reg_compiled (false )
50- {
51- }
52- /* *
53- * Constructor of the class http_endpoint. It is used to initialize an http_endpoint starting from a string form URL.
54- * @param url The string representation of the endpoint. All endpoints are in the form "/path/to/resource".
55- * @param family boolean that indicates if the endpoint is a family endpoint.
56- * A family endpoint is an endpoint that identifies a root and all its child like the same resource.
57- * For example, if I identify "/path/" like a family endpoint and I associate to it the resource "A", also
58- * "/path/to/res/" is automatically associated to resource "A".
59- * @param registration boolean that indicates to the system if this is an endpoint that need to be registered to a webserver
60- * or it is simply an endpoint to be used for comparisons.
61- **/
62- http_endpoint (const std::string& url, bool family = false , bool registration = false );
6339 /* *
6440 * Copy constructor. It is useful expecially to copy regex_t structure that contains dinamically allocated data.
6541 * @param h The http_endpoint to copy
6642 **/
6743 http_endpoint (const http_endpoint& h);
6844 /* *
69- * Destructor of the class. Essentially it frees the regex dinamically allocated pattern
45+ * Class Destructor
7046 **/
71- ~http_endpoint ()
72- {
73-
74- if (reg_compiled)
75- {
76- regfree (&(this ->re_url_modded ));
77- }
78-
79- }
47+ ~http_endpoint (); // if inlined it causes problems during ruby wrapper compiling
8048 /* *
8149 * Operator overload for "less than operator". It is used to order endpoints in maps.
8250 * @param b The http_endpoint to compare to
@@ -130,6 +98,34 @@ class http_endpoint
13098 return this ->chunk_positions ;
13199 }
132100 private:
101+ /* *
102+ * Default constructor of the class.
103+ * @param family boolean that indicates if the endpoint is a family endpoint.
104+ * A family endpoint is an endpoint that identifies a root and all its child like the same resource.
105+ * For example, if I identify "/path/" like a family endpoint and I associate to it the resource "A", also
106+ * "/path/to/res/" is automatically associated to resource "A".
107+ **/
108+ http_endpoint (bool family = false ):
109+ url_complete (" /" ),
110+ url_modded (" /" ),
111+ family_url (family),
112+ reg_compiled (false )
113+ {
114+ }
115+ /* *
116+ * Constructor of the class http_endpoint. It is used to initialize an http_endpoint starting from a string form URL.
117+ * @param url The string representation of the endpoint. All endpoints are in the form "/path/to/resource".
118+ * @param family boolean that indicates if the endpoint is a family endpoint.
119+ * A family endpoint is an endpoint that identifies a root and all its child like the same resource.
120+ * For example, if I identify "/path/" like a family endpoint and I associate to it the resource "A", also
121+ * "/path/to/res/" is automatically associated to resource "A".
122+ * @param registration boolean that indicates to the system if this is an endpoint that need to be registered to a webserver
123+ * or it is simply an endpoint to be used for comparisons.
124+ **/
125+ http_endpoint (const std::string& url, bool family = false , bool registration = false );
126+ /* *
127+ * Destructor of the class. Essentially it frees the regex dinamically allocated pattern
128+ **/
133129 std::string url_complete;
134130 std::string url_modded;
135131 std::vector<std::string> url_pars;
@@ -139,6 +135,7 @@ class http_endpoint
139135// boost::xpressive::sregex re_url_modded;
140136 bool family_url;
141137 bool reg_compiled;
138+ friend class webserver ;
142139};
143140
144141};
0 commit comments