Diffpack Documentation


Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

Is_base Class Reference

base class for generalized input, used by class Is. More...

#include <IsOs.h>

Inheritance diagram for Is_base::

HandleId Is_istream Is_String Is_xdr Is_ifstream List of all members.

Public Methods

 Is_base (Format_type format=ASCII)
virtual ~Is_base ()
virtual bool ok () const
void setFormat (Format_type format=ASCII)
void resetFormat ()
Format_type getFormat ()
virtual bool get (char *word)
virtual bool get (String &word)
virtual bool get (float &a)
virtual bool get (double &a)
virtual bool get (int &i)
virtual bool get (long int &i)
virtual bool get (char &c)
virtual bool get (char *data, int item_size, int nitems)
real getReal ()
int getInt ()
virtual void putback (char c)
virtual bool eof ()
virtual void return2start ()
virtual long int getPosition ()
virtual void setPosition (long int filepos)
virtual void ignore (char end)
virtual void getline (String &word, char end)
virtual void getline (char *s, int length, char end)
void getline (char end)
const char* getBuffer ()
virtual void eat (const char *chars)
void getCommand (String &value, char eqmark='=', char endmark='')

Protected Attributes

Format_type format
Format_type last_format
bool command_warnings
char buffer [buffer_length]

Detailed Description

base class for generalized input, used by class Is.

NAME: Is_base - base class for generalized input, used by class Is

DESCRIPTION:

The class is handled by class "Is" (see class "Is" for the purpose of generalized input). Class "Is_base" serves as base class for various input sources such as istream, ifstream and strings. The class defines a general interface for input handling. Note that "Is_base" is always used through an "Is" instance.


Constructor & Destructor Documentation

Is_base::Is_base ( Format_type format = ASCII )
 

The constructor takes a format argument, indicating whether the input source has binary or ascii format. The default value is "ASCII". No further initialization is necessary. The format state can be reset using the member function "setFormat". Again, recall that a programmer never uses "Is_base", its construction and initialization is always performed by class "Is".

Is_base::~Is_base ( ) [virtual]
 


Member Function Documentation

void Is_base::eat ( const char * chars ) [virtual]
 

eats all characters appearing in the string argument. In comparison with "ignore", "eat" eats the characters only if they are equal to one of the characters in the argument string, while "ignore" eats any character up to the one given as argument. For example, "eat" can eat all white spaces, tabs and newlines, whereas "ignore" can eat everything up to and including the first character, e.g., white space.

Reimplemented in Is_istream, Is_String, and Is_xdr.

bool Is_base::eof ( ) [virtual]
 

returns true if EOF is reached, false otherwise.

Reimplemented in Is_istream, Is_String, and Is_xdr.

bool Is_base::get ( char * data,
int item_size,
int nitems ) [virtual]
 

See documentation of one of the overloaded functions.

Reimplemented in Is_istream, Is_ifstream, Is_String, and Is_xdr.

bool Is_base::get ( char & c ) [virtual]
 

See documentation of one of the overloaded functions.

Reimplemented in Is_istream, Is_ifstream, Is_String, and Is_xdr.

bool Is_base::get ( long int & i ) [virtual]
 

See documentation of one of the overloaded functions.

Reimplemented in Is_istream, Is_ifstream, Is_String, and Is_xdr.

bool Is_base::get ( int & i ) [virtual]
 

See documentation of one of the overloaded functions.

Reimplemented in Is_istream, Is_ifstream, Is_String, and Is_xdr.

bool Is_base::get ( double & a ) [virtual]
 

See documentation of one of the overloaded functions.

Reimplemented in Is_istream, Is_ifstream, Is_String, and Is_xdr.

bool Is_base::get ( float & a ) [virtual]
 

See documentation of one of the overloaded functions.

Reimplemented in Is_istream, Is_ifstream, Is_String, and Is_xdr.

bool Is_base::get ( String & word ) [virtual]
 

See documentation of one of the overloaded functions.

Reimplemented in Is_istream, Is_ifstream, Is_String, and Is_xdr.

bool Is_base::get ( char * word ) [virtual]
 

gets a "char*" (string), "String", "float", "double", "int" or "char" from the input source. There are several overloaded versions.

Reimplemented in Is_istream, Is_ifstream, Is_String, and Is_xdr.

const char * Is_base::getBuffer ( ) [inline]
 

returns a pointer to the internal character buffer "buffer" in "Is_base". May be used in conjunction with "getline".

void Is_base::getCommand ( String & value,
char eqmark = '=',
char endmark = ' ' )
 

function for convenient reading of a command and its value, e.g. some-command = some-value.

Format_type Is_base::getFormat ( ) [inline]
 

returns the format type. The return value is an "enum" "Format_type".

int Is_base::getInt ( ) [inline]
 

See documentation of one of the overloaded functions.

long int Is_base::getPosition ( ) [virtual]
 

returns the position in a random access file.

Reimplemented in Is_istream, Is_String, and Is_xdr.

real Is_base::getReal ( ) [inline]
 

See documentation of one of the overloaded functions.

void Is_base::getline ( char c ) [inline]
 

See documentation of one of the overloaded functions.

Reimplemented in Is_istream, Is_String, and Is_xdr.

void Is_base::getline ( char * s,
int length,
char end ) [virtual]
 

See documentation of one of the overloaded functions.

Reimplemented in Is_istream, Is_String, and Is_xdr.

void Is_base::getline ( String & word,
char end ) [virtual]
 

gets a sequence of characters from the input source. Same as "ignore", but the characters are accessable in terms of a return "String" or (for an overloaded version) in terms of an internal "Is_base" character array named "buffer". For a programmer, the "getline(String&,char)" function is the version of "getline" that is most convenient. However, if one reads a long file and calls this version of "getline", recall that a "String" is allocated for every line. Use of the fixed-size internal buffer is more efficient.

Reimplemented in Is_istream, Is_String, and Is_xdr.

void Is_base::ignore ( char end ) [virtual]
 

eat all characters up to and including the one given as argument.

Reimplemented in Is_istream, Is_String, and Is_xdr.

bool Is_base::ok ( ) const [virtual]
 

Reimplemented in Is_istream, Is_ifstream, Is_String, and Is_xdr.

void Is_base::putback ( char c ) [virtual]
 

puts the character back to the input source. "get" and "putback" enables a sort of "peek" functionality (cf. class "istream").

Reimplemented in Is_istream, Is_String, and Is_xdr.

void Is_base::resetFormat ( )
 

resets the format type to the value prior to last call to "setFormat". Note that the effect of the following code segment:

      os.setFormat(ASCII);
      someFunc(os);
      os.resetFormtat();

      void someFunc(Os os)
      {
        os.setFormat(BINARY)
        ...
        os.resetFormat();
      }

Here, "os" will be in "BINARY" mode after the call to "someFunc", regardless of its value before the first call to "setFormat(ASCII)".

void Is_base::return2start ( ) [virtual]
 

sets the input source in the start position. This functionality is only possible with a string source or a random access file source.

Reimplemented in Is_istream, Is_String, and Is_xdr.

void Is_base::setFormat ( Format_type format = ASCII )
 

sets the format type to "ASCII" or "BINARY".

void Is_base::setPosition ( long int filepos ) [virtual]
 

sets the position in a random access file.

Reimplemented in Is_istream, Is_String, and Is_xdr.


Member Data Documentation

char Is_base::buffer [protected]
 

bool Is_base::command_warnings [protected]
 

Format_type Is_base::format [protected]
 

Format_type Is_base::last_format [protected]
 


The documentation for this class was generated from the following file:
Copyright © 2003 inuTech GmbH. All rights reserved.