@@ -36,7 +36,7 @@ http_endpoint::~http_endpoint()
3636{
3737 if (reg_compiled)
3838 {
39- regfree (&( this -> re_url_normalized ) );
39+ regfree (&re_url_normalized);
4040 }
4141}
4242
@@ -50,7 +50,7 @@ http_endpoint::http_endpoint
5050 family_url (family),
5151 reg_compiled (false )
5252{
53- this -> url_normalized = use_regex ? " ^/" : " /" ;
53+ url_normalized = use_regex ? " ^/" : " /" ;
5454 vector<string> parts;
5555
5656#ifdef CASE_INSENSITIVE
@@ -77,10 +77,10 @@ http_endpoint::http_endpoint
7777 {
7878 if (!registration)
7979 {
80- this -> url_normalized += (first ? " " : " /" ) + parts[i];
80+ url_normalized += (first ? " " : " /" ) + parts[i];
8181 first = false ;
8282
83- this -> url_pieces .push_back (parts[i]);
83+ url_pieces.push_back (parts[i]);
8484
8585 continue ;
8686 }
@@ -89,14 +89,14 @@ http_endpoint::http_endpoint
8989 {
9090 if (first)
9191 {
92- this -> url_normalized = (parts[i][0 ] == ' ^' ? " " : this -> url_normalized ) + parts[i];
92+ url_normalized = (parts[i][0 ] == ' ^' ? " " : url_normalized) + parts[i];
9393 first = false ;
9494 }
9595 else
9696 {
97- this -> url_normalized += " /" + parts[i];
97+ url_normalized += " /" + parts[i];
9898 }
99- this -> url_pieces .push_back (parts[i]);
99+ url_pieces.push_back (parts[i]);
100100
101101 continue ;
102102 }
@@ -105,23 +105,23 @@ http_endpoint::http_endpoint
105105 throw std::invalid_argument (" Bad URL format" );
106106
107107 std::string::size_type bar = parts[i].find_first_of (' |' );
108- this -> url_pars .push_back (parts[i].substr (1 , bar != string::npos ? bar - 1 : parts[i].size () - 2 ));
109- this -> url_normalized += (first ? " " : " /" ) + (bar != string::npos ? parts[i].substr (bar + 1 , parts[i].size () - bar - 2 ) : " ([^\\ /]+)" );
108+ url_pars.push_back (parts[i].substr (1 , bar != string::npos ? bar - 1 : parts[i].size () - 2 ));
109+ url_normalized += (first ? " " : " /" ) + (bar != string::npos ? parts[i].substr (bar + 1 , parts[i].size () - bar - 2 ) : " ([^\\ /]+)" );
110110
111111 first = false ;
112112
113- this -> chunk_positions .push_back (i);
113+ chunk_positions.push_back (i);
114114
115- this -> url_pieces .push_back (parts[i]);
115+ url_pieces.push_back (parts[i]);
116116 }
117117
118118 if (use_regex)
119119 {
120- this -> url_normalized += " $" ;
121- regcomp (&( this -> re_url_normalized ) , url_normalized.c_str (),
120+ url_normalized += " $" ;
121+ regcomp (&re_url_normalized, url_normalized.c_str (),
122122 REG_EXTENDED|REG_ICASE|REG_NOSUB
123123 );
124- this -> reg_compiled = true ;
124+ reg_compiled = true ;
125125 }
126126}
127127
@@ -134,52 +134,52 @@ http_endpoint::http_endpoint(const http_endpoint& h):
134134 family_url (h.family_url),
135135 reg_compiled (h.reg_compiled)
136136{
137- if (this -> reg_compiled )
138- regcomp (&( this -> re_url_normalized ) , url_normalized.c_str (),
137+ if (reg_compiled)
138+ regcomp (&re_url_normalized, url_normalized.c_str (),
139139 REG_EXTENDED|REG_ICASE|REG_NOSUB
140140 );
141141}
142142
143143http_endpoint& http_endpoint::operator =(const http_endpoint& h)
144144{
145- this -> url_complete = h.url_complete ;
146- this -> url_normalized = h.url_normalized ;
147- this -> family_url = h.family_url ;
148- this -> reg_compiled = h.reg_compiled ;
149- if (this -> reg_compiled )
145+ url_complete = h.url_complete ;
146+ url_normalized = h.url_normalized ;
147+ family_url = h.family_url ;
148+ reg_compiled = h.reg_compiled ;
149+ if (reg_compiled)
150150 {
151- regfree (&( this -> re_url_normalized ) );
151+ regfree (&re_url_normalized);
152152
153- regcomp (&( this -> re_url_normalized ) , url_normalized.c_str (),
153+ regcomp (&re_url_normalized, url_normalized.c_str (),
154154 REG_EXTENDED|REG_ICASE|REG_NOSUB
155155 );
156156 }
157- this -> url_pars = h.url_pars ;
158- this -> url_pieces = h.url_pieces ;
159- this -> chunk_positions = h.chunk_positions ;
157+ url_pars = h.url_pars ;
158+ url_pieces = h.url_pieces ;
159+ chunk_positions = h.chunk_positions ;
160160 return *this ;
161161}
162162
163163bool http_endpoint::operator <(const http_endpoint& b) const
164164{
165- COMPARATOR (this -> url_normalized , b.url_normalized , std::toupper);
165+ COMPARATOR (url_normalized, b.url_normalized , std::toupper);
166166}
167167
168168bool http_endpoint::match (const http_endpoint& url) const
169169{
170- if (!this -> reg_compiled ) throw std::invalid_argument (" Cannot run match. Regex suppressed." );
170+ if (!reg_compiled) throw std::invalid_argument (" Cannot run match. Regex suppressed." );
171171
172- if (!this -> family_url || url.url_pieces .size () < this -> url_pieces .size ())
173- return regexec (&( this -> re_url_normalized ) , url.url_complete .c_str (), 0 , NULL , 0 ) == 0 ;
172+ if (!family_url || url.url_pieces .size () < url_pieces.size ())
173+ return regexec (&re_url_normalized, url.url_complete .c_str (), 0 , NULL , 0 ) == 0 ;
174174
175175 string nn = " /" ;
176176 bool first = true ;
177- for (unsigned int i = 0 ; i < this -> url_pieces .size (); i++)
177+ for (unsigned int i = 0 ; i < url_pieces.size (); i++)
178178 {
179179 nn += (first ? " " : " /" ) + url.url_pieces [i];
180180 first = false ;
181181 }
182- return regexec (&( this -> re_url_normalized ) , nn.c_str (), 0 , NULL , 0 ) == 0 ;
182+ return regexec (&re_url_normalized, nn.c_str (), 0 , NULL , 0 ) == 0 ;
183183}
184184
185185};
0 commit comments