3ds Max C++ API Reference
BaseTextWriter Class Referenceabstract

This class is the base for all text file writers. More...

#include <maxtextfile.h>

+ Inheritance diagram for BaseTextWriter:

Public Member Functions

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

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Detailed 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.

Constructor & Destructor Documentation

◆ ~BaseTextWriter()

virtual ~BaseTextWriter ( )
virtual

Member Function Documentation

◆ Write() [1/3]

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

Write a string.

Parameters
stringString to write
ncharsNumber of character to write. Default is size of string in characters
Returns
Number of characters written

Implemented in ReaderWriter, and Writer.

◆ Write() [2/3]

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

Write an UTF-16 string.

Parameters
stringString to write
ncharsNumber of character to write. Default is size of string in characters
Returns
Number of characters written

Implemented in ReaderWriter, and Writer.

◆ Write() [3/3]

virtual size_t Write ( const MaxString String)
pure virtual

Write an MaxString.

Parameters
StringString to write
Returns
Number of characters written

Implemented in ReaderWriter, and Writer.

◆ CanWrite()

virtual bool CanWrite ( ) const
pure virtual

Returns true if we can write to file.

Implemented in ReaderWriter, and Writer.

◆ IsFileOpen()

virtual bool IsFileOpen ( ) const
pure virtual

Returns true if file is open.

Implemented in ReaderWriter, and Writer.

◆ Flush()

virtual void Flush ( )
pure virtual

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

Implemented in ReaderWriter, and Writer.

◆ IsEndOfFile()

virtual bool IsEndOfFile ( ) const
pure virtual

Returns true if file at the end.

Implemented in ReaderWriter, and Writer.

◆ Position()

virtual size_t Position ( ) const
pure virtual

Get the current position in the file.

Implemented in ReaderWriter, and Writer.

◆ Seek()

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

Seek inside the stream.

Parameters
offsetThe seeks operations are done in number of characters (not bytes).
originThe 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 ReaderWriter, and Writer.

◆ Printf()

size_t Printf ( const wchar_t *  format,
  ... 
)

Write a formatted string using current locale.

Writes the format string, filled in by the optional arguments. See the ISO C++ documentation for more information on printf and format strings.

Parameters
formatThe format specification.
...optional arguments to format.
Precondition
format is not null.
There are the correct number of optional arguments to fill the format string.
Returns
The number of characters written.

◆ Vprintf()

size_t Vprintf ( const wchar_t *  format,
va_list  argList 
)

Write a formatted string using current locale.

Writes the format string, filled in by the optional arguments. See the ISO C++ documentation for more information on vprintf and format strings.

Parameters
formatThe format specification.
argListva_list to format.
Precondition
format is not null.
There are the correct number of optional arguments to fill the format string.
Returns
The number of characters written.

◆ Printf_l()

size_t Printf_l ( const wchar_t *  format,
const _locale_t  theLocale,
  ... 
)

Write a formatted string using a specified locale.

Writes the format string, filled in by the optional arguments. See the ISO C++ documentation for more information on printf and format strings.

Parameters
formatThe format specification.
theLocaleThe locale to use.
...optional arguments to format.
Precondition
format is not null.
There are the correct number of optional arguments to fill the format string.
Returns
The number of characters written.

◆ Vprintf_l()

size_t Vprintf_l ( const wchar_t *  format,
const _locale_t  theLocale,
va_list  argList 
)

Write a formatted string using a specified locale.

Writes the format string, filled in by the optional arguments. See the ISO C++ documentation for more information on vprintf and format strings.

Parameters
formatThe format specification.
theLocaleThe locale to use.
argListva_list to format.
Precondition
format is not null.
There are the correct number of optional arguments to fill the format string.
Returns
The number of characters written.