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

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

#include <IFStreamAscii.h>

Public Member Functions

void getLine (string &buf)
 
void getline (string &s)
 
 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.

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.

Definition at line 80 of file IFStreamAscii.h.

Constructor & Destructor Documentation

◆ IFStreamAscii()

geotess::IFStreamAscii::IFStreamAscii ( )
inline

Default constructor.

Definition at line 172 of file IFStreamAscii.h.

◆ ~IFStreamAscii()

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

Destructor.

Definition at line 182 of file IFStreamAscii.h.

Member Function Documentation

◆ close()

void geotess::IFStreamAscii::close ( )
inline

Close the input stream if it is open.

Definition at line 198 of file IFStreamAscii.h.

◆ flush()

void geotess::IFStreamAscii::flush ( )
inline

Close the input stream if it is open.

Definition at line 209 of file IFStreamAscii.h.

◆ getBeginBlockCommentDelimiter()

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

Return the begin block comment delimiter string.

Definition at line 321 of file IFStreamAscii.h.

◆ getBlankLinesRead()

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

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

Definition at line 351 of file IFStreamAscii.h.

◆ getBlockCommentLinesRead()

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

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

Definition at line 363 of file IFStreamAscii.h.

◆ getBytesRead()

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

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

Definition at line 369 of file IFStreamAscii.h.

◆ getCommentDelimiter()

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

Return the comment delimiter string.

Definition at line 298 of file IFStreamAscii.h.

◆ getCommentLinesRead()

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

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

Definition at line 357 of file IFStreamAscii.h.

◆ getDataLinesRead()

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

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

Definition at line 345 of file IFStreamAscii.h.

◆ getEndBlockCommentDelimiter()

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

Return the end block comment delimiter string.

Definition at line 333 of file IFStreamAscii.h.

◆ getFileName()

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

Return the opened file name.

Definition at line 236 of file IFStreamAscii.h.

◆ getLine()

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

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

◆ getline()

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

Read a single line from the underlying istream. Added by sballar 2013-03-22.

Definition at line 167 of file IFStreamAscii.h.

◆ getStringDelimiter()

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

Return the string delimiter string.

Definition at line 286 of file IFStreamAscii.h.

◆ getTotalLinesRead()

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

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

Definition at line 339 of file IFStreamAscii.h.

◆ getWhitespaceDelimiters()

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

Return the whitespace delimiter string.

Definition at line 274 of file IFStreamAscii.h.

◆ isEOF()

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

Returns true if EOF is reached.

Definition at line 558 of file IFStreamAscii.h.

◆ isOpen()

bool geotess::IFStreamAscii::isOpen ( )
inline

Returns true if the stream is open.

Definition at line 193 of file IFStreamAscii.h.

◆ next()

bool geotess::IFStreamAscii::next ( )
inline

Skips to the next token.

Read the next string. Return true if SUCCESSFUL

Definition at line 584 of file IFStreamAscii.h.

◆ openForRead()

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

Open stream for read or write access.

◆ openForWrite()

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

◆ read()

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.

Definition at line 526 of file IFStreamAscii.h.

◆ readByte() [1/2]

byte geotess::IFStreamAscii::readByte ( )
inline

Read and return the next byte.

Definition at line 593 of file IFStreamAscii.h.

◆ readByte() [2/2]

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

Read the next byte. Return true if SUCCESSFUL

Definition at line 603 of file IFStreamAscii.h.

◆ readDouble() [1/2]

double geotess::IFStreamAscii::readDouble ( )
inline

Read and return the next double.

Definition at line 778 of file IFStreamAscii.h.

◆ readDouble() [2/2]

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

Read the next double. Return true if SUCCESSFUL

Definition at line 788 of file IFStreamAscii.h.

◆ readFloat() [1/2]

float geotess::IFStreamAscii::readFloat ( )
inline

Read and return the next float.

Definition at line 741 of file IFStreamAscii.h.

◆ readFloat() [2/2]

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

Read the next float. Return true if SUCCESSFUL

Definition at line 751 of file IFStreamAscii.h.

◆ readInteger() [1/2]

int geotess::IFStreamAscii::readInteger ( )
inline

Read and return the next int.

Definition at line 667 of file IFStreamAscii.h.

◆ readInteger() [2/2]

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

Read the next int. Return true if SUCCESSFUL

Definition at line 677 of file IFStreamAscii.h.

◆ readLine()

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

Read a new line into ln from the stream. If eof() then return false. Otherwise return true.

◆ readLong() [1/2]

LONG_INT geotess::IFStreamAscii::readLong ( )
inline

Read and return the next long.

Definition at line 704 of file IFStreamAscii.h.

◆ readLong() [2/2]

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

Read the next long. Return true if SUCCESSFUL

Definition at line 714 of file IFStreamAscii.h.

◆ readShort() [1/2]

short geotess::IFStreamAscii::readShort ( )
inline

Read and return the next short.

Definition at line 630 of file IFStreamAscii.h.

◆ readShort() [2/2]

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

Read the next short. Return true if SUCCESSFUL

Definition at line 640 of file IFStreamAscii.h.

◆ readString() [1/2]

string geotess::IFStreamAscii::readString ( )
inline

Read the next string. Return true if SUCCESSFUL

Definition at line 566 of file IFStreamAscii.h.

◆ readString() [2/2]

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

Read the next string. Return true if SUCCESSFUL

Definition at line 576 of file IFStreamAscii.h.

◆ readType() [1/6]

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

Read the next byte. Return true if SUCCESSFUL

Definition at line 400 of file IFStreamAscii.h.

◆ readType() [2/6]

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

Read the next double. Return true if SUCCESSFUL

Definition at line 475 of file IFStreamAscii.h.

◆ readType() [3/6]

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

Read the next float. Return true if SUCCESSFUL

Definition at line 460 of file IFStreamAscii.h.

◆ readType() [4/6]

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

Read the next int. Return true if SUCCESSFUL

Definition at line 430 of file IFStreamAscii.h.

◆ readType() [5/6]

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

Read the next long. Return true if SUCCESSFUL

Definition at line 445 of file IFStreamAscii.h.

◆ readType() [6/6]

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

Read the next short. Return true if SUCCESSFUL

Definition at line 415 of file IFStreamAscii.h.

◆ resetReader()

void geotess::IFStreamAscii::resetReader ( )

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

◆ setBeginBlockCommentDelimiter()

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

Set the begin block comment delimiter string.

Definition at line 315 of file IFStreamAscii.h.

◆ setBlockCommentDelimiters()

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

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

Definition at line 305 of file IFStreamAscii.h.

◆ setCommentDelimiter()

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

Set the comment delimiter string.

Definition at line 292 of file IFStreamAscii.h.

◆ setDefaultDelimiters()

void geotess::IFStreamAscii::setDefaultDelimiters ( )

Sets the default delimiter settings.

◆ setDelimiters()

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.

Definition at line 252 of file IFStreamAscii.h.

◆ setEndBlockCommentDelimiter()

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

Set the end block comment delimiter string.

Definition at line 327 of file IFStreamAscii.h.

◆ setStringDelimiter()

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

Set the string delimiter string.

Definition at line 280 of file IFStreamAscii.h.

◆ setWhitespaceDelimiters()

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

Set the whitespace delimiter string.

Definition at line 268 of file IFStreamAscii.h.

◆ tokenize()

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

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

◆ writeBool()

void geotess::IFStreamAscii::writeBool ( bool  b)
inline

Definition at line 488 of file IFStreamAscii.h.

◆ writeBoolNL()

void geotess::IFStreamAscii::writeBoolNL ( bool  b)
inline

Definition at line 489 of file IFStreamAscii.h.

◆ writeByte()

void geotess::IFStreamAscii::writeByte ( byte  b)
inline

Definition at line 492 of file IFStreamAscii.h.

◆ writeByteNL()

void geotess::IFStreamAscii::writeByteNL ( byte  b)
inline

Definition at line 493 of file IFStreamAscii.h.

◆ writeDouble()

void geotess::IFStreamAscii::writeDouble ( double  d)
inline

Definition at line 512 of file IFStreamAscii.h.

◆ writeDoubleNL()

void geotess::IFStreamAscii::writeDoubleNL ( double  d)
inline

Definition at line 513 of file IFStreamAscii.h.

◆ writeFloat()

void geotess::IFStreamAscii::writeFloat ( float  f)
inline

Definition at line 508 of file IFStreamAscii.h.

◆ writeFloatNL()

void geotess::IFStreamAscii::writeFloatNL ( float  f)
inline

Definition at line 509 of file IFStreamAscii.h.

◆ writeInt()

void geotess::IFStreamAscii::writeInt ( int  i)
inline

Definition at line 500 of file IFStreamAscii.h.

◆ writeIntNL()

void geotess::IFStreamAscii::writeIntNL ( int  i)
inline

Definition at line 501 of file IFStreamAscii.h.

◆ writeLong()

void geotess::IFStreamAscii::writeLong ( LONG_INT  l)
inline

Definition at line 504 of file IFStreamAscii.h.

◆ writeLongNL()

void geotess::IFStreamAscii::writeLongNL ( LONG_INT  l)
inline

Definition at line 505 of file IFStreamAscii.h.

◆ writeNL()

void geotess::IFStreamAscii::writeNL ( )
inline

Definition at line 516 of file IFStreamAscii.h.

◆ writeShort()

void geotess::IFStreamAscii::writeShort ( short  s)
inline

Definition at line 496 of file IFStreamAscii.h.

◆ writeShortNL()

void geotess::IFStreamAscii::writeShortNL ( short  s)
inline

Definition at line 497 of file IFStreamAscii.h.

◆ writeString()

void geotess::IFStreamAscii::writeString ( const string &  s)
inline

Definition at line 484 of file IFStreamAscii.h.

◆ writeStringNL()

void geotess::IFStreamAscii::writeStringNL ( const string &  s)
inline

Definition at line 485 of file IFStreamAscii.h.

◆ writeType() [1/8]

void geotess::IFStreamAscii::writeType ( bool  b)
inline

Definition at line 490 of file IFStreamAscii.h.

◆ writeType() [2/8]

void geotess::IFStreamAscii::writeType ( byte  b)
inline

Definition at line 494 of file IFStreamAscii.h.

◆ writeType() [3/8]

void geotess::IFStreamAscii::writeType ( const string &  s)
inline

Definition at line 486 of file IFStreamAscii.h.

◆ writeType() [4/8]

void geotess::IFStreamAscii::writeType ( double  d)
inline

Definition at line 514 of file IFStreamAscii.h.

◆ writeType() [5/8]

void geotess::IFStreamAscii::writeType ( float  f)
inline

Definition at line 510 of file IFStreamAscii.h.

◆ writeType() [6/8]

void geotess::IFStreamAscii::writeType ( int  i)
inline

Definition at line 502 of file IFStreamAscii.h.

◆ writeType() [7/8]

void geotess::IFStreamAscii::writeType ( LONG_INT  l)
inline

Definition at line 506 of file IFStreamAscii.h.

◆ writeType() [8/8]

void geotess::IFStreamAscii::writeType ( short  s)
inline

Definition at line 498 of file IFStreamAscii.h.

◆ writeTypeNL() [1/8]

void geotess::IFStreamAscii::writeTypeNL ( bool  b)
inline

Definition at line 491 of file IFStreamAscii.h.

◆ writeTypeNL() [2/8]

void geotess::IFStreamAscii::writeTypeNL ( byte  b)
inline

Definition at line 495 of file IFStreamAscii.h.

◆ writeTypeNL() [3/8]

void geotess::IFStreamAscii::writeTypeNL ( const string &  s)
inline

Definition at line 487 of file IFStreamAscii.h.

◆ writeTypeNL() [4/8]

void geotess::IFStreamAscii::writeTypeNL ( double  d)
inline

Definition at line 515 of file IFStreamAscii.h.

◆ writeTypeNL() [5/8]

void geotess::IFStreamAscii::writeTypeNL ( float  f)
inline

Definition at line 511 of file IFStreamAscii.h.

◆ writeTypeNL() [6/8]

void geotess::IFStreamAscii::writeTypeNL ( int  i)
inline

Definition at line 503 of file IFStreamAscii.h.

◆ writeTypeNL() [7/8]

void geotess::IFStreamAscii::writeTypeNL ( LONG_INT  l)
inline

Definition at line 507 of file IFStreamAscii.h.

◆ writeTypeNL() [8/8]

void geotess::IFStreamAscii::writeTypeNL ( short  s)
inline

Definition at line 499 of file IFStreamAscii.h.


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