/src/Fast-DDS/thirdparty/taocpp-pegtl/pegtl/internal/bump.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (c) 2017-2020 Dr. Colin Hirsch and Daniel Frey |
2 | | // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ |
3 | | |
4 | | #ifndef TAO_PEGTL_INTERNAL_BUMP_HPP |
5 | | #define TAO_PEGTL_INTERNAL_BUMP_HPP |
6 | | |
7 | | #include "../config.hpp" |
8 | | |
9 | | #include "iterator.hpp" |
10 | | |
11 | | namespace tao |
12 | | { |
13 | | namespace TAO_PEGTL_NAMESPACE |
14 | | { |
15 | | namespace internal |
16 | | { |
17 | | inline void bump( iterator& iter, const std::size_t count, const int ch ) noexcept |
18 | 0 | { |
19 | 0 | for( std::size_t i = 0; i < count; ++i ) { |
20 | 0 | if( iter.data[ i ] == ch ) { |
21 | 0 | ++iter.line; |
22 | 0 | iter.byte_in_line = 0; |
23 | 0 | } |
24 | 0 | else { |
25 | 0 | ++iter.byte_in_line; |
26 | 0 | } |
27 | 0 | } |
28 | 0 | iter.byte += count; |
29 | 0 | iter.data += count; |
30 | 0 | } |
31 | | |
32 | | inline void bump_in_this_line( iterator& iter, const std::size_t count ) noexcept |
33 | 0 | { |
34 | 0 | iter.data += count; |
35 | 0 | iter.byte += count; |
36 | 0 | iter.byte_in_line += count; |
37 | 0 | } |
38 | | |
39 | | inline void bump_to_next_line( iterator& iter, const std::size_t count ) noexcept |
40 | 0 | { |
41 | 0 | ++iter.line; |
42 | 0 | iter.byte += count; |
43 | 0 | iter.byte_in_line = 0; |
44 | 0 | iter.data += count; |
45 | 0 | } |
46 | | |
47 | | } // namespace internal |
48 | | |
49 | | } // namespace TAO_PEGTL_NAMESPACE |
50 | | |
51 | | } // namespace tao |
52 | | |
53 | | #endif |