HDK
|
#include <UT_IStream.h>
Public Types | |
enum | { UT_SEEK_BEG =UT_IOS_SEEK_BEG, UT_SEEK_CUR =UT_IOS_SEEK_CUR, UT_SEEK_END =UT_IOS_SEEK_END } |
enum | FileSystemType { UT_FSYSTEM_UNKNOWN, UT_FSYSTEM_LOCAL, UT_FSYSTEM_NETWORK } |
Return whether the stream refers to a local drive or a network path. More... | |
Static Public Member Functions | |
static void | setStdinCompatible (bool state) |
Protected Member Functions | |
UT_IStream (const UT_StringHolder &filename, const UT_Options *open_options, bool bufferable) | |
UT_IStream (UT_IStreamBuf *sbuf, UT_ISTREAM_READTYPE binary) | |
void | initCommon (UT_ISTREAM_READTYPE binary) |
bool | readString (UT_String &str, bool binary) |
bool | readStdString (std::string &bytes, bool binary) |
bool | readStringHolder (UT_StringHolder &bytes, bool binary) |
bool | readWorkBuffer (UT_WorkBuffer &bytes, bool binary) |
void | setError () |
void | clearError () |
![]() | |
UT_NonCopyable ()=default | |
~UT_NonCopyable ()=default | |
UT_NonCopyable (const UT_NonCopyable &)=delete | |
UT_NonCopyable & | operator= (const UT_NonCopyable &)=delete |
Protected Attributes | |
UT_SmallArray< int, sizeof(int)*4 > | myBinaryStack |
UT_Array< const char * > | myOperationStack |
UT_IStreamBuf * | myStream |
UT_StringHolder | myLabel |
int | myVersion |
bool | myBinary |
bool | myEof |
bool | myError |
bool | myIsFile |
bool | myIsSubStream |
Definition at line 57 of file UT_IStream.h.
anonymous enum |
Enumerator | |
---|---|
UT_SEEK_BEG | |
UT_SEEK_CUR | |
UT_SEEK_END |
Definition at line 114 of file UT_IStream.h.
Return whether the stream refers to a local drive or a network path.
Enumerator | |
---|---|
UT_FSYSTEM_UNKNOWN | |
UT_FSYSTEM_LOCAL | |
UT_FSYSTEM_NETWORK |
Definition at line 133 of file UT_IStream.h.
|
inline |
WARNING: You MUST call init before using a default-constructed UT_IStream!
Definition at line 61 of file UT_IStream.h.
|
inline |
FIXME: Many functions will assert when bufferable is false, because they assume that they can read directly from the buffer.
Definition at line 66 of file UT_IStream.h.
|
inline |
Definition at line 69 of file UT_IStream.h.
|
inline |
Definition at line 72 of file UT_IStream.h.
|
inline |
Definition at line 76 of file UT_IStream.h.
|
virtual |
|
protected |
|
protected |
|
inline |
Definition at line 481 of file UT_IStream.h.
|
inline |
Definition at line 482 of file UT_IStream.h.
|
inline |
Definition at line 484 of file UT_IStream.h.
|
inline |
Definition at line 486 of file UT_IStream.h.
|
inline |
Definition at line 400 of file UT_IStream.h.
Read a floating point value of the specified source type into the given destination variable, performing a conversion as necessary.
Read a floating point value of the specified source type into the given destination variable, performing a conversion as necessary.
Read a floating point value of the specified source type into the given destination variable, performing a conversion as necessary.
Read a floating point value of the specified source type into the given destination variable, performing a conversion as necessary.
Read a floating point value of the specified source type into the given destination variable, performing a conversion as necessary.
Definition at line 430 of file UT_IStream.h.
Definition at line 436 of file UT_IStream.h.
Definition at line 438 of file UT_IStream.h.
Definition at line 441 of file UT_IStream.h.
Definition at line 444 of file UT_IStream.h.
Definition at line 447 of file UT_IStream.h.
|
inline |
Definition at line 449 of file UT_IStream.h.
|
inline |
Definition at line 450 of file UT_IStream.h.
|
inline |
Definition at line 452 of file UT_IStream.h.
|
inline |
Definition at line 454 of file UT_IStream.h.
Reads in the next token (skipping comments) and compares it to the expected value. Returns true if the tokens match, and false otherwise.
Definition at line 244 of file UT_IStream.h.
|
inline |
Reads in the next token and compares it to the expected value. Returns true if the tokens match, and false otherwise.
Definition at line 254 of file UT_IStream.h.
|
inlineprotected |
Definition at line 504 of file UT_IStream.h.
bool UT_IStream::getAll | ( | UT_WorkBuffer & | buffer | ) |
Reads in the entire stream from the current position to the end. Returns true if anything was read in, false otherwise. Use isError() to test error state.
bool UT_IStream::getAllAscii | ( | UT_WorkBuffer & | buffer | ) |
Does the same as getAll, except any carriage return-newline (
) sequences are converted into newlines (
).
UT_UniquePtr<UT_IStream> UT_IStream::getBloscStream | ( | ) |
|
inline |
getc and peek return the character read as an unsigned char cast to an int, or -1 (EOF) on failure. In other words, characters with the high bit set will return a number from 128 to 255, not a negative number.
Definition at line 268 of file UT_IStream.h.
int UT_IStream::getFileDescriptor | ( | ) | const |
Returns the open file descriptor, if any. Be careful what you do with it.
const char* UT_IStream::getFilename | ( | ) | const |
Retrieves the filename of this stream if it was created from file returns NULL otherwise
FileSystemType UT_IStream::getFileSystemType | ( | ) | const |
UT_UniquePtr<UT_IStream> UT_IStream::getGzipStream | ( | ) |
bool UT_IStream::getJSONWord | ( | UT_WorkBuffer & | buffer, |
bool & | real | ||
) |
Read a JSON token. This assumes that leading white space has been trimmed and will read all characters until:
|
inline |
Definition at line 166 of file UT_IStream.h.
bool UT_IStream::getLine | ( | UT_WorkBuffer & | buffer, |
int | end = '\n' |
||
) |
|
virtual |
NOTE: This counts the memory of the UT_IStreamBuf, even though it may be shared among multiple UT_IStream objects.
exint UT_IStream::getNonCommentLine | ( | UT_WorkBuffer & | buffer, |
int | comment = '#' , |
||
bool | strip_inline_comments = true |
||
) |
Skips all the comment lines and reads the next line in the stream. Returns the number of lines read. Note that the resulting line will be stripped of leading white space as well. The strip_inline_comments argument determines whether or not the resulting line should have comments at the end, if any, stripped.
bool UT_IStream::getNonCommentWord | ( | UT_WorkBuffer & | buffer, |
int | comment = '#' |
||
) |
Skips all the comment lines and reads the next token in the stream. Returns true if successful and false otherwise.
UT_UniquePtr<UT_IStream> UT_IStream::getSCStream | ( | ) |
|
inline |
Definition at line 187 of file UT_IStream.h.
bool UT_IStream::getString | ( | UT_WorkBuffer & | buffer | ) |
UT_UniquePtr<UT_IStream> UT_IStream::getSubStream | ( | exint | start, |
exint | nbytes | ||
) |
Returns a stream represenging a substream of the parent stream starting at 'start' byte and containin 'nbytes'.
|
inline |
Definition at line 160 of file UT_IStream.h.
bool UT_IStream::getWord | ( | UT_WorkBuffer & | buffer | ) |
UT_UniquePtr<UT_IStream> UT_IStream::getZlibStream | ( | ) |
void UT_IStream::init | ( | FILE * | fp, |
UT_ISTREAM_READTYPE | binary = UT_ISTREAM_BINARY , |
||
bool | bufferable = true |
||
) |
void UT_IStream::init | ( | std::istream & | is, |
UT_ISTREAM_READTYPE | binary = UT_ISTREAM_BINARY , |
||
bool | bufferable = true |
||
) |
void UT_IStream::init | ( | const char * | buffer, |
size_t | bufsize, | ||
UT_ISTREAM_READTYPE | binary | ||
) |
void UT_IStream::init | ( | const UT_WorkBuffer & | buffer, |
UT_ISTREAM_READTYPE | binary = UT_ISTREAM_ASCII |
||
) |
|
protected |
|
inline |
Definition at line 152 of file UT_IStream.h.
|
inline |
Definition at line 153 of file UT_IStream.h.
bool UT_IStream::isEof | ( | ) | const |
|
inline |
Definition at line 149 of file UT_IStream.h.
bool UT_IStream::isRandomAccessFile | ( | UT_WorkBuffer & | filename | ) | const |
Check whether the stream refers to a filename and whether the file supports random seeks.
|
inline |
Definition at line 105 of file UT_IStream.h.
|
inline |
Definition at line 270 of file UT_IStream.h.
void UT_IStream::popBinary | ( | ) |
void UT_IStream::popOperation | ( | ) |
void UT_IStream::pushBinary | ( | UT_ISTREAM_READTYPE | binary | ) |
The read() methods use the binary state of the stream to determine whether to read ASCII or binary values. Rather than calling this method directly, it would be better to create a UT_IStreamAutoBinary, which will automatically pop the state on its destruction.
For error handling. If an error occurs on the stream, the operation will be added to the error message (i.e. "loading image"). Rather than calling this method directly, it would probably be better to use UT_IStreamAutoOp which automatically pops the operation.
Definition at line 288 of file UT_IStream.h.
Definition at line 292 of file UT_IStream.h.
Definition at line 296 of file UT_IStream.h.
Definition at line 300 of file UT_IStream.h.
Definition at line 304 of file UT_IStream.h.
Definition at line 308 of file UT_IStream.h.
Definition at line 312 of file UT_IStream.h.
|
inline |
Definition at line 316 of file UT_IStream.h.
|
inline |
Definition at line 320 of file UT_IStream.h.
|
inline |
Definition at line 324 of file UT_IStream.h.
|
inline |
Definition at line 332 of file UT_IStream.h.
Definition at line 346 of file UT_IStream.h.
Read a floating point value of the specified source type into the given destination variable, performing a conversion as necessary.
Definition at line 410 of file UT_IStream.h.
Read a floating point value of the specified source type into the given destination variable, performing a conversion as necessary.
Definition at line 412 of file UT_IStream.h.
Read a floating point value of the specified source type into the given destination variable, performing a conversion as necessary.
Definition at line 414 of file UT_IStream.h.
Read a floating point value of the specified source type into the given destination variable, performing a conversion as necessary.
Definition at line 416 of file UT_IStream.h.
Read a floating point value of the specified source type into the given destination variable, performing a conversion as necessary.
Definition at line 418 of file UT_IStream.h.
bool UT_IStream::readBinaryString | ( | UT_String & | str, |
UT_ISTREAM_RLE_IO | startbits | ||
) |
Read a string that was saved by first writing the number of bytes in the stream, followed by the string itself. The length was stored using as few bytes as possible, and startbits specifies the minimum number of size bits it can expect. Note that a UT_String cannot contain data with null's, so use readBinaryData below or read(std::string &) for binary data.
bool UT_IStream::readBinaryString | ( | UT_StringHolder & | string, |
UT_ISTREAM_RLE_IO | startbits | ||
) |
|
inline |
Definition at line 390 of file UT_IStream.h.
|
inline |
Definition at line 394 of file UT_IStream.h.
|
protected |
|
protected |
|
protected |
exint UT_IStream::readStringRLE | ( | UT_ISTREAM_RLE_IO | startbits | ) |
Reads the length of a string buffer. This will be an integer of the provided startbits. If the value is negative, it signifies that the next larger integer will be stored after. The usual default value is 16 to match UT_String default saving.
|
protected |
bool UT_IStream::seekg | ( | exint | pos, |
int | seekdir = UT_SEEK_BEG |
||
) |
Query or seek to a position in the stream. Please see documentation for standard istreams for further information.
|
inline |
Definition at line 150 of file UT_IStream.h.
|
protected |
|
inline |
Definition at line 100 of file UT_IStream.h.
|
inline |
It can be useful to know if this stream is a substream, particularly when this stream is flagged as a file.
Definition at line 104 of file UT_IStream.h.
|
inline |
The label methods provide a way to give the stream a label which is used to identify the stream in error messages. For example, UT_IFStream sets the label to the filename.
Definition at line 165 of file UT_IStream.h.
|
static |
The version information can be used to stash version information with the stream itself rather than having to pass the version information through to all other loading methods. This is used primarily in legacy geometry loading.
Definition at line 159 of file UT_IStream.h.
Definition at line 521 of file UT_IStream.h.
Definition at line 545 of file UT_IStream.h.
|
inline |
Definition at line 533 of file UT_IStream.h.
|
inline |
Query or seek to a position in the stream. Please see documentation for standard istreams for further information.
Definition at line 123 of file UT_IStream.h.
|
inline |
Definition at line 277 of file UT_IStream.h.
|
inline |
Definition at line 278 of file UT_IStream.h.
|
protected |
Definition at line 515 of file UT_IStream.h.
|
protected |
Definition at line 508 of file UT_IStream.h.
|
protected |
Definition at line 515 of file UT_IStream.h.
|
protected |
Definition at line 515 of file UT_IStream.h.
|
protected |
Definition at line 516 of file UT_IStream.h.
|
protected |
Definition at line 517 of file UT_IStream.h.
|
protected |
Definition at line 513 of file UT_IStream.h.
Definition at line 510 of file UT_IStream.h.
|
protected |
Definition at line 512 of file UT_IStream.h.
|
protected |
Definition at line 514 of file UT_IStream.h.