Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
* Copyright (c) 2024 Muhammad Nawaz |
3 |
|
|
* Licensed under the MIT License. See LICENSE file for more information. |
4 |
|
|
*/ |
5 |
|
|
// [ END OF LICENSE c6bd0f49d040fca8d8a9cb05868e66aa63f0e2e0 ] |
6 |
|
|
|
7 |
|
|
#include "deserializers/base_deserializer.hpp" |
8 |
|
|
|
9 |
|
883 |
BaseDeserializer::BaseDeserializer(const std::string& param_name, char start, bool skip_name) |
10 |
|
883 |
: param_name_(param_name) |
11 |
|
883 |
, start_(start) |
12 |
|
883 |
, skip_name_(skip_name) |
13 |
|
|
{ |
14 |
|
883 |
} |
15 |
|
|
|
16 |
|
|
const std::array<char, 256> BaseDeserializer::kHexLookupTable = []() { |
17 |
|
|
std::array<char, 256> table{}; |
18 |
|
|
for (size_t i = 0; i < 256; ++i) { |
19 |
|
|
table[i] = (i >= '0' && i <= '9') ? static_cast<char>(i - '0') |
20 |
|
|
: (i >= 'A' && i <= 'F') ? static_cast<char>(i - 'A' + 10) |
21 |
|
|
: (i >= 'a' && i <= 'f') ? static_cast<char>(i - 'a' + 10) |
22 |
|
|
: static_cast<char>(-1); |
23 |
|
|
} |
24 |
|
|
return table; |
25 |
|
|
}(); |
26 |
|
|
|