Visualization Library 2.1.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes | List of all members
vl::TextStream Class Reference

The TextStream class can be used to conveniently read or parse utf8-encoded text files. More...

#include <TextStream.hpp>

+ Inheritance diagram for vl::TextStream:

Public Member Functions

 TextStream (VirtualFile *file=NULL)
 
 ~TextStream ()
 
void ungetLine (const std::string &utf8)
 
bool readLine (std::string &utf8)
 
bool readLine (String &line)
 Reads a CR or LF or CR/LF or LF/CR terminated line. More...
 
bool readLineCR (String &line)
 Reads a CR terminated line. More...
 
bool readLineLF (String &line)
 Reads a LF terminated line. More...
 
bool readInt (int &i, bool hex=false)
 
bool readDouble (double &d)
 
bool readString (String &token)
 
bool readStdString (std::string &token)
 
bool readQuotedString (String &token)
 
- Public Member Functions inherited from vl::BufferedStream< unsigned char, 128 *1024 >
 BufferedStream ()
 
void seek (long long pos)
 
bool readToken (unsigned char *token)
 
bool readTextChar (unsigned char &ch)
 
void ungetToken (const unsigned char &token)
 
bool bufferEmpty ()
 
int fillBuffer ()
 
bool isEndOfFile () const
 
void setInputFile (VirtualFile *file)
 
VirtualFileinputFile ()
 
const VirtualFileinputFile () const
 
- Public Member Functions inherited from vl::Object
 Object ()
 Constructor. More...
 
 Object (const Object &other)
 Copy constructor: copies the name, ref count mutex and user data. More...
 
Objectoperator= (const Object &other)
 Copy operator: copies the object's name, ref count mutex and user data. More...
 
const std::string & objectName () const
 The name of the object, by default set to the object's class name. More...
 
void setObjectName (const char *name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setObjectName (const std::string &name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setRefCountMutex (IMutex *mutex)
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () const
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
int referenceCount () const
 Returns the number of references of an object. More...
 
void incReference () const
 Increments the reference count of an object. More...
 
void decReference ()
 Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More...
 
void setAutomaticDelete (bool autodel_on)
 If set to true the Object is deleted when its reference count reaches 0. More...
 
bool automaticDelete () const
 If set to true the Object is deleted when its reference count reaches 0. More...
 
template<class T >
T * as ()
 Casts an Object to the specified class. More...
 
template<class T >
const T * as () const
 Casts an Object to the specified class. More...
 

Protected Attributes

String mTmpStr
 
std::string mTmpStdStr
 
- Protected Attributes inherited from vl::BufferedStream< unsigned char, 128 *1024 >
ref< VirtualFilemInputFile
 
std::vector< unsigned char > mUngetBuffer
 
std::vector< unsigned char > mBuffer
 
int mPtr
 
int mSize
 
bool mIsEndOfFile
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Additional Inherited Members

- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Detailed Description

The TextStream class can be used to conveniently read or parse utf8-encoded text files.

Definition at line 46 of file TextStream.hpp.

Constructor & Destructor Documentation

◆ TextStream()

vl::TextStream::TextStream ( VirtualFile file = NULL)
inline

Definition at line 51 of file TextStream.hpp.

◆ ~TextStream()

vl::TextStream::~TextStream ( )
inline

Definition at line 55 of file TextStream.hpp.

Member Function Documentation

◆ readDouble()

bool TextStream::readDouble ( double &  d)

Definition at line 50 of file TextStream.cpp.

References mTmpStdStr, and readStdString().

Referenced by vl::PlyLoader::PlyScalar::read().

◆ readInt()

bool TextStream::readInt ( int &  i,
bool  hex = false 
)

Definition at line 38 of file TextStream.cpp.

References mTmpStdStr, and readStdString().

Referenced by vl::PlyLoader::PlyScalar::read().

◆ readLine() [1/2]

bool vl::TextStream::readLine ( std::string &  utf8)
inline

◆ readLine() [2/2]

bool vl::TextStream::readLine ( String line)
inline

Reads a CR or LF or CR/LF or LF/CR terminated line.

Definition at line 93 of file TextStream.hpp.

References vl::String::clear(), vl::String::fromUTF8(), and vl::OM_ReadOnly.

◆ readLineCR()

bool vl::TextStream::readLineCR ( String line)
inline

Reads a CR terminated line.

Definition at line 123 of file TextStream.hpp.

References vl::String::clear(), vl::String::empty(), vl::String::fromUTF8(), and vl::OM_ReadOnly.

◆ readLineLF()

bool vl::TextStream::readLineLF ( String line)
inline

Reads a LF terminated line.

Definition at line 146 of file TextStream.hpp.

References vl::String::clear(), vl::String::empty(), vl::String::fromUTF8(), and vl::OM_ReadOnly.

Referenced by vl::PlyLoader::readHeader().

◆ readQuotedString()

bool vl::TextStream::readQuotedString ( String token)
inline

Definition at line 210 of file TextStream.hpp.

References vl::String::clear(), and vl::String::empty().

◆ readStdString()

bool vl::TextStream::readStdString ( std::string &  token)
inline

Definition at line 191 of file TextStream.hpp.

Referenced by readDouble(), and readInt().

◆ readString()

bool vl::TextStream::readString ( String token)
inline

Definition at line 172 of file TextStream.hpp.

References vl::String::clear(), and vl::String::empty().

◆ ungetLine()

void vl::TextStream::ungetLine ( const std::string &  utf8)
inline

Definition at line 61 of file TextStream.hpp.

Member Data Documentation

◆ mTmpStdStr

std::string vl::TextStream::mTmpStdStr
protected

Definition at line 236 of file TextStream.hpp.

Referenced by readDouble(), and readInt().

◆ mTmpStr

String vl::TextStream::mTmpStr
protected

Definition at line 235 of file TextStream.hpp.


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