Coverage Report

Created: 2025-06-13 06:46

/src/Fast-DDS/thirdparty/taocpp-pegtl/pegtl/position.hpp
Line
Count
Source (jump to first uncovered line)
1
// Copyright (c) 2014-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_POSITION_HPP
5
#define TAO_PEGTL_POSITION_HPP
6
7
#include <cstdlib>
8
#include <ostream>
9
#include <sstream>
10
#include <string>
11
#include <utility>
12
13
#include "config.hpp"
14
15
#include "internal/iterator.hpp"
16
17
namespace tao
18
{
19
   namespace TAO_PEGTL_NAMESPACE
20
   {
21
      struct position
22
      {
23
         template< typename T >
24
         position( const internal::iterator& in_iter, T&& in_source )
25
0
            : byte( in_iter.byte ),
26
0
              line( in_iter.line ),
27
0
              byte_in_line( in_iter.byte_in_line ),
28
0
              source( std::forward< T >( in_source ) )
29
0
         {
30
0
         }
31
32
         std::size_t byte;
33
         std::size_t line;
34
         std::size_t byte_in_line;
35
         std::string source;
36
      };
37
38
      inline std::ostream& operator<<( std::ostream& o, const position& p )
39
0
      {
40
0
         return o << p.source << ':' << p.line << ':' << p.byte_in_line << '(' << p.byte << ')';
41
0
      }
42
43
      inline std::string to_string( const position& p )
44
0
      {
45
0
         std::ostringstream o;
46
0
         o << p;
47
0
         return o.str();
48
0
      }
49
50
   }  // namespace TAO_PEGTL_NAMESPACE
51
52
}  // namespace tao
53
54
#endif