maxscript/foundation/readonlytextfilestream.h File Reference

readonlytextfilestream.h File Reference
+ This reference page is linked to from the following overview topics:

#include "streams.h"

Functions

invisible_class(ReadonlyTextFileStream)
class ReadonlyTextFileStream
ScripterExport 
~ReadonlyTextFileStream ()
 ReadonlyTextFileStream is only used for opening text file in read-only mode. More...
 
ScripterExport
ReadonlyTextFileStream * 
open (const MCHAR *ifile_name, unsigned int encoding=-1)
 Open a new text file. More...
 
MaxSDK::Util::Char get_char ()
 
void unget_char (const MaxSDK::Util::Char &c)
 
MaxSDK::Util::Char peek_char ()
 
int at_eos ()
 
unsigned int pos ()
 
void seek (int pos)
 
void rewind ()
 
void flush_to_eol ()
 
MaxSDK::Util::Char putch (const MaxSDK::Util::Char &c)
 
const MCHARputs (const MCHAR *str)
 
int printf (const MCHAR *format,...)
 
void collect ()
 
void close ()
 
void gc_trace ()
 
void log_to (CharStream *log)
 
void close_log ()
 
CharStreamget_log ()
 

Variables

int mUngetcharCount
 
MaxSDK::Util::Char mUngetcharBuf [8]
 
MaxSDK::Util::CharmFileBuf
 
size_t mCharCount
 
size_t mCharPos
 
CharStreammLog
 

Function Documentation

invisible_class (ReadonlyTextFileStream) class ReadonlyTextFileStream ScripterExport ~ReadonlyTextFileStream ( )

ReadonlyTextFileStream is only used for opening text file in read-only mode.

It's equivalent to use FileStream when opening files in "rt" mode. But FileStream is very slow when reading files. So we optimize the original codes in FileStream and create this new class which is thousand times faster for reading text files than FileStream.

Note
Invoke any non-read-only methods in ReadonlyTextFileStream will result in a runtime exception. Such methods include putch(),puts(),printf(). The default constructor. The default destructor.
ScripterExport ReadonlyTextFileStream* open ( const MCHAR ifile_name,
unsigned int  encoding = -1 
)

Open a new text file.

Parameters
[in]ifile_nameThe file name.
[in]encodingThe encoding to use if if can not be determined from the file contents, If -1, a default encoding based on the file language setting in Preference /Files (exposed through Interface14) will be used.
Returns
The ReadonlyTextFileStream instance itself if max is able to open the file or undefined if it fails.
MaxSDK::Util::Char get_char ( )
void unget_char ( const MaxSDK::Util::Char c)
MaxSDK::Util::Char peek_char ( )
int at_eos ( )
unsigned int pos ( )
void seek ( int  pos)
void rewind ( )
void flush_to_eol ( )
MaxSDK::Util::Char putch ( const MaxSDK::Util::Char c)
64 { return c; }
const MCHAR* puts ( const MCHAR str)
65 { return str; }
int printf ( const MCHAR format,
  ... 
)
69 { return 0; }
void collect ( )
void close ( )
void gc_trace ( )
void log_to ( CharStream log)
void close_log ( )
CharStream* get_log ( )
77 { return NULL; }
#define NULL
Definition: autoptr.h:20

Variable Documentation

int mUngetcharCount
MaxSDK::Util::Char mUngetcharBuf[8]
MaxSDK::Util::Char* mFileBuf
size_t mCharCount
size_t mCharPos
CharStream* mLog