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

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

# Exponent::IO::CPresetIO Class Reference

List of all members.

## Detailed Description

Textual preset saving to a stream.

Deprecated:
  This class is here for historical use.
  See also:
    CXMLDocument

    CTextStream

    CFileStream

Deprecated:

See also:
  CXMLDocument

Date:
  28/08/2005

Author:
  Paul Chana

Version:
  1.0.0 Initial version

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
  CPresetIO.hpp,v 1.5 2007/02/08 21:06:44 paul Exp

Definition at line 43 of file CPresetIO.hpp.

## Public Member Functions

- void close ()
- bool close (const CString &pluginName)
- bool closeBodyChunk ()
- bool closeHeadChunk ()
- CPresetIO ()
- CTextStream & getTextStream ()
- bool open (const CTextStream::EStreamMode streamMode, const CString &pluginName, const CSystemString &presetPath)
- bool openBodyChunk ()
- bool openHeadChunk ()
- bool readChunkToDoubles (const CString &tag, const long sizeOfChunk, double *buffer)
- bool readChunkToLongs (const CString &tag, const long sizeOfChunk, long *buffer)
- bool readChunkToStrings (const CString &tag, TStringCountedPointerArray &array)
- bool readHeadChunk (TStringCountedPointerArray &array)
- bool readParameterChunk (const long numberOfParameters, double *parameters)
- bool readVersionNumber (const long *expectedVersion, const long numberOfVersions, long &actualVersion)
- bool readVersionNumber (const long expectedVersion)
- bool writeChunkToDoubles (const CString &tag, const long sizeOfChunk, const double *buffer)
- bool writeChunkToLongs (const CString &tag, const long sizeOfChunk, long *buffer)
- bool writeChunkToStrings (const CString &tag, TStringCountedPointerArray &array)
- bool writeHeadChunk (TStringCountedPointerArray &array)
- bool writeParameterChunk (const long numberOfParameters, const double *parameters)
- bool writeVersionNumber (const long number)
- virtual ~CPresetIO ()

## Protected Member Functions

- void constructCloseTag (CString &closeTag, const CString &tag)
- void constructOpenTag (CString &openTag, const CString &tag)
- bool readCloseTag (const CString &tag)
- bool readOpenTag (const CString &tag)
- bool writeCloseTag (const CString &tag)
- bool writeOpenTag (const CString &tag)

## Protected Attributes

- bool m_isOpenForRead
- bool m_isOpenForWrite
- CTextStream m_stream

## Constructor & Destructor Documentation

Exponent::IO::CPresetIO::CPresetIO | ( |  | ) |

Construction

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

Destruction

## Member Function Documentation

void Exponent::IO::CPresetIO::close | ( |  | ) |

Close the file (immediate close, no checking)

bool Exponent::IO::CPresetIO::close | ( | const CString & | pluginName | ) |

Close the file

Parameters:

  | pluginName | A descriptive string that is used to identify the type of preset format

Return values:

  | bool | True if closed properly, false otherwise

bool Exponent::IO::CPresetIO::closeBodyChunk | ( |  | ) |

Close the body chunk

Return values:

  | bool | True if body tag closed, false otherwise

bool Exponent::IO::CPresetIO::closeHeadChunk | ( |  | ) |

Close the head chunk

Return values:

  | bool | True if head tag closed, false otherwise

void Exponent::IO::CPresetIO::constructCloseTag | ( | CString & | closeTag,
|  | const CString & | tag |
| ) |  |  | `[protected]`

Get a close tag - converts 'text' to '<\/text>'

Parameters:

  | closeTag | On return filled with the tag
  | tag | The tag to make in to a closing tag

void Exponent::IO::CPresetIO::constructOpenTag | ( | CString & | openTag,
|  | const CString & | tag |
| ) |  |  | `[protected]`

Get an open tag - converts 'text' to '<\/text>'

Parameters:

  | openTag | On return filled with the tag
  | tag | The tag to make in to an open tag

CTextStream& Exponent::IO::CPresetIO::getTextStream | ( |  | ) | `[inline]`

Get the stream

Return values:

  | CTextStream | & The text stream

Definition at line 229 of file CPresetIO.hpp.

References m_stream.

bool Exponent::IO::CPresetIO::open | ( | const CTextStream::EStreamMode | streamMode,
|  | const CString & | pluginName,
|  | const CSystemString & | presetPath |
| ) |  |  |

Open for writing

Parameters:

  | streamMode | The mode of io
  | pluginName | A descriptive string that is used to identify the type of preset format
  | presetPath | The path to the preset to read / write

Return values:

  | bool | True if opened properly, false otherwise

bool Exponent::IO::CPresetIO::openBodyChunk | ( |  | ) |

Open the body chunk

Return values:

  | bool | True if read opening body flag correctly, false otherwise

bool Exponent::IO::CPresetIO::openHeadChunk | ( |  | ) |

Open the head chunk

Return values:

  | bool | True if read opening head flag correctly, false otherwise

bool Exponent::IO::CPresetIO::readChunkToDoubles | ( | const CString & | tag,
|  | const long | sizeOfChunk,
|  | double * | buffer |
| ) |  |  |

Read a chunk to doubles

Parameters:

  | tag | A descriptive chunk tag expected
  | sizeOfChunk | The size of the chunk to write in elements
  | buffer | The buffer to fill

Return values:

  | bool | True if read correctly, false otherwise

bool Exponent::IO::CPresetIO::readChunkToLongs | ( | const CString & | tag,
|  | const long | sizeOfChunk,
|  | long * | buffer |
| ) |  |  |

Read a chunk to longs

Parameters:

  | tag | A descriptive chunk tag expected
  | sizeOfChunk | The size of the chunk to write in elements
  | buffer | The buffer to fill

Return values:

  | bool | True if read correctly, false otherwise

bool Exponent::IO::CPresetIO::readChunkToStrings | ( | const CString & | tag,
|  | TStringCountedPointerArray & | array |
| ) |  |  |

Read a chunk to strings

Parameters:

  | tag | A descriptive chunk tag expected
  | array | Array to store strings contained within the chunk

Return values:

  | bool | True if read the chunk properly, false otherwise

bool Exponent::IO::CPresetIO::readCloseTag | ( | const CString & | tag | ) | `[protected]`

Read a close tag

Parameters:

  | tag | The tag to read (doesnt need to be surrounded by <\/ >)

Return values:

  | bool | True if read properly, false otherwise

bool Exponent::IO::CPresetIO::readHeadChunk | ( | TStringCountedPointerArray & | array | ) |

Read head chunk

Parameters:

  | array | Array to store strings contained within the head chunk

Return values:

  | bool | True if read correctly, false on error

bool Exponent::IO::CPresetIO::readOpenTag | ( | const CString & | tag | ) | `[protected]`

Read an opening tag

Parameters:

  | tag | The tag to read (doesnt need to be surrounded by < >)

Return values:

  | bool | True if read properly, false otherwise

bool Exponent::IO::CPresetIO::readParameterChunk | ( | const long | numberOfParameters,
|  | double * | parameters |
| ) |  |  |

Read the parameters as a chunk of doubles

Parameters:

  | numberOfParameters | The size of the array to read in
  | parameters | On return is filled with the parameters as read from disk

Return values:

  | bool | True if parameters read correctly

bool Exponent::IO::CPresetIO::readVersionNumber | ( | const long * | expectedVersion,
|  | const long | numberOfVersions,
|  | long & | actualVersion |
| ) |  |  |

Read the version number

Parameters:

  | expectedVersion | The version number you expect to find
  | numberOfVersions | The size of expected versions
  | actualVersion | On return is filled with the version number or undefined on error

Return values:

  | bool | True if versions match, false otherwise

bool Exponent::IO::CPresetIO::readVersionNumber | ( | const long | expectedVersion | ) |

Read the version number

Parameters:

  | expectedVersion | The version number you expect to find

Return values:

  | bool | True if versions match, false otherwise

bool Exponent::IO::CPresetIO::writeChunkToDoubles | ( | const CString & | tag,
|  | const long | sizeOfChunk,
|  | const double * | buffer |
| ) |  |  |

Write chunk to doubles

Parameters:

  | tag | A descriptive chunk tag
  | sizeOfChunk | The number of elements to write
  | buffer | The buffer to write

Return values:

  | bool | True if written correctly, false otherwise

bool Exponent::IO::CPresetIO::writeChunkToLongs | ( | const CString & | tag,
|  | const long | sizeOfChunk,
|  | long * | buffer |
| ) |  |  |

Write chunk to longs

Parameters:

  | tag | A descriptive chunk tag
  | sizeOfChunk | The number of elements to write
  | buffer | The buffer to write

Return values:

  | bool | True if written correctly, false otherwise

bool Exponent::IO::CPresetIO::writeChunkToStrings | ( | const CString & | tag,
|  | TStringCountedPointerArray & | array |
| ) |  |  |

Write chunk to strings

Parameters:

  | tag | A descriptive chunk tag
  | array | The array of strings to write

Return values:

  | bool | True if written correctly, false otherwise

bool Exponent::IO::CPresetIO::writeCloseTag | ( | const CString & | tag | ) | `[protected]`

Write a close tag - adds </ before the tag and > at the end of the tag

Return values:

  | bool | True if written properly, false otherwise

bool Exponent::IO::CPresetIO::writeHeadChunk | ( | TStringCountedPointerArray & | array | ) |

Write head chunk

Parameters:

  | array | The array of strings to write to the head chunk

Return values:

  | bool | True if written correctly, false otherwise

bool Exponent::IO::CPresetIO::writeOpenTag | ( | const CString & | tag | ) | `[protected]`

Write an opening tag - adds < before the tag and > at the end of the tag

Parameters:

  | tag | The tag to write

Return values:

  | bool | True if written properly, false otherwise

bool Exponent::IO::CPresetIO::writeParameterChunk | ( | const long | numberOfParameters,
|  | const double * | parameters |
| ) |  |  |

Write the parameters

Parameters:

  | numberOfParameters | The number of parameters to write
  | parameters | The parameters to write

Return values:

  | bool | True if written correctly, false otherwise

bool Exponent::IO::CPresetIO::writeVersionNumber | ( | const long | number | ) |

Write the version number

Parameters:

  | number | The version number

Return values:

  | bool | True if read correctly, false otherwise

## Member Data Documentation

bool Exponent::IO::CPresetIO::m_isOpenForRead`[protected]`

Can we read

Definition at line 286 of file CPresetIO.hpp.

bool Exponent::IO::CPresetIO::m_isOpenForWrite`[protected]`

Can we write

Definition at line 287 of file CPresetIO.hpp.

CTextStream Exponent::IO::CPresetIO::m_stream`[protected]`

The actual output stream

Definition at line 284 of file CPresetIO.hpp.

Referenced by getTextStream().