GeoTessCPP  2.2
Software to facilitate storage and retrieval of 3D information about the Earth.
Public Member Functions | List of all members
geotess::IFStreamAscii Class Reference

Opens ascii file for read and write access. More...

#include <IFStreamAscii.h>

Public Member Functions

 IFStreamAscii ()
 Default constructor. More...
 
virtual ~IFStreamAscii ()
 Destructor. More...
 
void close ()
 Close the input stream if it is open. More...
 
void flush ()
 Close the input stream if it is open. More...
 
const string & getBeginBlockCommentDelimiter () const
 Return the begin block comment delimiter string. More...
 
int getBlankLinesRead () const
 Return the current number of blank lines read from the input stream. More...
 
int getBlockCommentLinesRead () const
 Return the current number of block comment lines read from the input stream. More...
 
int getBytesRead () const
 Return the current number of bytes read from the input stream. More...
 
const string & getCommentDelimiter () const
 Return the comment delimiter string. More...
 
int getCommentLinesRead () const
 Return the current number of comment lines read from the input stream. More...
 
int getDataLinesRead () const
 Return the current number of data lines read from the input stream. More...
 
const string & getEndBlockCommentDelimiter () const
 Return the end block comment delimiter string. More...
 
const string & getFileName () const
 Return the opened file name. More...
 
void getLine (string &buf)
 Returns the next line in the input stream in the string buf. More...
 
void getline (string &s)
 Read a single line from the underlying istream. More...
 
const string & getStringDelimiter () const
 Return the string delimiter string. More...
 
int getTotalLinesRead () const
 Return the current number of total lines read from the input stream. More...
 
const string & getWhitespaceDelimiters () const
 Return the whitespace delimiter string. More...
 
bool isEOF () const
 Returns true if EOF is reached. More...
 
bool isOpen ()
 Returns true if the stream is open. More...
 
bool next ()
 Skips to the next token. More...
 
void openForRead (const string &fn)
 Open stream for read or write access. More...
 
void openForWrite (const string &fn)
 
bool read (string &token)
 Reads the next token (string) from the input file stream. More...
 
byte readByte ()
 Read and return the next byte. More...
 
bool readByte (byte &b)
 Read the next byte. More...
 
double readDouble ()
 Read and return the next double. More...
 
bool readDouble (double &d)
 Read the next double. More...
 
float readFloat ()
 Read and return the next float. More...
 
bool readFloat (float &f)
 Read the next float. More...
 
int readInteger ()
 Read and return the next int. More...
 
bool readInteger (int &i)
 Read the next int. More...
 
bool readLine (string &ln)
 Read a new line into ln from the stream. More...
 
LONG_INT readLong ()
 Read and return the next long. More...
 
bool readLong (LONG_INT &l)
 Read the next long. More...
 
short readShort ()
 Read and return the next short. More...
 
bool readShort (short &s)
 Read the next short. More...
 
string readString ()
 Read the next string. More...
 
bool readString (string &s)
 Read the next string. More...
 
bool readType (byte &b)
 Read the next byte. More...
 
bool readType (short &s)
 Read the next short. More...
 
bool readType (int &i)
 Read the next int. More...
 
bool readType (LONG_INT &l)
 Read the next long. More...
 
bool readType (float &f)
 Read the next float. More...
 
bool readType (double &d)
 Read the next double. More...
 
void resetReader ()
 Resets all parameters back to their initial state (excluding delimiters). More...
 
void setBeginBlockCommentDelimiter (const string &begBlkCmntDelim)
 Set the begin block comment delimiter string. More...
 
void setBlockCommentDelimiters (const string &begBlk, const string &endBlk)
 Sets the begin and end block comment strings for this IFStreamAscii object. More...
 
void setCommentDelimiter (const string &cmntDelim)
 Set the comment delimiter string. More...
 
void setDefaultDelimiters ()
 Sets the default delimiter settings. More...
 
void setDelimiters (const string &wspcDelims, const string &strgDelim, const string &cmntDelim, const string &begBlk, const string &endBlk)
 Sets the whitespace, string, comment, and block comment delimiters for this IFStreamAscii object. More...
 
void setEndBlockCommentDelimiter (const string &endBlkCmntDelim)
 Set the end block comment delimiter string. More...
 
void setStringDelimiter (const string &strgDelim)
 Set the string delimiter string. More...
 
void setWhitespaceDelimiters (const string &wsDelims)
 Set the whitespace delimiter string. More...
 
void tokenize (const string &str, vector< string > &tokens)
 Tokenize the input string (str) and place the tokens into the input array list. More...
 
void writeBool (bool b)
 
void writeBoolNL (bool b)
 
void writeByte (byte b)
 
void writeByteNL (byte b)
 
void writeDouble (double d)
 
void writeDoubleNL (double d)
 
void writeFloat (float f)
 
void writeFloatNL (float f)
 
void writeInt (int i)
 
void writeIntNL (int i)
 
void writeLong (LONG_INT l)
 
void writeLongNL (LONG_INT l)
 
void writeNL ()
 
void writeShort (short s)
 
void writeShortNL (short s)
 
void writeString (const string &s)
 
void writeStringNL (const string &s)
 
void writeType (const string &s)
 
void writeType (bool b)
 
void writeType (byte b)
 
void writeType (short s)
 
void writeType (int i)
 
void writeType (LONG_INT l)
 
void writeType (float f)
 
void writeType (double d)
 
void writeTypeNL (const string &s)
 
void writeTypeNL (bool b)
 
void writeTypeNL (byte b)
 
void writeTypeNL (short s)
 
void writeTypeNL (int i)
 
void writeTypeNL (LONG_INT l)
 
void writeTypeNL (float f)
 
void writeTypeNL (double d)
 

Detailed Description

Opens ascii file for read and write access.

Opens ascii file for read and write access. The read portion is configured to parse generically formatted ascii files from an input stream.

Functionality is provided to read elemental, strings, booleans, bytes, shorts, ints, longs, floats, or doubles, as-well-as array input forms of each (except strings). Alternatively, indivdual lines can be read and parsed by the caller if desired. To perform elemental reads a tokenized scanner is provided that must be configured by the user with a White-Space (WS) definition. The WS delimiters default to a space, tab, and a comma. A single comment line delimiter and block comment start and end delimiters can also be set by the caller. These default to "//", "slash-*", and '*-slash" respectively.

Constructor & Destructor Documentation

geotess::IFStreamAscii::IFStreamAscii ( )
inline

Default constructor.

virtual geotess::IFStreamAscii::~IFStreamAscii ( )
inlinevirtual

Destructor.

Member Function Documentation

void geotess::IFStreamAscii::close ( )
inline

Close the input stream if it is open.

void geotess::IFStreamAscii::flush ( )
inline

Close the input stream if it is open.

const string& geotess::IFStreamAscii::getBeginBlockCommentDelimiter ( ) const
inline

Return the begin block comment delimiter string.

int geotess::IFStreamAscii::getBlankLinesRead ( ) const
inline

Return the current number of blank lines read from the input stream.

int geotess::IFStreamAscii::getBlockCommentLinesRead ( ) const
inline

Return the current number of block comment lines read from the input stream.

int geotess::IFStreamAscii::getBytesRead ( ) const
inline

Return the current number of bytes read from the input stream.

const string& geotess::IFStreamAscii::getCommentDelimiter ( ) const
inline

Return the comment delimiter string.

int geotess::IFStreamAscii::getCommentLinesRead ( ) const
inline

Return the current number of comment lines read from the input stream.

int geotess::IFStreamAscii::getDataLinesRead ( ) const
inline

Return the current number of data lines read from the input stream.

const string& geotess::IFStreamAscii::getEndBlockCommentDelimiter ( ) const
inline

Return the end block comment delimiter string.

const string& geotess::IFStreamAscii::getFileName ( ) const
inline

Return the opened file name.

void geotess::IFStreamAscii::getLine ( string &  buf)

Returns the next line in the input stream in the string buf.

void geotess::IFStreamAscii::getline ( string &  s)
inline

Read a single line from the underlying istream.

Added by sballar 2013-03-22.

const string& geotess::IFStreamAscii::getStringDelimiter ( ) const
inline

Return the string delimiter string.

int geotess::IFStreamAscii::getTotalLinesRead ( ) const
inline

Return the current number of total lines read from the input stream.

const string& geotess::IFStreamAscii::getWhitespaceDelimiters ( ) const
inline

Return the whitespace delimiter string.

bool geotess::IFStreamAscii::isEOF ( ) const
inline

Returns true if EOF is reached.

bool geotess::IFStreamAscii::isOpen ( )
inline

Returns true if the stream is open.

bool geotess::IFStreamAscii::next ( )
inline

Skips to the next token.

Read the next string.

Return true if SUCCESSFUL

void geotess::IFStreamAscii::openForRead ( const string &  fn)

Open stream for read or write access.

void geotess::IFStreamAscii::openForWrite ( const string &  fn)
bool geotess::IFStreamAscii::read ( string &  token)
inline

Reads the next token (string) from the input file stream.

Reads and returns a single token from the stream.

If eof() occurs false is returned. Otherwise true is returned.

The new token is contained in the input string reference token. The function returns true if successful. If eof() is reached false is returned.

byte geotess::IFStreamAscii::readByte ( )
inline

Read and return the next byte.

bool geotess::IFStreamAscii::readByte ( byte b)
inline

Read the next byte.

Return true if SUCCESSFUL

double geotess::IFStreamAscii::readDouble ( )
inline

Read and return the next double.

bool geotess::IFStreamAscii::readDouble ( double &  d)
inline

Read the next double.

Return true if SUCCESSFUL

float geotess::IFStreamAscii::readFloat ( )
inline

Read and return the next float.

bool geotess::IFStreamAscii::readFloat ( float &  f)
inline

Read the next float.

Return true if SUCCESSFUL

int geotess::IFStreamAscii::readInteger ( )
inline

Read and return the next int.

bool geotess::IFStreamAscii::readInteger ( int &  i)
inline

Read the next int.

Return true if SUCCESSFUL

bool geotess::IFStreamAscii::readLine ( string &  ln)

Read a new line into ln from the stream.

If eof() then return false. Otherwise return true.

LONG_INT geotess::IFStreamAscii::readLong ( )
inline

Read and return the next long.

bool geotess::IFStreamAscii::readLong ( LONG_INT l)
inline

Read the next long.

Return true if SUCCESSFUL

short geotess::IFStreamAscii::readShort ( )
inline

Read and return the next short.

bool geotess::IFStreamAscii::readShort ( short &  s)
inline

Read the next short.

Return true if SUCCESSFUL

string geotess::IFStreamAscii::readString ( )
inline

Read the next string.

Return true if SUCCESSFUL

bool geotess::IFStreamAscii::readString ( string &  s)
inline

Read the next string.

Return true if SUCCESSFUL

bool geotess::IFStreamAscii::readType ( byte b)
inline

Read the next byte.

Return true if SUCCESSFUL

bool geotess::IFStreamAscii::readType ( short &  s)
inline

Read the next short.

Return true if SUCCESSFUL

bool geotess::IFStreamAscii::readType ( int &  i)
inline

Read the next int.

Return true if SUCCESSFUL

bool geotess::IFStreamAscii::readType ( LONG_INT l)
inline

Read the next long.

Return true if SUCCESSFUL

bool geotess::IFStreamAscii::readType ( float &  f)
inline

Read the next float.

Return true if SUCCESSFUL

bool geotess::IFStreamAscii::readType ( double &  d)
inline

Read the next double.

Return true if SUCCESSFUL

void geotess::IFStreamAscii::resetReader ( )

Resets all parameters back to their initial state (excluding delimiters).

void geotess::IFStreamAscii::setBeginBlockCommentDelimiter ( const string &  begBlkCmntDelim)
inline

Set the begin block comment delimiter string.

void geotess::IFStreamAscii::setBlockCommentDelimiters ( const string &  begBlk,
const string &  endBlk 
)
inline

Sets the begin and end block comment strings for this IFStreamAscii object.

void geotess::IFStreamAscii::setCommentDelimiter ( const string &  cmntDelim)
inline

Set the comment delimiter string.

void geotess::IFStreamAscii::setDefaultDelimiters ( )

Sets the default delimiter settings.

void geotess::IFStreamAscii::setDelimiters ( const string &  wspcDelims,
const string &  strgDelim,
const string &  cmntDelim,
const string &  begBlk,
const string &  endBlk 
)
inline

Sets the whitespace, string, comment, and block comment delimiters for this IFStreamAscii object.

void geotess::IFStreamAscii::setEndBlockCommentDelimiter ( const string &  endBlkCmntDelim)
inline

Set the end block comment delimiter string.

void geotess::IFStreamAscii::setStringDelimiter ( const string &  strgDelim)
inline

Set the string delimiter string.

void geotess::IFStreamAscii::setWhitespaceDelimiters ( const string &  wsDelims)
inline

Set the whitespace delimiter string.

void geotess::IFStreamAscii::tokenize ( const string &  str,
vector< string > &  tokens 
)

Tokenize the input string (str) and place the tokens into the input array list.

void geotess::IFStreamAscii::writeBool ( bool  b)
inline
void geotess::IFStreamAscii::writeBoolNL ( bool  b)
inline
void geotess::IFStreamAscii::writeByte ( byte  b)
inline
void geotess::IFStreamAscii::writeByteNL ( byte  b)
inline
void geotess::IFStreamAscii::writeDouble ( double  d)
inline
void geotess::IFStreamAscii::writeDoubleNL ( double  d)
inline
void geotess::IFStreamAscii::writeFloat ( float  f)
inline
void geotess::IFStreamAscii::writeFloatNL ( float  f)
inline
void geotess::IFStreamAscii::writeInt ( int  i)
inline
void geotess::IFStreamAscii::writeIntNL ( int  i)
inline
void geotess::IFStreamAscii::writeLong ( LONG_INT  l)
inline
void geotess::IFStreamAscii::writeLongNL ( LONG_INT  l)
inline
void geotess::IFStreamAscii::writeNL ( )
inline
void geotess::IFStreamAscii::writeShort ( short  s)
inline
void geotess::IFStreamAscii::writeShortNL ( short  s)
inline
void geotess::IFStreamAscii::writeString ( const string &  s)
inline
void geotess::IFStreamAscii::writeStringNL ( const string &  s)
inline
void geotess::IFStreamAscii::writeType ( const string &  s)
inline
void geotess::IFStreamAscii::writeType ( bool  b)
inline
void geotess::IFStreamAscii::writeType ( byte  b)
inline
void geotess::IFStreamAscii::writeType ( short  s)
inline
void geotess::IFStreamAscii::writeType ( int  i)
inline
void geotess::IFStreamAscii::writeType ( LONG_INT  l)
inline
void geotess::IFStreamAscii::writeType ( float  f)
inline
void geotess::IFStreamAscii::writeType ( double  d)
inline
void geotess::IFStreamAscii::writeTypeNL ( const string &  s)
inline
void geotess::IFStreamAscii::writeTypeNL ( bool  b)
inline
void geotess::IFStreamAscii::writeTypeNL ( byte  b)
inline
void geotess::IFStreamAscii::writeTypeNL ( short  s)
inline
void geotess::IFStreamAscii::writeTypeNL ( int  i)
inline
void geotess::IFStreamAscii::writeTypeNL ( LONG_INT  l)
inline
void geotess::IFStreamAscii::writeTypeNL ( float  f)
inline
void geotess::IFStreamAscii::writeTypeNL ( double  d)
inline

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