Assimp  v3.1.1 (June 2014)
Assimp::LineSplitter Class Reference

Usage: More...

Public Types

typedef size_t line_idx
 

Public Member Functions

line_idx get_index () const
 
StreamReaderLEget_stream ()
 access the underlying stream object More...
 
template<size_t N>
void get_tokens (const char *(&tokens)[N]) const
 extract the start positions of N tokens from the current line More...
 
 LineSplitter (StreamReaderLE &stream, bool skip_empty_lines=true, bool trim=true)
 construct from existing stream reader note: trim is always assumed true if skyp_empty_lines==true More...
 
bool match_start (const char *check)
 !strcmp((*this)->substr(0,strlen(check)),check) More...
 
 operator bool () const
 boolean context More...
 
 operator line_idx () const
 line indices are zero-based, empty lines are included More...
 
std::string operator* () const
 
LineSplitteroperator++ ()
 pseudo-iterator increment More...
 
LineSplitteroperator++ (int)
 
const std::string * operator-> () const
 member access More...
 
const char * operator[] (size_t idx) const
 get a pointer to the beginning of a particular token More...
 
void swallow_next_increment ()
 swallow the next call to ++, return the previous value. More...
 
 ~LineSplitter ()
 

Detailed Description

Usage:

for(LineSplitter splitter(stream);splitter;++splitter) {
if (*splitter == "hi!") {
...
}
else if (splitter->substr(0,5) == "hello") {
...
// access the third token in the line (tokens are space-separated)
if (strtol(splitter[2]) > 5) { .. }
}
std::cout << "Current line is: " << splitter.get_index() << std::endl;
}

Member Typedef Documentation

◆ line_idx

Constructor & Destructor Documentation

◆ LineSplitter()

Assimp::LineSplitter::LineSplitter ( StreamReaderLE stream,
bool  skip_empty_lines = true,
bool  trim = true 
)
inline

construct from existing stream reader note: trim is always assumed true if skyp_empty_lines==true

◆ ~LineSplitter()

Assimp::LineSplitter::~LineSplitter ( )
inline

Member Function Documentation

◆ get_index()

line_idx Assimp::LineSplitter::get_index ( ) const
inline

◆ get_stream()

StreamReaderLE& Assimp::LineSplitter::get_stream ( )
inline

access the underlying stream object

◆ get_tokens()

template<size_t N>
void Assimp::LineSplitter::get_tokens ( const char *(&)  tokens[N]) const
inline

extract the start positions of N tokens from the current line

◆ match_start()

bool Assimp::LineSplitter::match_start ( const char *  check)
inline

!strcmp((*this)->substr(0,strlen(check)),check)

◆ operator bool()

Assimp::LineSplitter::operator bool ( ) const
inline

boolean context

◆ operator line_idx()

Assimp::LineSplitter::operator line_idx ( ) const
inline

line indices are zero-based, empty lines are included

◆ operator*()

std::string Assimp::LineSplitter::operator* ( ) const
inline

◆ operator++() [1/2]

LineSplitter& Assimp::LineSplitter::operator++ ( )
inline

pseudo-iterator increment

◆ operator++() [2/2]

LineSplitter& Assimp::LineSplitter::operator++ ( int  )
inline

◆ operator->()

const std::string* Assimp::LineSplitter::operator-> ( ) const
inline

member access

◆ operator[]()

const char* Assimp::LineSplitter::operator[] ( size_t  idx) const
inline

get a pointer to the beginning of a particular token

◆ swallow_next_increment()

void Assimp::LineSplitter::swallow_next_increment ( )
inline

swallow the next call to ++, return the previous value.


The documentation for this class was generated from the following file:
Assimp::LineSplitter::LineSplitter
LineSplitter(StreamReaderLE &stream, bool skip_empty_lines=true, bool trim=true)
construct from existing stream reader note: trim is always assumed true if skyp_empty_lines==true
Definition: LineSplitter.h:85