Source: OmInputFileStream.h


Annotated List
Files
Globals
Hierarchy
Index
#ifndef OM_INPUT_FILE_STREAM_H
#define OM_INPUT_FILE_STREAM_H

/**
 * Implementation of input stream for files.
 *
 * This class provides a specialization of OmInputStream for standard and user files.
 * This corresponds to an encapsulation of I/O operations needed by the library.
 */
class OmInputFileStream : public OmInputStream
{
public:
  /**
   * Default constructor. Assume directly the use of the standard input (stdin).
   */
  OmInputFileStream() {
    setIO(OMmakeIOFile(stdin)); }

  /**
   * Constructor. A valid filename (but not open) must be given.
   * @li Precondition: ~ NullPointer(filename_in) and ~ EmptyString(filename_in)
   */
  explicit OmInputFileStream(const char * filename_in) {
    OmException::checkNullPointer(filename_in);
    OmException::checkEmptyString(filename_in);
    FILE * file = fopen(filename_in, "rb");
    OmException::checkFileError(file);
    setIO(OMmakeIOFile(file)); }

  /**
   * Constructor. A valid file in an open and ready state must be given.
   * @li Precondition: ~ FileError(file_in)
   */
  explicit OmInputFileStream(FILE * file_in) {
    OmException::checkFileError(file_in);
    setIO(OMmakeIOFile(file_in)); }
};

#endif // OM_INPUT_FILE_STREAM_H

Generated by: root@localhost.localdomain on Tue Oct 12 21:02:30 199.