/src/spotify-json/src/detail/skip_chars.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2015-2016 Spotify AB |
3 | | * |
4 | | * Licensed under the Apache License, Version 2.0 (the "License"); you may not |
5 | | * use this file except in compliance with the License. You may obtain a copy of |
6 | | * the License at |
7 | | * |
8 | | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | | * |
10 | | * Unless required by applicable law or agreed to in writing, software |
11 | | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
12 | | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
13 | | * License for the specific language governing permissions and limitations under |
14 | | * the License. |
15 | | */ |
16 | | |
17 | | #include <spotify/json/detail/skip_chars.hpp> |
18 | | |
19 | | #include <spotify/json/detail/macros.hpp> |
20 | | |
21 | | #include "skip_chars_common.hpp" |
22 | | |
23 | | namespace spotify { |
24 | | namespace json { |
25 | | namespace detail { |
26 | | |
27 | 0 | void skip_any_simple_characters_scalar(decode_context &context) { |
28 | 0 | const auto end = context.end; |
29 | 0 | auto pos = context.position; |
30 | 0 | JSON_STRING_SKIP_N_SIMPLE(1, 2, uint8_t, if, done_x) |
31 | 0 | JSON_STRING_SKIP_N_SIMPLE(2, 4, uint16_t, if, done_2) |
32 | 0 | JSON_STRING_SKIP_N_SIMPLE(4, 8, uint32_t, if, done_4) |
33 | 0 | JSON_STRING_SKIP_N_SIMPLE(8, x, uint64_t, while, done_8) |
34 | 0 | done_8: JSON_STRING_SKIP_N_SIMPLE(4, x, uint32_t, while, done_4) |
35 | 0 | done_4: JSON_STRING_SKIP_N_SIMPLE(2, x, uint16_t, while, done_2) |
36 | 0 | done_2: JSON_STRING_SKIP_N_SIMPLE(1, x, uint8_t, while, done_x) |
37 | 0 | done_x: context.position = pos; |
38 | 0 | } |
39 | | |
40 | 2.35k | void skip_any_whitespace_scalar(decode_context &context) { |
41 | 2.35k | const auto end = context.end; |
42 | 2.35k | auto pos = context.position; |
43 | 3.36k | while (pos < end && is_space(*pos)) { |
44 | 1.01k | ++pos; |
45 | 1.01k | } |
46 | 2.35k | context.position = pos; |
47 | 2.35k | } |
48 | | |
49 | | } // namespace detail |
50 | | } // namespace json |
51 | | } // namespace spotify |