![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
This class provides fast input file-streaming (binary mode).
Public Member Functions | |
TSLifstream () | |
TSLifstream (const char *s) | |
~TSLifstream () | |
bool | bad () const |
void | clear (int state=0) |
void | close () |
const void * | dataPointer () const |
void | enablePaging (bool state, TSLFileLength maximumFileSize=102400, unsigned int pageBufferSize=16384) |
bool | eof () const |
bool | erase (TSLFileOffset start, TSLFileOffset end) |
void | get (char &c) |
int | get () |
void | getline (char *buffer, int size, char delim='\n') |
bool | good () const |
bool | is_open () const |
void | open (const char *s) |
TSLifstream & | operator>> (char &out) |
TSLifstream & | operator>> (int &out) |
TSLifstream & | operator>> (float &out) |
TSLifstream & | operator>> (double &out) |
TSLifstream & | operator>> (int64_t &out) |
TSLifstream & | operator>> (uint64_t &out) |
int | peek () const |
bool | paged () |
bool | pagingEnabled (TSLFileLength &maximumFileSize, unsigned int &pageBufferSize) |
TSLifstream & | putback (char c) |
int | rdstate () const |
TSLifstream & | read (char *s, int n) |
TSLifstream & | read (unsigned char *s, int n) |
TSLifstream & | read (short *s, int n) |
TSLifstream & | read (unsigned short *s, int n) |
TSLifstream & | read (int *s, int n) |
TSLifstream & | read (unsigned int *s, int n) |
TSLifstream & | read (float *s, int n) |
TSLifstream & | read (double *s, int n) |
TSLifstream & | read (TSLVariant *s) |
TSLifstream & | read (int64_t *s, int n) |
TSLifstream & | read (uint64_t *s, int n) |
TSLFileLength | remaining () const |
void | seekg (TSLFilePosition pos) |
void | setstate (int state) |
TSLFileLength | size () const |
bool | swap () |
void | swap (bool _swap) |
TSLFilePosition | tellg () const |
TSLifstream & | operator>> (TSLLong &out) |
TSLifstream & | read (TSLLong *s, int n) |
TSLifstream & | read (TSLULong *s, int n) |
Static Public Member Functions | |
static TSLTextEncoding | legacyGetEncodingOverride () |
static void | legacySetEncodingOverride (TSLTextEncoding encoding) |
TSLifstream::TSLifstream | ( | ) |
Default constructor.
TSLifstream::TSLifstream | ( | const char * | s | ) |
This constructor tries to open the file with the given filename, s.
s | The name of the file to open. |
TSLifstream::~TSLifstream | ( | ) |
Destructor.
bool TSLifstream::bad | ( | ) | const |
Returns true to indicate a serious I/O error.
void TSLifstream::clear | ( | int | state = 0 | ) |
Sets or clears the error-state flags.
state | If 0, all error-state bits are cleared; otherwise the bits are set according to ios enumerator masks. |
void TSLifstream::close | ( | ) |
This method closes the file.
const void * TSLifstream::dataPointer | ( | ) | const |
This method returns a pointer to the start of the data buffer.
If the underlying file is paged or an error is detected a NULL pointer will be returned.
void TSLifstream::enablePaging | ( | bool | state, |
TSLFileLength | maximumFileSize = 102400, | ||
unsigned int | pageBufferSize = 16384 ) |
This method allows the user to enable paging of the stream.
Once a stream has been opened then the stream may not be paged.
This should be called before the stream is opened.
state | true enable paging, false disable paging. |
maximumFileSize | The maximum file size in Kb to read into memory before paging occurs (Default 100Mb). |
pageBufferSize | The buffer size in Kb to use when paging (Default 16Mb). |
bool TSLifstream::eof | ( | ) | const |
Returns true if end of file has been reached.
bool TSLifstream::erase | ( | TSLFileOffset | start, |
TSLFileOffset | end ) |
This method erases the section defined by start to end (inclusive of the index values).
The method will not work on a paged stream and the changes will not be reflected to the underlying storage.
The method is designed for manipulating in-memory data.
start | Start index. |
end | End index. |
int TSLifstream::get | ( | ) |
Extract a single character from the stream and stores it on the specified reference.
void TSLifstream::get | ( | char & | c | ) |
Extract a single character from the stream and return it.
c | A reference to the char. |
void TSLifstream::getline | ( | char * | buffer, |
int | size, | ||
char | delim = '\n' ) |
Extracts characters from the stream until either the delimiter is found, the limit size-1 is reached, or end of file is reached. The characters are stored in the specified array followed by a null terminator.
buffer | The array for storing the extracted elements. |
size | The maximum number of elements to extract including the terminating NULL. |
delim | The delimiter that marks the end of the line. |
bool TSLifstream::good | ( | ) | const |
Returns true if all error bits are clear.
bool TSLifstream::is_open | ( | ) | const |
Returns a nonzero value if this stream is attached to an open disk file identified by a file descriptor; otherwise 0.
|
static |
Get the legacy encoding override.
If set, this override specifies the encoding which non-utf8 text read from files should be converted from.
This function is only for use with legacy applications, and will be removed in a future release.
Returns the legacy text encoding override.
|
static |
Set the legacy text encoding override.
If set, this override specifies the encoding which non-utf8 text read from files should be converted from.
This function is only for use with legacy applications, and will be removed in a future release.
This function is not thread safe, and should be called once at the start of an application.
encoding | The text encoding to use. |
void TSLifstream::open | ( | const char * | s | ) |
This method tries to open the file with the given filename, s.
s | The name of the file to open. |
TSLifstream & TSLifstream::operator>> | ( | char & | out | ) |
Reads formatted data from the file's buffer.
out | The required char. |
TSLifstream & TSLifstream::operator>> | ( | double & | out | ) |
Reads formatted data from the file's buffer.
out | The required double. |
TSLifstream & TSLifstream::operator>> | ( | float & | out | ) |
Reads formatted data from the file's buffer.
out | The required float. |
TSLifstream & TSLifstream::operator>> | ( | int & | out | ) |
Reads formatted data from the file's buffer.
out | The required int. |
TSLifstream & TSLifstream::operator>> | ( | int64_t & | out | ) |
Reads formatted data from the file's buffer.
out | The required 64bit int |
TSLifstream & TSLifstream::operator>> | ( | TSLLong & | out | ) |
Reads formatted data from the file's buffer.
out | The required TSLLong |
TSLifstream & TSLifstream::operator>> | ( | uint64_t & | out | ) |
Reads formatted data from the file's buffer.
out | The required 64bit unsigned int |
bool TSLifstream::paged | ( | ) |
This method returns the true if the stream is being paged, i.e. the data is not all contained in memory.
bool TSLifstream::pagingEnabled | ( | TSLFileLength & | maximumFileSize, |
unsigned int & | pageBufferSize ) |
This method allows the user to query if paging is enabled.
This does not mean that the stream will have been paged. You need to call paged() to query if the stream is actually paged.
maximumFileSize | The maximum file size to read into memory before paging occurs is returned in this parameter. |
pageBufferSize | The buffer size to use when paging is returned in this parameter. |
int TSLifstream::peek | ( | ) | const |
Returns the next character without extracting it from the stream.
TSLifstream & TSLifstream::putback | ( | char | c | ) |
Puts a character back into the stream.
c | The character to put back. |
int TSLifstream::rdstate | ( | ) | const |
The member function returns the stored stream state information.
TSLifstream & TSLifstream::read | ( | char * | s, |
int | n ) |
This unformatted input method extracts up to n bytes and stores them in a char array beginning at s. Note that n is the number of bytes, not the number of elements. The number of bytes can be calculated by multiplying the number of elements by the size of the elements' data type.
s | The array for storing the extracted elements. |
n | The number of bytes to copy from the stream. |
TSLifstream & TSLifstream::read | ( | double * | s, |
int | n ) |
This unformatted input method extracts up to n bytes and stores them in a double array beginning at s. Note that n is the number of bytes, not the number of elements. The number of bytes can be calculated by multiplying the number of elements by the size of the elements' data type.
s | The array for storing the extracted elements. |
n | The number of bytes to copy from the stream. |
TSLifstream & TSLifstream::read | ( | float * | s, |
int | n ) |
This unformatted input method extracts up to n bytes and stores them in a float array beginning at s. Note that n is the number of bytes, not the number of elements. The number of bytes can be calculated by multiplying the number of elements by the size of the elements' data type.
s | The array for storing the extracted elements. |
n | The number of bytes to copy from the stream. |
TSLifstream & TSLifstream::read | ( | int * | s, |
int | n ) |
This unformatted input method extracts up to n bytes and stores them in an int array beginning at s. Note that n is the number of bytes, not the number of elements. The number of bytes can be calculated by multiplying the number of elements by the size of the elements' data type.
s | The array for storing the extracted elements. |
n | The number of bytes to copy from the stream. |
TSLifstream & TSLifstream::read | ( | int64_t * | s, |
int | n ) |
This unformatted input method extracts up to n bytes and stores them in a short array beginning at s. Note that n is the number of bytes, not the number of elements. The number of bytes can be calculated by multiplying the number of elements by the size of the elements' data type.
s | The array for storing the extracted elements. |
n | The number of bytes to copy from the stream. |
TSLifstream & TSLifstream::read | ( | short * | s, |
int | n ) |
This unformatted input method extracts up to n bytes and stores them in a short array beginning at s. Note that n is the number of bytes, not the number of elements. The number of bytes can be calculated by multiplying the number of elements by the size of the elements' data type.
s | The array for storing the extracted elements. |
n | The number of bytes to copy from the stream. |
TSLifstream & TSLifstream::read | ( | TSLLong * | s, |
int | n ) |
This unformatted input method extracts up to n bytes and stores them in a TSLLong array beginning at s. Note that n is the number of bytes, not the number of elements. The number of bytes can be calculated by multiplying the number of elements by the size of the elements' data type.
s | The array for storing the extracted elements. |
n | The number of bytes to copy from the stream. |
TSLifstream & TSLifstream::read | ( | TSLULong * | s, |
int | n ) |
This unformatted input method extracts up to n bytes and stores them in an TSLULong array beginning at s. Note that n is the number of bytes, not the number of elements. The number of bytes can be calculated by multiplying the number of elements by the size of the elements' data type.
s | The array for storing the extracted elements. |
n | The number of bytes to copy from the stream. |
TSLifstream & TSLifstream::read | ( | TSLVariant * | s | ) |
This unformatted input method extracts one TSLVariant and stores it in the variable pointed to by s.
s | Storage for the extracted element. |
TSLifstream & TSLifstream::read | ( | uint64_t * | s, |
int | n ) |
This unformatted input method extracts up to n bytes and stores them in a short array beginning at s. Note that n is the number of bytes, not the number of elements. The number of bytes can be calculated by multiplying the number of elements by the size of the elements' data type.
s | The array for storing the extracted elements. |
n | The number of bytes to copy from the stream. |
TSLifstream & TSLifstream::read | ( | unsigned char * | s, |
int | n ) |
This unformatted input method extracts up to n bytes and stores them in an unsigned char array beginning at s. Note that n is the number of bytes, not the number of elements. The number of bytes can be calculated by multiplying the number of elements by the size of the elements' data type.
s | The array for storing the extracted elements. |
n | The number of bytes to copy from the stream. |
TSLifstream & TSLifstream::read | ( | unsigned int * | s, |
int | n ) |
This unformatted input method extracts up to n bytes and stores them in an unsigned int array beginning at s. Note that n is the number of bytes, not the number of elements. The number of bytes can be calculated by multiplying the number of elements by the size of the elements' data type.
s | The array for storing the extracted elements. |
n | The number of bytes to copy from the stream. |
TSLifstream & TSLifstream::read | ( | unsigned short * | s, |
int | n ) |
This unformatted input method extracts up to n bytes and stores them in an unsigned short array beginning at s. Note that n is the number of bytes, not the number of elements. The number of bytes can be calculated by multiplying the number of elements by the size of the elements' data type.
s | The array for storing the extracted elements. |
n | The number of bytes to copy from the stream. |
TSLFileLength TSLifstream::remaining | ( | ) | const |
Returns the number of unread bytes remaining in the stream if known. If the number of remaining bytes is unknown, this method will return 0.
void TSLifstream::seekg | ( | TSLFilePosition | pos | ) |
Changes the get pointer for the stream.
pos | The new position value. |
void TSLifstream::setstate | ( | int | state | ) |
The member function effectively calls clear (state | rdstate() ).
TSLFileLength TSLifstream::size | ( | ) | const |
This method returns the size of the stream.
bool TSLifstream::swap | ( | ) |
Returns true if byte swapping is on, false otherwise.
void TSLifstream::swap | ( | bool | _swap | ) |
Allows the user to set the byte swapping on the stream.
_swap | true byte swap, false do not byte swap. |
TSLFilePosition TSLifstream::tellg | ( | ) | const |
Get the value for the stream's get pointer.