@@ -50,30 +50,35 @@ class webserver::http_endpoint
5050 * @param h The http_endpoint to copy
5151 **/
5252 http_endpoint (const http_endpoint& h);
53+
5354 /* *
5455 * Class Destructor
5556 **/
5657 ~http_endpoint (); // if inlined it causes problems during ruby wrapper compiling
58+
5759 /* *
5860 * Operator overload for "less than operator". It is used to order endpoints in maps.
5961 * @param b The http_endpoint to compare to
6062 * @return boolean indicating if this is less than b.
6163 **/
6264 bool operator <(const http_endpoint& b) const ;
65+
6366 /* *
6467 * Operator overload for "assignment operator". It is used to copy endpoints to existing objects.
6568 * Is is functional expecially to copy regex_t structure that contains dinamically allocated data.
6669 * @param h The http_endpoint to copy
6770 * @return a reference to the http_endpoint obtained
6871 **/
6972 http_endpoint& operator =(const http_endpoint& h);
73+
7074 /* *
7175 * Method indicating if this endpoint 'matches' with the one passed. A passed endpoint matches a registered endpoint if
7276 * the regex represented by the registered endpoint matches the passed one.
7377 * @param url The endpoint to match
7478 * @return true if the passed endpoint matches this.
7579 **/
7680 bool match (const http_endpoint& url) const ;
81+
7782 /* *
7883 * Method used to get the complete endpoint url
7984 * @return a string representing the url
@@ -82,22 +87,7 @@ class webserver::http_endpoint
8287 {
8388 return this ->url_complete ;
8489 }
85- /* *
86- * Method used to get the complete endpoint url
87- * @param result a string reference that will be filled with the url
88- **/
89- void get_url_complete (std::string& result) const
90- {
91- result = this ->url_complete ;
92- }
93- /* *
94- * Method used to find the size of the complete endpoint url
95- * @return the size
96- **/
97- size_t get_url_complete_size () const
98- {
99- return this ->url_complete .size ();
100- }
90+
10191 /* *
10292 * Method used to get all pars defined inside an url.
10393 * @return a vector of strings representing all found pars.
@@ -106,11 +96,7 @@ class webserver::http_endpoint
10696 {
10797 return this ->url_pars ;
10898 }
109- size_t get_url_pars (std::vector<std::string>& result) const
110- {
111- result = this ->url_pars ;
112- return result.size ();
113- }
99+
114100 /* *
115101 * Method used to get all pieces of an url; considering an url splitted by '/'.
116102 * @return a vector of strings representing all found pieces.
@@ -119,24 +105,7 @@ class webserver::http_endpoint
119105 {
120106 return this ->url_pieces ;
121107 }
122- /* *
123- * Method used to get all pieces of an url; considering an url splittet by '/'.
124- * @param result a vector of strings to fill with url pieces.
125- * @return the size of the vector in output
126- **/
127- size_t get_url_pieces (std::vector<std::string>& result) const
128- {
129- result = this ->url_pieces ;
130- return result.size ();
131- }
132- /* *
133- * Method used to get the number of pieces the url is composed of
134- * @return the number of pieces
135- **/
136- size_t get_url_pieces_num () const
137- {
138- return this ->url_pieces .size ();
139- }
108+
140109 /* *
141110 * Method used to get indexes of all parameters inside url
142111 * @return a vector of int indicating all positions.
@@ -145,16 +114,7 @@ class webserver::http_endpoint
145114 {
146115 return this ->chunk_positions ;
147116 }
148- /* *
149- * Method used to get indexes of all parameters inside url
150- * @param result a vector to fill with ints indicating chunk positions
151- * @return the size of the vector filled
152- **/
153- size_t get_chunk_positions (std::vector<int >& result) const
154- {
155- result = this ->chunk_positions ;
156- return result.size ();
157- }
117+
158118 /* *
159119 * Default constructor of the class.
160120 * @param family boolean that indicates if the endpoint is a family endpoint.
@@ -169,6 +129,7 @@ class webserver::http_endpoint
169129 reg_compiled (false )
170130 {
171131 }
132+
172133 /* *
173134 * Constructor of the class http_endpoint. It is used to initialize an http_endpoint starting from a string form URL.
174135 * @param url The string representation of the endpoint. All endpoints are in the form "/path/to/resource".
@@ -185,34 +146,42 @@ class webserver::http_endpoint
185146 bool registration = false ,
186147 bool use_regex = true
187148 );
149+
188150 /* *
189151 * The complete url extracted
190152 **/
191153 std::string url_complete;
154+
192155 /* *
193156 * The url standardized in order to use standard comparisons or regexes
194157 **/
195158 std::string url_modded;
159+
196160 /* *
197161 * Vector containing parameters extracted from url
198162 **/
199163 std::vector<std::string> url_pars;
164+
200165 /* *
201166 * Pieces the url can be splitted into (consider '/' as separator)
202167 **/
203168 std::vector<std::string> url_pieces;
169+
204170 /* *
205171 * Position of url pieces representing parameters
206172 **/
207173 std::vector<int > chunk_positions;
174+
208175 /* *
209176 * Regex used in comparisons
210177 **/
211178 regex_t re_url_modded;
179+
212180 /* *
213181 * Boolean indicating wheter the endpoint represents a family
214182 **/
215183 bool family_url;
184+
216185 /* *
217186 * Boolean indicating if the regex is compiled
218187 **/
0 commit comments