BaseTextWriter Class Reference
 
 
 
BaseTextWriter Class Reference

#include <maxtextfile.h>

Inheritance diagram for BaseTextWriter:
MaxHeapOperators ReaderWriter Writer

Class Description

This class is the base for all text file writers.

It declare a common interface to all implementations and expose a number of services to output formatted strings to a file.

Public Member Functions

virtual  ~BaseTextWriter ()
virtual size_t  Write (const char *string, size_t nchars=(size_t)-1)=0
  Write a string.
virtual size_t  Write (const wchar_t *string, size_t nchars=(size_t)-1)=0
  Write an UTF-16 string.
virtual size_t  Write (const MaxString &String)=0
  Write an MaxString.
virtual bool  CanWrite () const =0
  Returns true if we can write to file.
virtual bool  IsFileOpen () const =0
  Returns true if file is open.
virtual void  Flush ()=0
  Make sure that all the buffer are synced with the OS native objects.
virtual bool  IsEndOfFile () const =0
  Returns true if file at the end.
virtual size_t  Position () const =0
  Get the current position in the file.
virtual size_t  Seek (long offset, int origin)=0
  Seek inside the stream.
size_t  Printf (const char *,...)
size_t  Vprintf (const char *, va_list)

Constructor & Destructor Documentation

virtual ~BaseTextWriter ( ) [virtual]

Member Function Documentation

virtual size_t Write ( const char *  string,
size_t  nchars = (size_t)-1 
) [pure virtual]

Write a string.

Parameters:
string String to write
nchars Number of character to write. Default is size of string in characters
Returns:
Number of characters written

Implemented in Writer, and ReaderWriter.

virtual size_t Write ( const wchar_t *  string,
size_t  nchars = (size_t)-1 
) [pure virtual]

Write an UTF-16 string.

Parameters:
string String to write
nchars Number of character to write. Default is size of string in characters
Returns:
Number of characters written

Implemented in Writer, and ReaderWriter.

virtual size_t Write ( const MaxString String ) [pure virtual]

Write an MaxString.

Parameters:
String String to write
Returns:
Number of characters written

Implemented in Writer, and ReaderWriter.

virtual bool CanWrite ( ) const [pure virtual]

Returns true if we can write to file.

Implemented in Writer, and ReaderWriter.

virtual bool IsFileOpen ( ) const [pure virtual]

Returns true if file is open.

Implemented in Writer, and ReaderWriter.

virtual void Flush ( ) [pure virtual]

Make sure that all the buffer are synced with the OS native objects.

Implemented in Writer, and ReaderWriter.

virtual bool IsEndOfFile ( ) const [pure virtual]

Returns true if file at the end.

Implemented in Writer, and ReaderWriter.

virtual size_t Position ( ) const [pure virtual]

Get the current position in the file.

Implemented in Writer, and ReaderWriter.

virtual size_t Seek ( long  offset,
int  origin 
) [pure virtual]

Seek inside the stream.

Parameters:
offset The seeks operations are done in number of characters (not bytes).
origin The direction to move. Origin can be one of the following * SEEK_CUR Current position of file pointer. * SEEK_END End of file. * SEEK_SET Beginning of file.
Returns:
Returns the absolute position of the text file. (in chars)

Implemented in Writer, and ReaderWriter.

size_t Printf ( const char *  ,
  ... 
)
size_t Vprintf ( const char *  ,
va_list   
)