@@ -150,6 +150,299 @@ bool IdType::isBase64() const noexcept
150
150
|| internal::Base64::validateBase64 (std::get<OpaqueString>(_data));
151
151
}
152
152
153
+ bool IdType::empty () const noexcept
154
+ {
155
+ return std::visit (
156
+ [](const auto & data) noexcept {
157
+ return data.empty ();
158
+ },
159
+ _data);
160
+ }
161
+
162
+ size_t IdType::size () const noexcept
163
+ {
164
+ return std::visit (
165
+ [](const auto & data) noexcept {
166
+ return data.size ();
167
+ },
168
+ _data);
169
+ }
170
+
171
+ size_t IdType::max_size () const noexcept
172
+ {
173
+ return std::visit (
174
+ [](const auto & data) noexcept {
175
+ return data.max_size ();
176
+ },
177
+ _data);
178
+ }
179
+
180
+ void IdType::reserve (size_t new_cap)
181
+ {
182
+ std::visit (
183
+ [new_cap](auto & data) {
184
+ data.reserve (new_cap);
185
+ },
186
+ _data);
187
+ }
188
+
189
+ size_t IdType::capacity () const noexcept
190
+ {
191
+ return std::visit (
192
+ [](const auto & data) noexcept {
193
+ return data.capacity ();
194
+ },
195
+ _data);
196
+ }
197
+
198
+ void IdType::shrink_to_fit ()
199
+ {
200
+ std::visit (
201
+ [](auto & data) {
202
+ data.shrink_to_fit ();
203
+ },
204
+ _data);
205
+ }
206
+
207
+ void IdType::clear ()
208
+ {
209
+ std::visit (
210
+ [](auto & data) {
211
+ data.clear ();
212
+ },
213
+ _data);
214
+ }
215
+
216
+ const std::uint8_t & IdType::at (size_t pos) const
217
+ {
218
+ if (!std::holds_alternative<ByteData>(_data))
219
+ {
220
+ throw std::logic_error (" Invalid call to IdType::at for ByteData" );
221
+ }
222
+
223
+ return std::get<ByteData>(_data).at (pos);
224
+ }
225
+
226
+ std::uint8_t & IdType::at (size_t pos)
227
+ {
228
+ if (!std::holds_alternative<ByteData>(_data))
229
+ {
230
+ throw std::logic_error (" Invalid call to IdType::at for ByteData" );
231
+ }
232
+
233
+ return std::get<ByteData>(_data).at (pos);
234
+ }
235
+
236
+ const std::uint8_t & IdType::operator [](size_t pos) const
237
+ {
238
+ if (!std::holds_alternative<ByteData>(_data))
239
+ {
240
+ throw std::logic_error (" Invalid call to IdType::operator[] for ByteData" );
241
+ }
242
+
243
+ return std::get<ByteData>(_data)[pos];
244
+ }
245
+
246
+ std::uint8_t & IdType::operator [](size_t pos)
247
+ {
248
+ if (!std::holds_alternative<ByteData>(_data))
249
+ {
250
+ throw std::logic_error (" Invalid call to IdType::operator[] for ByteData" );
251
+ }
252
+
253
+ return std::get<ByteData>(_data)[pos];
254
+ }
255
+
256
+ const std::uint8_t & IdType::front () const
257
+ {
258
+ if (!std::holds_alternative<ByteData>(_data))
259
+ {
260
+ throw std::logic_error (" Invalid call to IdType::front for ByteData" );
261
+ }
262
+
263
+ return std::get<ByteData>(_data).front ();
264
+ }
265
+
266
+ std::uint8_t & IdType::front ()
267
+ {
268
+ if (!std::holds_alternative<ByteData>(_data))
269
+ {
270
+ throw std::logic_error (" Invalid call to IdType::front for ByteData" );
271
+ }
272
+
273
+ return std::get<ByteData>(_data).front ();
274
+ }
275
+
276
+ const std::uint8_t & IdType::back () const
277
+ {
278
+ if (!std::holds_alternative<ByteData>(_data))
279
+ {
280
+ throw std::logic_error (" Invalid call to IdType::back for ByteData" );
281
+ }
282
+
283
+ return std::get<ByteData>(_data).back ();
284
+ }
285
+
286
+ std::uint8_t & IdType::back ()
287
+ {
288
+ if (!std::holds_alternative<ByteData>(_data))
289
+ {
290
+ throw std::logic_error (" Invalid call to IdType::back for ByteData" );
291
+ }
292
+
293
+ return std::get<ByteData>(_data).back ();
294
+ }
295
+
296
+ const std::uint8_t * IdType::data () const
297
+ {
298
+ if (!std::holds_alternative<ByteData>(_data))
299
+ {
300
+ throw std::logic_error (" Invalid call to IdType::data for ByteData" );
301
+ }
302
+
303
+ return std::get<ByteData>(_data).data ();
304
+ }
305
+
306
+ std::uint8_t * IdType::data ()
307
+ {
308
+ if (!std::holds_alternative<ByteData>(_data))
309
+ {
310
+ throw std::logic_error (" Invalid call to IdType::data for ByteData" );
311
+ }
312
+
313
+ return std::get<ByteData>(_data).data ();
314
+ }
315
+
316
+ IdType::ByteData::const_iterator IdType::begin () const
317
+ {
318
+ if (!std::holds_alternative<ByteData>(_data))
319
+ {
320
+ throw std::logic_error (" Invalid call to IdType::begin for ByteData" );
321
+ }
322
+
323
+ return std::get<ByteData>(_data).begin ();
324
+ }
325
+
326
+ IdType::ByteData::iterator IdType::begin ()
327
+ {
328
+ if (!std::holds_alternative<ByteData>(_data))
329
+ {
330
+ throw std::logic_error (" Invalid call to IdType::begin for ByteData" );
331
+ }
332
+
333
+ return std::get<ByteData>(_data).begin ();
334
+ }
335
+
336
+ IdType::ByteData::const_iterator IdType::cbegin () const
337
+ {
338
+ if (!std::holds_alternative<ByteData>(_data))
339
+ {
340
+ throw std::logic_error (" Invalid call to IdType::cbegin for ByteData" );
341
+ }
342
+
343
+ return std::get<ByteData>(_data).cbegin ();
344
+ }
345
+
346
+ IdType::ByteData::const_iterator IdType::end () const
347
+ {
348
+ if (!std::holds_alternative<ByteData>(_data))
349
+ {
350
+ throw std::logic_error (" Invalid call to IdType::end for ByteData" );
351
+ }
352
+
353
+ return std::get<ByteData>(_data).end ();
354
+ }
355
+
356
+ IdType::ByteData::iterator IdType::end ()
357
+ {
358
+ if (!std::holds_alternative<ByteData>(_data))
359
+ {
360
+ throw std::logic_error (" Invalid call to IdType::end for ByteData" );
361
+ }
362
+
363
+ return std::get<ByteData>(_data).end ();
364
+ }
365
+
366
+ IdType::ByteData::const_iterator IdType::cend () const
367
+ {
368
+ if (!std::holds_alternative<ByteData>(_data))
369
+ {
370
+ throw std::logic_error (" Invalid call to IdType::cend for ByteData" );
371
+ }
372
+
373
+ return std::get<ByteData>(_data).cend ();
374
+ }
375
+
376
+ IdType::ByteData::const_reverse_iterator IdType::rbegin () const
377
+ {
378
+ if (!std::holds_alternative<ByteData>(_data))
379
+ {
380
+ throw std::logic_error (" Invalid call to IdType::rbegin for ByteData" );
381
+ }
382
+
383
+ return std::get<ByteData>(_data).rbegin ();
384
+ }
385
+
386
+ IdType::ByteData::reverse_iterator IdType::rbegin ()
387
+ {
388
+ if (!std::holds_alternative<ByteData>(_data))
389
+ {
390
+ throw std::logic_error (" Invalid call to IdType::rbegin for ByteData" );
391
+ }
392
+
393
+ return std::get<ByteData>(_data).rbegin ();
394
+ }
395
+
396
+ IdType::ByteData::const_reverse_iterator IdType::crbegin () const
397
+ {
398
+ if (!std::holds_alternative<ByteData>(_data))
399
+ {
400
+ throw std::logic_error (" Invalid call to IdType::crbegin for ByteData" );
401
+ }
402
+
403
+ return std::get<ByteData>(_data).crbegin ();
404
+ }
405
+
406
+ IdType::ByteData::const_reverse_iterator IdType::rend () const
407
+ {
408
+ if (!std::holds_alternative<ByteData>(_data))
409
+ {
410
+ throw std::logic_error (" Invalid call to IdType::rend for ByteData" );
411
+ }
412
+
413
+ return std::get<ByteData>(_data).rend ();
414
+ }
415
+
416
+ IdType::ByteData::reverse_iterator IdType::rend ()
417
+ {
418
+ if (!std::holds_alternative<ByteData>(_data))
419
+ {
420
+ throw std::logic_error (" Invalid call to IdType::rend for ByteData" );
421
+ }
422
+
423
+ return std::get<ByteData>(_data).rend ();
424
+ }
425
+
426
+ IdType::ByteData::const_reverse_iterator IdType::crend () const
427
+ {
428
+ if (!std::holds_alternative<ByteData>(_data))
429
+ {
430
+ throw std::logic_error (" Invalid call to IdType::crend for ByteData" );
431
+ }
432
+
433
+ return std::get<ByteData>(_data).crend ();
434
+ }
435
+
436
+ const char * IdType::c_str () const
437
+ {
438
+ if (!std::holds_alternative<OpaqueString>(_data))
439
+ {
440
+ throw std::logic_error (" Invalid call to IdType::crend for OpaqueString" );
441
+ }
442
+
443
+ return std::get<OpaqueString>(_data).c_str ();
444
+ }
445
+
153
446
template <>
154
447
const IdType::ByteData& IdType::get<IdType::ByteData>() const
155
448
{
0 commit comments