GeoTessCPP  2.1
Software to facilitate storage and retrieval of 3D information about the Earth.
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Public Member Functions | List of all members
geotess::IFStreamAscii Class Reference

#include <IFStreamAscii.h>

Public Member Functions

 IFStreamAscii ()
 
virtual ~IFStreamAscii ()
 
void close ()
 
void flush ()
 
const string & getBeginBlockCommentDelimiter () const
 
int getBlankLinesRead () const
 
int getBlockCommentLinesRead () const
 
int getBytesRead () const
 
const string & getCommentDelimiter () const
 
int getCommentLinesRead () const
 
int getDataLinesRead () const
 
const string & getEndBlockCommentDelimiter () const
 
const string & getFileName () const
 
void getLine (string &buf)
 
void getline (string &s)
 
const string & getStringDelimiter () const
 
int getTotalLinesRead () const
 
const string & getWhitespaceDelimiters () const
 
bool isEOF () const
 
bool isOpen ()
 
bool next ()
 
void openForRead (const string &fn)
 
void openForWrite (const string &fn)
 
bool read (string &token)
 
byte readByte ()
 
bool readByte (byte &b)
 
double readDouble ()
 
bool readDouble (double &d)
 
float readFloat ()
 
bool readFloat (float &f)
 
int readInteger ()
 
bool readInteger (int &i)
 
bool readLine (string &ln)
 
LONG_INT readLong ()
 
bool readLong (LONG_INT &l)
 
short readShort ()
 
bool readShort (short &s)
 
string readString ()
 
bool readString (string &s)
 
bool readType (byte &b)
 
bool readType (short &s)
 
bool readType (int &i)
 
bool readType (LONG_INT &l)
 
bool readType (float &f)
 
bool readType (double &d)
 
void resetReader ()
 
void setBeginBlockCommentDelimiter (const string &begBlkCmntDelim)
 
void setBlockCommentDelimiters (const string &begBlk, const string &endBlk)
 
void setCommentDelimiter (const string &cmntDelim)
 
void setDefaultDelimiters ()
 
void setDelimiters (const string &wspcDelims, const string &strgDelim, const string &cmntDelim, const string &begBlk, const string &endBlk)
 
void setEndBlockCommentDelimiter (const string &endBlkCmntDelim)
 
void setStringDelimiter (const string &strgDelim)
 
void setWhitespaceDelimiters (const string &wsDelims)
 
void tokenize (const string &str, vector< string > &tokens)
 
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. 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. If eof() occurs false is returned. Otherwise true is returned.

Reads and returns a single token from the stream.

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: