Path Tracer
Public Types | Public Member Functions | List of all members
Assimp::LineSplitter Class Reference

#include <LineSplitter.h>

Public Types

typedef size_t line_idx
 

Public Member Functions

 LineSplitter (StreamReaderLE &stream, bool skip_empty_lines=true, bool trim=true)
 
LineSplitteroperator++ ()
 
LineSplitteroperator++ (int)
 
const char * operator[] (size_t idx) const
 
template<size_t N>
void get_tokens (const char *(&tokens)[N]) const
 
const std::string * operator-> () const
 
std::string operator* () const
 
 operator bool () const
 
 operator line_idx () const
 
line_idx get_index () const
 
StreamReaderLEget_stream ()
 
bool match_start (const char *check)
 
void swallow_next_increment ()
 
 LineSplitter (const LineSplitter &)=delete
 
 LineSplitter (LineSplitter &&)=delete
 
LineSplitteroperator= (const LineSplitter &)=delete
 
template<size_t N>
AI_FORCE_INLINE void get_tokens (const char *(&tokens)[N]) const
 

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) { .. }
}
ASSIMP_LOG_VERBOSE_DEBUG_F("Current line is: ", splitter.get_index());
}

Constructor & Destructor Documentation

◆ LineSplitter()

AI_FORCE_INLINE Assimp::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

Member Function Documentation

◆ get_stream()

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

access the underlying stream object

◆ get_tokens()

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

extract the start positions of N tokens from the current line

◆ match_start()

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

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

◆ operator bool()

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

boolean context

◆ operator line_idx()

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

line indices are zero-based, empty lines are included

◆ operator++()

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

pseudo-iterator increment

◆ operator->()

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

member access

◆ operator[]()

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

get a pointer to the beginning of a particular token

◆ swallow_next_increment()

AI_FORCE_INLINE void Assimp::LineSplitter::swallow_next_increment ( )

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)
Definition: LineSplitter.h:148