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

#include <IFStreamAscii.h>

List of all members.

Public Member Functions

void getLine (string &buf)
 IFStreamAscii ()
virtual ~IFStreamAscii ()
void openForRead (const string &fn)
void openForWrite (const string &fn)
bool isOpen ()
void close ()
void flush ()
bool read (string &token)
bool readLine (string &ln)
void tokenize (const string &str, vector< string > &tokens)
const string & getFileName () const
void setDefaultDelimiters ()
void resetReader ()
void setDelimiters (const string &wspcDelims, const string &strgDelim, const string &cmntDelim, const string &begBlk, const string &endBlk)
void setWhitespaceDelimiters (const string &wsDelims)
const string & getWhitespaceDelimiters () const
void setStringDelimiter (const string &strgDelim)
const string & getStringDelimiter () const
void setCommentDelimiter (const string &cmntDelim)
const string & getCommentDelimiter () const
void setBlockCommentDelimiters (const string &begBlk, const string &endBlk)
void setBeginBlockCommentDelimiter (const string &begBlkCmntDelim)
const string & getBeginBlockCommentDelimiter () const
void setEndBlockCommentDelimiter (const string &endBlkCmntDelim)
const string & getEndBlockCommentDelimiter () const
int getTotalLinesRead () const
int getDataLinesRead () const
int getBlankLinesRead () const
int getCommentLinesRead () const
int getBlockCommentLinesRead () const
int getBytesRead () const
bool isEOF () const
bool next ()
string readString ()
bool readString (string &s)
byte readByte ()
bool readType (byte &b)
bool readByte (byte &b)
short readShort ()
bool readType (short &s)
bool readShort (short &s)
int readInteger ()
bool readType (int &i)
bool readInteger (int &i)
LONG_INT readLong ()
bool readType (LONG_INT &l)
bool readLong (LONG_INT &l)
float readFloat ()
bool readType (float &f)
bool readFloat (float &f)
double readDouble ()
bool readType (double &d)
bool readDouble (double &d)
void writeString (const string &s)
void writeStringNL (const string &s)
void writeType (const string &s)
void writeTypeNL (const string &s)
void writeBool (bool b)
void writeBoolNL (bool b)
void writeType (bool b)
void writeTypeNL (bool b)
void writeByte (byte b)
void writeByteNL (byte b)
void writeType (byte b)
void writeTypeNL (byte b)
void writeShort (short s)
void writeShortNL (short s)
void writeType (short s)
void writeTypeNL (short s)
void writeInt (int i)
void writeIntNL (int i)
void writeType (int i)
void writeTypeNL (int i)
void writeLong (LONG_INT l)
void writeLongNL (LONG_INT l)
void writeType (LONG_INT l)
void writeTypeNL (LONG_INT l)
void writeFloat (float f)
void writeFloatNL (float f)
void writeType (float f)
void writeTypeNL (float f)
void writeDouble (double d)
void writeDoubleNL (double d)
void writeType (double d)
void writeTypeNL (double d)
void writeNL ()

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.

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: