IN2OSM  1.0.1
CursorStreamWrapper< InputStream, Encoding >

Cursor stream wrapper for counting line and column number if error exists. More...

#include <cursorstreamwrapper.h>

Inheritance diagram for CursorStreamWrapper< InputStream, Encoding >:
Inheritance graph
Collaboration diagram for CursorStreamWrapper< InputStream, Encoding >:
Collaboration graph

Public Types

typedef Encoding::Ch Ch
 

Public Member Functions

 CursorStreamWrapper (InputStream &is)
 
Ch Take ()
 
size_t GetLine () const
 Get the error line number, if error exists. More...
 
size_t GetColumn () const
 Get the error column number, if error exists. More...
 
Ch Peek () const
 
size_t Tell ()
 
ChPutBegin ()
 
void Put (Ch ch)
 
void Flush ()
 
size_t PutEnd (Ch *ch)
 
const ChPeek4 () const
 
UTFType GetType () const
 
bool HasBOM () const
 

Protected Attributes

InputStream & is_
 

Private Attributes

size_t line_
 Current Line. More...
 
size_t col_
 Current Column. More...
 

Detailed Description

template<typename InputStream, typename Encoding = UTF8<>>
class CursorStreamWrapper< InputStream, Encoding >

Cursor stream wrapper for counting line and column number if error exists.

Template Parameters
InputStreamAny stream that implements Stream Concept

Definition at line 39 of file cursorstreamwrapper.h.

Member Typedef Documentation

◆ Ch

typedef Encoding::Ch Ch

Definition at line 41 of file cursorstreamwrapper.h.

Constructor & Destructor Documentation

◆ CursorStreamWrapper()

CursorStreamWrapper ( InputStream &  is)
inline

Definition at line 43 of file cursorstreamwrapper.h.

43  :
A Stream Wrapper.
Definition: stream.h:119
size_t col_
Current Column.
size_t line_
Current Line.

Member Function Documentation

◆ Flush()

void Flush ( )
inlineinherited

Definition at line 129 of file stream.h.

129 { is_.Flush(); }
InputStream & is_
Definition: stream.h:140

◆ GetColumn()

size_t GetColumn ( ) const
inline

Get the error column number, if error exists.

Definition at line 61 of file cursorstreamwrapper.h.

61 { return col_; }
size_t col_
Current Column.

◆ GetLine()

size_t GetLine ( ) const
inline

Get the error line number, if error exists.

Definition at line 59 of file cursorstreamwrapper.h.

59 { return line_; }
size_t line_
Current Line.

◆ GetType()

UTFType GetType ( ) const
inlineinherited

Definition at line 136 of file stream.h.

136 { return is_.GetType(); }
InputStream & is_
Definition: stream.h:140

◆ HasBOM()

bool HasBOM ( ) const
inlineinherited

Definition at line 137 of file stream.h.

137 { return is_.HasBOM(); }
InputStream & is_
Definition: stream.h:140

◆ Peek()

Ch Peek ( ) const
inlineinherited

Definition at line 124 of file stream.h.

124 { return is_.Peek(); }
InputStream & is_
Definition: stream.h:140

◆ Peek4()

const Ch* Peek4 ( ) const
inlineinherited

Definition at line 133 of file stream.h.

133 { return is_.Peek4(); }
InputStream & is_
Definition: stream.h:140

◆ Put()

void Put ( Ch  ch)
inlineinherited

Definition at line 128 of file stream.h.

128 { is_.Put(ch); }
InputStream & is_
Definition: stream.h:140

◆ PutBegin()

Ch* PutBegin ( )
inlineinherited

Definition at line 127 of file stream.h.

127 { return is_.PutBegin(); }
InputStream & is_
Definition: stream.h:140

◆ PutEnd()

size_t PutEnd ( Ch ch)
inlineinherited

Definition at line 130 of file stream.h.

130 { return is_.PutEnd(ch); }
InputStream & is_
Definition: stream.h:140

◆ Take()

Ch Take ( )
inline

Definition at line 47 of file cursorstreamwrapper.h.

47  {
48  Ch ch = this->is_.Take();
49  if(ch == '\n') {
50  line_ ++;
51  col_ = 0;
52  } else {
53  col_ ++;
54  }
55  return ch;
56  }
InputStream & is_
Definition: stream.h:140
size_t col_
Current Column.
size_t line_
Current Line.

◆ Tell()

size_t Tell ( )
inlineinherited

Definition at line 126 of file stream.h.

126 { return is_.Tell(); }
InputStream & is_
Definition: stream.h:140

Member Data Documentation

◆ col_

size_t col_
private

Current Column.

Definition at line 65 of file cursorstreamwrapper.h.

◆ is_

InputStream& is_
protectedinherited

Definition at line 140 of file stream.h.

◆ line_

size_t line_
private

Current Line.

Definition at line 64 of file cursorstreamwrapper.h.


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