@@ -39,7 +39,6 @@ RAPIDJSON_NAMESPACE_BEGIN
39
39
40
40
// ! Constructors
41
41
GenericUri (Allocator* allocator = 0 ) : uri_(), base_(), scheme_(), auth_(), path_(), query_(), frag_(), allocator_(allocator), ownAllocator_() {
42
- // std::cout << "Default constructor" << std::endl;
43
42
}
44
43
45
44
GenericUri (const Ch* uri, SizeType len, Allocator* allocator = 0 ) : uri_(), base_(), scheme_(), auth_(), path_(), query_(), frag_(), allocator_(allocator), ownAllocator_() {
@@ -64,26 +63,22 @@ RAPIDJSON_NAMESPACE_BEGIN
64
63
65
64
// ! Copy constructor
66
65
GenericUri (const GenericUri& rhs) : uri_(), base_(), scheme_(), auth_(), path_(), query_(), frag_(), allocator_(rhs.allocator_), ownAllocator_() {
67
- // std::cout << "Copy constructor" << std::endl;
68
66
*this = rhs;
69
67
}
70
68
71
69
// ! Copy constructor
72
70
GenericUri (const GenericUri& rhs, Allocator* allocator) : uri_(), base_(), scheme_(), auth_(), path_(), query_(), frag_(), allocator_(allocator), ownAllocator_() {
73
- // std::cout << "Copy constructor" << std::endl;
74
71
*this = rhs;
75
72
}
76
73
77
74
// ! Destructor.
78
75
~GenericUri () {
79
- // std::cout << "Destructor" << std::endl;
80
76
Free ();
81
77
RAPIDJSON_DELETE (ownAllocator_);
82
78
}
83
79
84
80
// ! Assignment operator
85
81
GenericUri& operator =(const GenericUri& rhs) {
86
- // std::cout << "Operator=" << std::endl;
87
82
if (this != &rhs) {
88
83
// Do not delete ownAllocator
89
84
Free ();
@@ -95,7 +90,6 @@ RAPIDJSON_NAMESPACE_BEGIN
95
90
base_ = CopyPart (frag_, rhs.frag_ , rhs.GetFragStringLength ());
96
91
uri_ = CopyPart (base_, rhs.base_ , rhs.GetBaseStringLength ());
97
92
CopyPart (uri_, rhs.uri_ , rhs.GetStringLength ());
98
- // std::wcout << L" Assignment uri: " << uri_ << ", length: " << GetStringLength() << std::endl;
99
93
}
100
94
return *this ;
101
95
}
@@ -160,7 +154,6 @@ RAPIDJSON_NAMESPACE_BEGIN
160
154
// Use for resolving an id or $ref with an in-scope id.
161
155
// Returns a new GenericUri for the resolved URI.
162
156
GenericUri Resolve (const GenericUri& baseuri, Allocator* allocator = 0 ) {
163
- // std::cout << "Resolve" << std::endl;
164
157
GenericUri resuri;
165
158
resuri.allocator_ = allocator;
166
159
// Ensure enough space for combining paths
@@ -224,13 +217,11 @@ RAPIDJSON_NAMESPACE_BEGIN
224
217
}
225
218
// Always use this frag
226
219
resuri.base_ = CopyPart (resuri.frag_ , frag_, GetFragStringLength ());
227
- // std::wcout << L" Resolved uri: " << L"s: " << resuri.scheme_ << L" a: " << resuri.auth_ << L" p: " << resuri.path_ << L" q: " << resuri.query_ << L" f: " << resuri.frag_ << std::endl;
228
220
229
221
// Re-constitute base_ and uri_
230
222
resuri.SetBase ();
231
223
resuri.uri_ = resuri.base_ + resuri.GetBaseStringLength () + 1 ;
232
224
resuri.SetUri ();
233
- // std::wcout << L" Resolved rebuilt uri: " << resuri.uri_ << L", length: " << resuri.GetStringLength() << std::endl;
234
225
return resuri;
235
226
}
236
227
@@ -241,7 +232,6 @@ RAPIDJSON_NAMESPACE_BEGIN
241
232
// Allocate memory for a URI
242
233
// Returns total amount allocated
243
234
std::size_t Allocate (std::size_t len) {
244
- // std::cout << "Allocate" << std::endl;
245
235
// Create own allocator if user did not supply.
246
236
if (!allocator_)
247
237
ownAllocator_ = allocator_ = RAPIDJSON_NEW (Allocator)();
@@ -263,15 +253,12 @@ RAPIDJSON_NAMESPACE_BEGIN
263
253
*base_ = ' \0 ' ;
264
254
uri_ = base_ + 1 ;
265
255
*uri_ = ' \0 ' ;
266
- // std::cout << " Allocating " << total << std::endl;
267
256
return total;
268
257
}
269
258
270
259
// Free memory for a URI
271
260
void Free () {
272
- // std::cout << "Free" << std::endl;
273
261
if (scheme_) {
274
- // std::cout << " Freeing" << std::endl;
275
262
Allocator::Free (scheme_);
276
263
scheme_ = 0 ;
277
264
}
@@ -281,7 +268,6 @@ RAPIDJSON_NAMESPACE_BEGIN
281
268
// Supports URIs that match regex ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))? as per
282
269
// https://tools.ietf.org/html/rfc3986
283
270
void Parse (const Ch* uri, std::size_t len) {
284
- // std::cout << "Parse" << std::endl;
285
271
std::size_t start = 0 , pos1 = 0 , pos2 = 0 ;
286
272
Allocate (len);
287
273
@@ -368,14 +354,12 @@ RAPIDJSON_NAMESPACE_BEGIN
368
354
std::memcpy (frag_, &uri[start], (len - start) * sizeof (Ch));
369
355
frag_[len - start] = ' \0 ' ;
370
356
}
371
- // std::wcout << L" Parsed uri: " << L"s: " << scheme_ << L" a: " << auth_ << L" p: " << path_ << L" q: " << query_ << L" f: " << frag_ << std::endl;
372
357
373
358
// Re-constitute base_ and uri_
374
359
base_ = frag_ + GetFragStringLength () + 1 ;
375
360
SetBase ();
376
361
uri_ = base_ + GetBaseStringLength () + 1 ;
377
362
SetUri ();
378
- // std::wcout << L" Rebuilt uri: " << uri_ << L", length: " << GetStringLength() << std::endl;
379
363
}
380
364
381
365
// Reconstitute base
@@ -433,7 +417,6 @@ RAPIDJSON_NAMESPACE_BEGIN
433
417
if (slashpos == 2 && path_[pathpos] == ' .' && path_[pathpos + 1 ] == ' .' ) {
434
418
// Backup a .. segment in the new path_
435
419
// We expect to find a previously added slash at the end or nothing
436
- // std::wcout << L" Path - backing up .. in " << path_ << std::endl;
437
420
size_t lastslashpos = newpos;
438
421
while (lastslashpos > 0 ) {
439
422
if (path_[lastslashpos - 1 ] == ' /' ) break ;
@@ -452,7 +435,6 @@ RAPIDJSON_NAMESPACE_BEGIN
452
435
}
453
436
} else if (slashpos == 1 && path_[pathpos] == ' .' ) {
454
437
// Discard . segment, leaves new path_ unchanged
455
- // std::wcout << L" Path - removing . in " << path_ << std::endl;
456
438
} else {
457
439
// Move any other kind of segment to the new path_
458
440
RAPIDJSON_ASSERT (newpos <= pathpos);
@@ -468,7 +450,6 @@ RAPIDJSON_NAMESPACE_BEGIN
468
450
pathpos += slashpos + 1 ;
469
451
}
470
452
path_[newpos] = ' \0 ' ;
471
- // std::wcout << L" Normalized Path: " << path_ << ", length: " << GetPathStringLength() << std::endl;
472
453
}
473
454
474
455
Ch* uri_; // Everything
0 commit comments