- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Exponent::IO::CTextStream Class Reference

List of all members.

## Detailed Description

Text stream to and from the disk.

Input and output from text files. Note that for input, no single line may be more than CTEXTSTREAM_MAX_CHARACTERS

Date:
  17/08/2005

Author:
  Paul Chana

Version:
  1.0.0 Initial version

  1.0.1 Added read with in place string array

  1.0.2 Added stream of counted objects

  1.0.3 Added eof checking

  1.0.4 Made it a CCountedObject

Note:
  All contents of this source code are copyright 2005 Exp Digital Uk.
  This source file is covered by the licence conditions of the Infinity API. You should have recieved a copy
  with the source code. If you didnt, please refer to http://www.expdigital.co.uk All content is the Intellectual property of Exp Digital Uk.
  Certain sections of this code may come from other sources. They are credited where applicable.
  If you have comments, suggestions or bug reports please visit http://support.expdigital.co.uk

Id
  CTextStream.hpp,v 1.6 2007/02/08 21:06:44 paul Exp

Definition at line 47 of file CTextStream.hpp.

## Public Types

- enum EStreamMode {
  e_input = 0,
  e_output
  }
    Enumeration of stream mmodes. More...

## Public Member Functions

- void closeStream ()
- CTextStream ()
- CTextStream (const CSystemString &path, const EStreamMode mode)
- void flushToDisk ()
- bool hasReachedEOF ()
- bool isStreamOpen () const
- bool openStream (const CSystemString &path, const EStreamMode mode)
- CTextStream & operator<< (const bool value)
- CTextStream & operator<< (const float value)
- CTextStream & operator<< (const double value)
- CTextStream & operator<< (const int value)
- CTextStream & operator<< (const long value)
- CTextStream & operator<< (const CCountedObject &object)
- CTextStream & operator<< (const CSystemString &string)
- CTextStream & operator<< (const CString &string)
- CTextStream & operator<< (const char *string)
- CTextStream & operator>> (bool &value)
- CTextStream & operator>> (float &value)
- CTextStream & operator>> (double &value)
- CTextStream & operator>> (int &value)
- CTextStream & operator>> (long &value)
- CTextStream & operator>> (CSystemString &string)
- CTextStream & operator>> (CString &string)
- CTextStream & operator>> (char *string)
- bool validForInput ()
- bool validForOutput ()
- virtual ~CTextStream ()

## Static Public Attributes

- static const long CTEXTSTREAM_MAX_CHARACTERS = 1024

## Protected Attributes

- char m_buffer [CTEXTSTREAM_MAX_CHARACTERS]
- CSystemString m_filePath
- ifstream m_inputFile
- EStreamMode m_mode
- ofstream m_outFile
- bool m_streamIsOpen

## Member Enumeration Documentation

enum Exponent::IO::CTextStream::EStreamMode

Enumeration of stream mmodes.

Enumerator:

  e_input | Input mode
  e_output | Output mode

Definition at line 63 of file CTextStream.hpp.

## Constructor & Destructor Documentation

Exponent::IO::CTextStream::CTextStream | ( | const CSystemString & | path,
|  | const EStreamMode | mode |
| ) |  |  |

Construction

Parameters:

  | path | The path to the file to read / write
  | mode | The streaming mode to use

Exponent::IO::CTextStream::CTextStream | ( |  | ) |

Default construction

virtual Exponent::IO::CTextStream::~CTextStream | ( |  | ) | `[virtual]`

Destruction

## Member Function Documentation

void Exponent::IO::CTextStream::closeStream | ( |  | ) |

Close the stream

void Exponent::IO::CTextStream::flushToDisk | ( |  | ) |

Flush to disk

bool Exponent::IO::CTextStream::hasReachedEOF | ( |  | ) |

Has reached eof

Return values:

  | bool | True if reached EOF or not open, false otherwise

bool Exponent::IO::CTextStream::isStreamOpen | ( |  | ) | const`[inline]`

Is the stream open

Return values:

  | bool | True if stream open, false otherwise

Definition at line 110 of file CTextStream.hpp.

References m_streamIsOpen.

bool Exponent::IO::CTextStream::openStream | ( | const CSystemString & | path,
|  | const EStreamMode | mode |
| ) |  |  |

Open the stream

Parameters:

  | path | The path to the file to read / write
  | mode | The streaming mode to use

CTextStream& Exponent::IO::CTextStream::operator<< | ( | const bool | value | ) |

Output operators

Parameters:

  | value | The value to write

Return values:

  | CTextStream& | A reference to this

CTextStream& Exponent::IO::CTextStream::operator<< | ( | const float | value | ) |

Output operators

Parameters:

  | value | The value to write

Return values:

  | CTextStream& | A reference to this

CTextStream& Exponent::IO::CTextStream::operator<< | ( | const double | value | ) |

Output operators

Parameters:

  | value | The value to write

Return values:

  | CTextStream& | A reference to this

CTextStream& Exponent::IO::CTextStream::operator<< | ( | const int | value | ) |

Output operators

Parameters:

  | value | The value to write

Return values:

  | CTextStream& | A reference to this

CTextStream& Exponent::IO::CTextStream::operator<< | ( | const long | value | ) |

Output operators

Parameters:

  | value | The value to write

Return values:

  | CTextStream& | A reference to this

CTextStream& Exponent::IO::CTextStream::operator<< | ( | const CCountedObject & | object | ) |

Output operators

Parameters:

  | object | The object to write

Return values:

  | CTextStream& | A reference to this

CTextStream& Exponent::IO::CTextStream::operator<< | ( | const CSystemString & | string | ) |

Output operators

Parameters:

  | string | The string to write

Return values:

  | CTextStream& | A reference to this

CTextStream& Exponent::IO::CTextStream::operator<< | ( | const CString & | string | ) |

Output operators

Parameters:

  | string | The string to write

Return values:

  | CTextStream& | A reference to this

CTextStream& Exponent::IO::CTextStream::operator<< | ( | const char * | string | ) |

Output operators

Parameters:

  | string | The string to write

Return values:

  | CTextStream& | A reference to this

CTextStream& Exponent::IO::CTextStream::operator>> | ( | bool & | value | ) |

Input operators

Parameters:

  | value | The value to read in to

Return values:

  | CTextStream& | A reference to this

CTextStream& Exponent::IO::CTextStream::operator>> | ( | float & | value | ) |

Input operators

Parameters:

  | value | The value to read in to

Return values:

  | CTextStream& | A reference to this

CTextStream& Exponent::IO::CTextStream::operator>> | ( | double & | value | ) |

Input operators

Parameters:

  | value | The value to read in to

Return values:

  | CTextStream& | A reference to this

CTextStream& Exponent::IO::CTextStream::operator>> | ( | int & | value | ) |

Input operators

Parameters:

  | value | The value to read in to

Return values:

  | CTextStream& | A reference to this

CTextStream& Exponent::IO::CTextStream::operator>> | ( | long & | value | ) |

Input operators

Parameters:

  | value | The value to read in to

Return values:

  | CTextStream& | A reference to this

CTextStream& Exponent::IO::CTextStream::operator>> | ( | CSystemString & | string | ) |

Input operators

Parameters:

  | string | The string to read in to

Return values:

  | CTextStream& | A reference to this

CTextStream& Exponent::IO::CTextStream::operator>> | ( | CString & | string | ) |

Input operators

Parameters:

  | string | The string to read in to

Return values:

  | CTextStream& | A reference to this

CTextStream& Exponent::IO::CTextStream::operator>> | ( | char * | string | ) |

Input operators

Parameters:

  | string | The string to read in to

Return values:

  | CTextStream& | A reference to this

bool Exponent::IO::CTextStream::validForInput | ( |  | ) |

Valid for output

Return values:

  | bool | True if file is open for input, false otherwise

bool Exponent::IO::CTextStream::validForOutput | ( |  | ) |

Valid for output

Return values:

  | bool | True if file is open for output, false otherwise

## Member Data Documentation

const long Exponent::IO::CTextStream::CTEXTSTREAM_MAX_CHARACTERS = 1024`[static]`

Max characters for an input stream

Definition at line 71 of file CTextStream.hpp.

char Exponent::IO::CTextStream::m_buffer[CTEXTSTREAM_MAX_CHARACTERS]`[protected]`

Reading buffer

Definition at line 269 of file CTextStream.hpp.

CSystemString Exponent::IO::CTextStream::m_filePath`[protected]`

the path to write to

Definition at line 266 of file CTextStream.hpp.

ifstream Exponent::IO::CTextStream::m_inputFile`[protected]`

the input file reader

Definition at line 268 of file CTextStream.hpp.

EStreamMode Exponent::IO::CTextStream::m_mode`[protected]`

Type of streaming

Definition at line 265 of file CTextStream.hpp.

ofstream Exponent::IO::CTextStream::m_outFile`[protected]`

the output file writer

Definition at line 267 of file CTextStream.hpp.

bool Exponent::IO::CTextStream::m_streamIsOpen`[protected]`

Is the stream open

Definition at line 264 of file CTextStream.hpp.

Referenced by isStreamOpen().