g2o
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Static Private Member Functions | List of all members
SlamParser::position Class Reference

A point in a source file. More...

#include <location.hh>

Public Types

typedef const std::string filename_type
 Type for file name.
 
typedef int counter_type
 Type for line and column numbers.
 

Public Member Functions

 position (filename_type *f=YY_NULLPTR, counter_type l=1, counter_type c=1)
 Construct a position.
 
void initialize (filename_type *fn=YY_NULLPTR, counter_type l=1, counter_type c=1)
 Initialization.
 
Line and Column related manipulators
void lines (counter_type count=1)
 (line related) Advance to the COUNT next lines.
 
void columns (counter_type count=1)
 (column related) Advance to the COUNT next columns.
 

Public Attributes

filename_typefilename
 File name to which this position refers.
 
counter_type line
 Current line number.
 
counter_type column
 Current column number.
 

Static Private Member Functions

static counter_type add_ (counter_type lhs, counter_type rhs, counter_type min)
 Compute max (min, lhs+rhs).
 

Detailed Description

A point in a source file.

Definition at line 60 of file location.hh.

Member Typedef Documentation

◆ counter_type

Type for line and column numbers.

Definition at line 65 of file location.hh.

◆ filename_type

typedef const std::string SlamParser::position::filename_type

Type for file name.

Definition at line 63 of file location.hh.

Constructor & Destructor Documentation

◆ position()

SlamParser::position::position ( filename_type f = YY_NULLPTR,
counter_type  l = 1,
counter_type  c = 1 
)
inlineexplicit

Construct a position.

Definition at line 68 of file location.hh.

70 : filename(f), line(l), column(c) {}
filename_type * filename
File name to which this position refers.
Definition location.hh:95
counter_type column
Current column number.
Definition location.hh:99
counter_type line
Current line number.
Definition location.hh:97

Member Function Documentation

◆ add_()

static counter_type SlamParser::position::add_ ( counter_type  lhs,
counter_type  rhs,
counter_type  min 
)
inlinestaticprivate

Compute max (min, lhs+rhs).

Definition at line 103 of file location.hh.

104 {
105 return lhs + rhs < min ? min : lhs + rhs;
106 }

Referenced by columns(), and lines().

◆ columns()

void SlamParser::position::columns ( counter_type  count = 1)
inline

(column related) Advance to the COUNT next columns.

Definition at line 91 of file location.hh.

91{ column = add_(column, count, 1); }
static counter_type add_(counter_type lhs, counter_type rhs, counter_type min)
Compute max (min, lhs+rhs).
Definition location.hh:103

References add_(), and column.

Referenced by SlamParser::operator+=().

◆ initialize()

void SlamParser::position::initialize ( filename_type fn = YY_NULLPTR,
counter_type  l = 1,
counter_type  c = 1 
)
inline

Initialization.

Definition at line 73 of file location.hh.

74 {
75 filename = fn;
76 line = l;
77 column = c;
78 }

References column, filename, and line.

Referenced by SlamParser::location::initialize().

◆ lines()

void SlamParser::position::lines ( counter_type  count = 1)
inline

(line related) Advance to the COUNT next lines.

Definition at line 83 of file location.hh.

83 {
84 if (count) {
85 column = 1;
86 line = add_(line, count, 1);
87 }
88 }

References add_(), column, and line.

Referenced by SlamParser::location::lines().

Member Data Documentation

◆ column

counter_type SlamParser::position::column

Current column number.

Definition at line 99 of file location.hh.

Referenced by columns(), initialize(), and lines().

◆ filename

filename_type* SlamParser::position::filename

File name to which this position refers.

Definition at line 95 of file location.hh.

Referenced by initialize(), and SlamParser::Parser::parse().

◆ line

counter_type SlamParser::position::line

Current line number.

Definition at line 97 of file location.hh.

Referenced by initialize(), and lines().


The documentation for this class was generated from the following file: