HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_IStream.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_IStream.h ( UT Library, C++)
7  *
8  * COMMENTS: Since the semantics of C++ streams leave a little bit to be
9  * desired, this class provides an efficient mechanism to read
10  * streams line by line.
11  *
12  * However, since this class buffers the stream input itself, it's
13  * not safe to use the stream outside of the class.
14  */
15 
16 #ifndef __UT_IStream__
17 #define __UT_IStream__
18 
19 #include "UT_API.h"
20 #include "UT_IOS.h"
21 #include "UT_WorkBuffer.h"
22 #include "UT_IntArray.h"
23 #include "UT_IStreamBuf.h"
24 #include "UT_ValArray.h"
25 #include <SYS/SYS_Types.h>
26 #include <fstream> // Only needed for gcc4.4 for handling of getc()
27 #include <stdio.h>
28 #include <string.h>
29 #include <string>
30 #include <iosfwd>
31 
32 class UT_String;
33 class UT_Options;
34 
35 typedef enum {
36  UT_ISTREAM_ASCII = UT_IOS_ASCII, // Ascii stream
39 
40 //
41 // When saving/loading binary strings, we store the run length of the string
42 // prior to saving the string data. This enum specifies the minimum value
43 // possible for the run-length.
44 //
45 // It is somewhat dangerous to use 8 bit lengths.
46 //
47 typedef enum {
53 
55 public:
56  /// WARNING: You MUST call init before using a default-constructed
57  /// UT_IStream!
59 
60  /// FIXME: Many functions will assert when bufferable is false,
61  /// because they assume that they can read directly from
62  /// the buffer.
64  bool bufferable=true)
65  { init(fp, binary, bufferable); }
67  bool bufferable=true)
68  { init(is, binary, bufferable); }
70  { init(buffer, bufsize, binary); }
73  { init(buffer, binary); }
74 
75  virtual ~UT_IStream();
76 
78  bool bufferable=true);
79  void init(std::istream &is, UT_ISTREAM_READTYPE binary=UT_ISTREAM_BINARY,
80  bool bufferable=true);
81  void init(const char *buffer, size_t bufsize, UT_ISTREAM_READTYPE binary);
82  void init(const UT_WorkBuffer &buffer,
84 
85  /// NOTE: This counts the memory of the UT_IStreamBuf, even though it
86  /// may be shared among multiple UT_IStream objects.
87  virtual int64 getMemoryUsage(bool inclusive) const;
88 
89  /// Retrieves the filename of this stream if it was created from file
90  /// returns NULL otherwise
91  const char* getFilename() const;
92 
93  void setIsFile(bool isFile) { myIsFile = isFile; }
94 
95  /// It can be useful to know if this stream is a substream, particularly
96  /// when this stream is flagged as a file.
97  void setIsSubStream(bool is_sub_stream) { myIsSubStream = is_sub_stream; }
98  bool isSubStream() const { return myIsSubStream; }
99 
100  // Typically, when reading from a non-tty stdin, istreams are able to
101  // buffer the contents. However, in some cases, when there's a
102  // controlling application sending commands sporadically, it's important
103  // to set compatibility on stdin. This will result in slightly slower
104  // input and should only be used when required.
105  static void setStdinCompatible(bool state);
106 
107  enum {
108  UT_SEEK_BEG=UT_IOS_SEEK_BEG, // Seek from beginning of stream
109  UT_SEEK_CUR=UT_IOS_SEEK_CUR, // Seek from current location
110  UT_SEEK_END=UT_IOS_SEEK_END // Seek from the end of the stream
111  };
112 
113  /// @{
114  /// Query or seek to a position in the stream. Please see documentation
115  /// for standard istreams for further information.
116  exint tellg() const
117  { return myStream->tellg(); }
118  bool seekg(exint pos, int seekdir=UT_SEEK_BEG);
119  /// @}
120 
121  /// Check whether the stream refers to a filename and whether the file
122  /// supports random seeks.
123  bool isRandomAccessFile(UT_WorkBuffer &filename) const;
124 
125  /// Return whether the stream refers to a local drive or a network path.
126  typedef enum {
127  UT_FSYSTEM_UNKNOWN, // Unknown file system
128  UT_FSYSTEM_LOCAL, // Local file system
129  UT_FSYSTEM_NETWORK, // NFS or SMB file system
130  } FileSystemType;
131  FileSystemType getFileSystemType() const;
132 
133  /// Returns the open file descriptor, if any. Be careful what you do with
134  /// it.
135  int getFileDescriptor() const;
136 
137  // Returns true if the stream is out of data OR if there's an error on the
138  // stream.
139  bool isEof() const;
140 
141  // Return the error status.
142  bool isError() const { return myError; }
143  void setError(bool is_error) { myError = is_error; }
144 
145  bool isAscii() const { return !myBinary; }
146  bool isBinary() const { return myBinary; }
147 
148  /// The version information can be used to stash version information with
149  /// the stream itself rather than having to pass the version information
150  /// through to all other loading methods. This is used primarily in
151  /// legacy geometry loading.
152  void setVersion(int version) { myVersion = version; }
153  int getVersion() const { return myVersion; }
154 
155  /// The label methods provide a way to give the stream a label which is
156  /// used to identify the stream in error messages. For example,
157  /// UT_IFStream sets the label to the filename.
158  void setLabel(const char *label);
159  const char *getLabel() const { return myLabel ? myLabel : ""; }
160 
161  /// The read() methods use the binary state of the stream to determine
162  /// whether to read ASCII or binary values. Rather than calling this
163  /// method directly, it would be better to create a UT_IStreamAutoBinary,
164  /// which will automatically pop the state on its destruction.
165  void pushBinary(UT_ISTREAM_READTYPE binary);
166  void popBinary();
167 
168  /// For error handling. If an error occurs on the stream, the operation
169  /// will be added to the error message (i.e. "loading image"). Rather
170  /// than calling this method directly, it would probably be better to use
171  /// UT_IStreamAutoOp which automatically pops the operation.
172  void pushOperation(const char *operation);
173  void popOperation();
174 
175  // Set a sub-range of the stream. The stream will automatically seek the
176  // the start position specified. The stream will hit EOF when nbytes have
177  // been read from the stream. Seeking should work (assertions will be
178  // triggered if the seek is out of bounds). Absolute seek positions are
179  // specified based on the original stream.
180  UT_IStreamBuf *getStreamBuffer() { return myStream; }
181 
182  /// Returns a stream represenging a substream of the parent stream starting
183  /// at 'start' byte and containin 'nbytes'.
184  /// The caller needs to delete the returned object, once not needed.
185  UT_IStream *getSubStream(exint start, exint nbytes);
186 
187  // The zlib, gzip, and blosc streams are available for decompression.
188  // The difference between zlib and gzip is subtle, but very important.
189  // - zlib compression uses the zlib library to perform inflation of the
190  // data. However, the bit window specified is slightly different
191  // than for gzip compression.
192  // - gzip compression uses the zlib library to perform inflation of the
193  // data. However, it expects that the data has a gzip header
194  // before the compressed data begins. As well, the window size is
195  // slightly different than raw zlib compression.
196  /// It is the caller's responsibility to delete the returned stream object.
197  UT_IStream *getZlibStream();
198  UT_IStream *getGzipStream();
199  UT_IStream *getBloscStream();
200  UT_IStream *getSCStream();
201 
202  bool getLine(UT_WorkBuffer &buffer, int end='\n');
203  bool skipLine(int end='\n');
204  bool getWord(UT_WorkBuffer &buffer);
205  bool getString(UT_WorkBuffer &buffer);
206  bool skipWhitespace(int64 &line_count, int64 &line_start_pos);
207  bool skipWhitespace();
208 
209  /// Read a JSON token. This assumes that leading white space has been
210  /// trimmed and will read all characters until:
211  /// - a space (\\f, \\v, \\r, \\n, \\t, ' ')
212  /// - a separator ('/', '{', '}', '[', ']', ',', ':', '"')
213  /// @note The real flag will be set if the word contains ('.', 'e', or 'E')
214  bool getJSONWord(UT_WorkBuffer &buffer, bool &real);
215 
216  /// Reads in the entire stream from the current position to the end.
217  /// Returns true if anything was read in, false otherwise. Use
218  /// isError() to test error state.
219  bool getAll(UT_WorkBuffer &buffer);
220 
221  /// Does the same as getAll, except any carriage return-newline (\r\n)
222  /// sequences are converted into newlines (\n).
223  bool getAllAscii(UT_WorkBuffer &buffer);
224 
225  /// Skips all the comment lines and reads the next token in the stream.
226  /// Returns true if successful and false otherwise.
227  bool getNonCommentWord(UT_WorkBuffer &buffer, int comment='#');
228 
229  /// Skips all the comment lines and reads the next line in the stream.
230  /// Returns the number of lines read. Note that the resulting line will
231  /// be stripped of leading white space as well. The
232  /// strip_inline_comments argument determines whether or not the resulting
233  /// line should have comments at the end, if any, stripped.
234  exint getNonCommentLine(UT_WorkBuffer &buffer, int comment='#',
235  bool strip_inline_comments = true);
236 
237  /// Reads in the next token (skipping comments) and compares it to the
238  /// expected value. Returns true if the tokens match, and false otherwise.
239  bool checkNonCommentToken(const char *expected, int comment='#')
240  {
241  UT_WorkBuffer wbuf;
242  if (!getNonCommentWord(wbuf, comment))
243  return false;
244  return !strcmp(wbuf.buffer(), expected);
245  }
246 
247  /// Reads in the next token and compares it to the expected value.
248  /// Returns true if the tokens match, and false otherwise.
249  bool checkToken(const char *expected)
250  {
251  UT_WorkBuffer wbuf;
252  if (!getWord(wbuf))
253  return false;
254  return !strcmp(wbuf.buffer(), expected);
255  }
256 
257  /// getc and peek return the character read as an unsigned char cast to an
258  /// int, or -1 (EOF) on failure. In other words, characters with the high
259  /// bit set will return a number from 128 to 255, not a negative number.
260  inline int getc()
261  { return myStream->getc(); }
262  inline int peek()
263  { return myStream->peekc(); }
264 
265  // Returns the number of characters the stream was able to rewind. The
266  // class is guaranteed to be able to put back one character if myBufferable.
267  // Otherwise, you takes your chances. This is not true if you peek into the
268  // stream. Calling peek() may cause backup to fail.
269  exint ungetc() { return unwind(1); }
271  { return myStream->unwind(amount); }
272 
273  // Read data into an array of the given type. The data will be
274  // byte-swapped according to the Houdini standard. The size specified is
275  // the number of elements in the array (not the size in bytes).
276  //
277  // Due to an ambiguity when reading characters from an ASCII stream,
278  // there is no generic method to read characters. Use the bread() method
279  // to read raw characters, or the getWord() method to read a word.
280  exint read(bool *array, exint sz=1)
281  {
282  return myBinary ? bread(array, sz) : aread(array, sz);
283  }
284  exint read(int16 *array, exint sz=1)
285  {
286  return myBinary ? bread(array, sz) : aread(array, sz);
287  }
288  exint read(uint16 *array, exint sz=1)
289  {
290  return myBinary ? bread(array, sz) : aread(array, sz);
291  }
292  exint read(int32 *array, exint sz=1)
293  {
294  return myBinary ? bread(array, sz) : aread(array, sz);
295  }
296  exint read(uint32 *array, exint sz=1)
297  {
298  return myBinary ? bread(array, sz) : aread(array, sz);
299  }
300  exint read(int64 *array, exint sz=1)
301  {
302  return myBinary ? bread(array, sz) : aread(array, sz);
303  }
304  exint read(uint64 *array, exint sz=1)
305  {
306  return myBinary ? bread(array, sz) : aread(array, sz);
307  }
308  bool read(UT_String &string)
309  {
310  return myBinary ? bread(string) : aread(string);
311  }
312  bool read(std::string &bytes)
313  {
314  return myBinary ? bread(bytes) : aread(bytes);
315  }
316  bool read(UT_StringHolder &string)
317  {
318  return readStringHolder(string, myBinary);
319  }
320 
321  // Helpers for reading sz elements from the stream, but only storing
322  // the first max_elem number of elements.
323  template <typename SOURCE_TYPE, typename T>
324  exint read(T *array, exint sz, exint max_elem)
325  {
326  exint n = (max_elem <= sz) ? max_elem : sz;
327  exint i = read<SOURCE_TYPE>(array, n);
328  if (i <= max_elem)
329  return i;
330  SOURCE_TYPE dummy;
331  for (i = max_elem; i < sz; i++)
332  {
333  if (!read<SOURCE_TYPE>(&dummy))
334  break;
335  }
336  return i;
337  }
338  exint read(bool *array, exint sz, exint max_elem)
339  {
340  exint n = (max_elem <= sz) ? max_elem : sz;
341  exint i = read(array, n);
342  if (i <= max_elem)
343  return i;
344  bool dummy;
345  for (i = max_elem; i < sz; i++)
346  {
347  if (!read(&dummy))
348  break;
349  }
350  return i;
351  }
352 
353  // Read a string that was saved by first writing the number of bytes in the
354  // stream, followed by the string itself. The length was stored using as
355  // few bytes as possible, and startbits specifies the minimum number of
356  // size bits it can expect. Note that a UT_String cannot contain data with
357  // null's, so use readBinaryData below or read(std::string &) for binary
358  // data.
359  bool readBinaryString(UT_String &str, UT_ISTREAM_RLE_IO startbits);
360  bool readBinaryString(UT_StringHolder &string,
361  UT_ISTREAM_RLE_IO startbits);
362 
363  // Read a chunk of binary data, returning NULL if the data could not be
364  // read for some reason. The exint size of the data is returned in the
365  // "size" parameter. If add_null is true, the data is null-terminated
366  // and "size" includes the space for the null terminator. The caller
367  // is responsible for calling free() on the result. It is safe to adopt
368  // the result into a UT_String.
369  char *readBinaryData(
370  exint &size, UT_ISTREAM_RLE_IO startbits, bool add_null=false);
371 
372  bool readBool(bool &result)
373  {
374  return (read(&result) == 1);
375  }
376  bool readChar(char &result)
377  {
378  if (isBinary())
379  return bread(&result) == 1;
380  return areadChar(result);
381  }
382  bool areadChar(char &result)
383  {
384  if (!skipWhitespace())
385  return false;
386  return bread(&result, 1) == 1;
387  }
388 
389  /// Read a floating point value of the specified source type into the given
390  /// destination variable, performing a conversion as necessary.
391  // @{
392  template <typename SOURCE_TYPE> exint read(int32 *val, exint sz=1)
393  { return myBinary ? bread<SOURCE_TYPE>(val, sz) : aread(val, sz); }
394  template <typename SOURCE_TYPE> exint read(int64 *val, exint sz=1)
395  { return myBinary ? bread<SOURCE_TYPE>(val, sz) : aread(val, sz); }
396  template <typename SOURCE_TYPE> exint read(fpreal16 *val, exint sz=1)
397  { return myBinary ? bread<SOURCE_TYPE>(val, sz) : aread(val, sz); }
398  template <typename SOURCE_TYPE> exint read(fpreal32 *val, exint sz=1)
399  { return myBinary ? bread<SOURCE_TYPE>(val, sz) : aread(val, sz); }
400  template <typename SOURCE_TYPE> exint read(fpreal64 *val, exint sz=1)
401  { return myBinary ? bread<SOURCE_TYPE>(val, sz) : aread(val, sz); }
402 
403  template <typename SOURCE_TYPE> exint bread(int32 *buffer, exint asize=1);
404  template <typename SOURCE_TYPE> exint bread(int64 *buffer, exint asize=1);
405  template <typename SOURCE_TYPE> exint bread(fpreal16 *buffer, exint asize=1);
406  template <typename SOURCE_TYPE> exint bread(fpreal32 *buffer, exint asize=1);
407  template <typename SOURCE_TYPE> exint bread(fpreal64 *buffer, exint asize=1);
408  // @}
409 
410  // Platform consistent binary reads of data. The read methods return the
411  // number of elements read.
412  inline exint bread(bool *buffer, exint size=1)
413  {
414  UT_ASSERT_COMPILETIME(sizeof(bool) == sizeof(char));
415  return bread(reinterpret_cast<char *>(buffer), size);
416  }
417  exint bread(char *buffer, exint asize=1);
418  exint bread(unsigned char *buffer, exint asize=1)
419  { return bread((char *)buffer, asize); }
420  exint bread(signed char *buffer, exint asize=1)
421  { return bread((char *)buffer, asize); }
422  exint bread(int16 *buffer, exint asize=1);
424  { return bread((int16 *)buffer, asize); }
425  exint bread(int32 *buffer, exint asize=1);
427  { return bread((int32 *)buffer, asize); }
428  exint bread(int64 *buffer, exint asize=1);
430  { return bread((int64 *)buffer, asize); }
431  bool bread(UT_String &str) { return readString(str, true); }
432  bool bread(std::string &bytes)
433  { return readStdString(bytes, true); }
434  bool bread(UT_StringHolder &bytes)
435  { return readStringHolder(bytes, true); }
436 
437  // Read ASCII values into the buffers. The process is that we read a word,
438  // then run atoi() or atof() on the token. This does NOT set an error bit
439  // if the word is not an integer.
440  //
441  // The aread(char *) method does not exist due to an ambiguity.
442  // The following code:
443  // char chr;
444  // is.read(&chr);
445  // would skip whitespace when reading from an ASCII stream. Since this is
446  // error prone (i.e. you might expect the next character of the stream to
447  // be read), there is no implicit ASCII read method for an array of
448  // characters. To read a single character, please call readChar() or
449  // areadChar().
450  //
451  exint aread(bool *buffer, exint asize=1);
452  exint aread(int16 *buffer, exint asize=1);
453  exint aread(uint16 *buffer, exint asize=1);
454  exint aread(int32 *buffer, exint asize=1);
455  exint aread(uint32 *buffer, exint asize=1);
456  exint aread(int64 *buffer, exint asize=1);
457  exint aread(uint64 *buffer, exint asize=1);
458  exint aread(fpreal16 *buffer, exint asize=1);
459  exint aread(fpreal32 *buffer, exint asize=1);
460  exint aread(fpreal64 *buffer, exint asize=1);
461  bool aread(UT_String &str) { return readString(str, false); }
462  bool aread(std::string &bytes)
463  { return readStdString(bytes, false); }
464  bool aread(UT_StringHolder &bytes)
465  { return readStringHolder(bytes, false); }
466 
467 protected:
468  // Protected constructors (used either internally or by sub-classes)
469 
470  // If you can't access this, you want a UT_IFStream subclass
471  UT_IStream(const char *filename, const UT_Options *open_options,
472  bool bufferable);
474 
475 protected:
476  void initCommon(UT_ISTREAM_READTYPE binary);
477  bool readString(UT_String &str, bool binary);
478  bool readStdString(std::string &bytes, bool binary);
479  bool readStringHolder(UT_StringHolder &bytes, bool binary);
480  void setError();
481  inline void clearError()
482  { myError = false; }
483 
487  char *myLabel;
489  bool myBinary, myEof, myError;
490  bool myIsFile;
492 };
493 
494 //
495 // Simple wrapper class for file streams that handles open and close of the
496 // file automatically.
497 class UT_API UT_IFStream : public UT_IStream {
498 public:
499  UT_IFStream();
500 
501  /// Open a file for input
502  ///
503  /// Known Options
504  /// cache_mode "random" or "sequential" hint
505  /// ascii true or false (performs CRLF translation on Windows)
506  /// @{
507  UT_IFStream(
508  const char *filename,
510  const UT_Options *options=NULL,
511  bool bufferable=true);
512  bool open(
513  const char *filename,
515  const UT_Options *options=NULL,
516  bool bufferable=true);
517  /// @}
518 
519  virtual ~UT_IFStream();
520 
521  bool close();
522 };
523 
524 //
525 // Compressed data input.
526 // Please see the getZlib and getGzip stream methods on UT_IStream.
527 class UT_API UT_IZStream : public UT_IStream {
528 public:
530  virtual ~UT_IZStream();
531 };
532 
534 public:
536  virtual ~UT_IGZStream();
537 };
538 
539 // Data input encrypted with a blowfish algorithm.
541 public:
542  UT_IBlowfishStream(UT_IStream &src, const unsigned char * key,
543  exint key_size,
545  virtual ~UT_IBlowfishStream();
546 
547  /// Obtains the length of data after it has been decrypted from the stream.
548  static exint getPlainTextLength(UT_IStream &src);
549 };
550 
551 //
552 // Turn the stream into binary or ASCII while scoped
554 public:
556  : myIs(is)
557  {
558  myIs.pushBinary(binary);
559  }
561  : myIs(is)
562  {
563  myIs.pushBinary(binary ? UT_ISTREAM_BINARY : UT_ISTREAM_ASCII);
564  }
566  {
567  myIs.popBinary();
568  }
569 private:
570  UT_IStream &myIs;
571 };
572 
573 //
574 // Push operations being performed on the stream. This is for error
575 // reporting.
577 public:
578  // Typically the strings will be compile time defined, which means they
579  // don't need to be hardened. The UT_IStream expects the operation string
580  // to be around for the duration of the operation.
581  explicit UT_IStreamAutoOp(UT_IStream &is, const char *operation,
582  bool harden = false)
583  : myIs(is),
584  myOperation(operation, harden ? 1 : 0)
585  {
586  myIs.pushOperation(myOperation);
587  }
589  {
590  myIs.popOperation();
591  }
592 private:
593  UT_IStream &myIs;
594  UT_String myOperation;
595 };
596 
597 #endif
UT_IStream(FILE *fp, UT_ISTREAM_READTYPE binary=UT_ISTREAM_BINARY, bool bufferable=true)
Definition: UT_IStream.h:63
#define UT_ASSERT_COMPILETIME(expr)
Definition: UT_Assert.h:109
bool checkNonCommentToken(const char *expected, int comment='#')
Definition: UT_IStream.h:239
bool myError
Definition: UT_IStream.h:489
exint unwind(exint amount)
Definition: UT_IStream.h:270
GLenum GLuint GLsizei bufsize
Definition: glcorearb.h:1817
UT_IStreamBuf * getStreamBuffer()
Definition: UT_IStream.h:180
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2544
exint read(uint64 *array, exint sz=1)
Definition: UT_IStream.h:304
UT_IStream(std::istream &is, UT_ISTREAM_READTYPE binary=UT_ISTREAM_BINARY, bool bufferable=true)
Definition: UT_IStream.h:66
exint read(T *array, exint sz, exint max_elem)
Definition: UT_IStream.h:324
exint read(int16 *array, exint sz=1)
Definition: UT_IStream.h:284
bool isAscii() const
Definition: UT_IStream.h:145
bool readBool(bool &result)
Definition: UT_IStream.h:372
GLuint start
Definition: glcorearb.h:474
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
const GLuint GLenum const void * binary
Definition: glcorearb.h:1923
UT_ISTREAM_RLE_IO
Definition: UT_IStream.h:47
UT_IStream(const UT_WorkBuffer &buffer, UT_ISTREAM_READTYPE binary=UT_ISTREAM_ASCII)
Definition: UT_IStream.h:71
void setIsFile(bool isFile)
Definition: UT_IStream.h:93
bool checkToken(const char *expected)
Definition: UT_IStream.h:249
bool aread(UT_String &str)
Definition: UT_IStream.h:461
bool read(std::string &bytes)
Definition: UT_IStream.h:312
#define UT_API
Definition: UT_API.h:12
exint tellg() const
Definition: UT_IStream.h:116
const char * getLabel() const
Definition: UT_IStream.h:159
int getVersion() const
Definition: UT_IStream.h:153
bool read(UT_String &string)
Definition: UT_IStream.h:308
void read(T &in, bool &v)
Definition: ImfXdr.h:611
GLuint buffer
Definition: glcorearb.h:659
png_uint_32 i
Definition: png.h:2877
GLsizeiptr size
Definition: glcorearb.h:663
exint bread(signed char *buffer, exint asize=1)
Definition: UT_IStream.h:420
exint read(int64 *val, exint sz=1)
Definition: UT_IStream.h:394
exint bread(bool *buffer, exint size=1)
Definition: UT_IStream.h:412
exint bread(uint64 *buffer, exint asize=1)
Definition: UT_IStream.h:429
UT_IStreamBuf * myStream
Definition: UT_IStream.h:486
exint bread(uint16 *buffer, exint asize=1)
Definition: UT_IStream.h:423
exint bread(uint32 *buffer, exint asize=1)
Definition: UT_IStream.h:426
long long int64
Definition: SYS_Types.h:106
png_FILE_p fp
Definition: png.h:2028
GLdouble n
Definition: glcorearb.h:2007
void setVersion(int version)
Definition: UT_IStream.h:152
unsigned long long uint64
Definition: SYS_Types.h:107
bool isError() const
Definition: UT_IStream.h:142
exint read(fpreal32 *val, exint sz=1)
Definition: UT_IStream.h:398
bool bread(std::string &bytes)
Definition: UT_IStream.h:432
exint read(fpreal16 *val, exint sz=1)
Definition: UT_IStream.h:396
exint ungetc()
Definition: UT_IStream.h:269
int64 exint
Definition: SYS_Types.h:115
double fpreal64
Definition: SYS_Types.h:191
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:280
UT_IntArray myBinaryStack
Definition: UT_IStream.h:484
GLuint GLuint end
Definition: glcorearb.h:474
UT_IStream(const char *buffer, size_t bufsize, UT_ISTREAM_READTYPE binary)
Definition: UT_IStream.h:69
bool myIsFile
Definition: UT_IStream.h:490
UT_ValArray< const char * > myOperationStack
Definition: UT_IStream.h:485
bool myIsSubStream
Definition: UT_IStream.h:491
UT_IStreamAutoOp(UT_IStream &is, const char *operation, bool harden=false)
Definition: UT_IStream.h:581
char * myLabel
Definition: UT_IStream.h:487
int int32
Definition: SYS_Types.h:34
virtual int open(float queuesize)
exint read(uint32 *array, exint sz=1)
Definition: UT_IStream.h:296
int myVersion
Definition: UT_IStream.h:488
bool isSubStream() const
Definition: UT_IStream.h:98
void setError(bool is_error)
Definition: UT_IStream.h:143
UT_IStreamAutoBinary(UT_IStream &is, UT_ISTREAM_READTYPE binary)
Definition: UT_IStream.h:555
unsigned short uint16
Definition: SYS_Types.h:33
bool bread(UT_String &str)
Definition: UT_IStream.h:431
A map of string to various well defined value types.
Definition: UT_Options.h:42
bool areadChar(char &result)
Definition: UT_IStream.h:382
bool aread(UT_StringHolder &bytes)
Definition: UT_IStream.h:464
void setIsSubStream(bool is_sub_stream)
Definition: UT_IStream.h:97
UT_ISTREAM_READTYPE
Definition: UT_IStream.h:35
exint read(int64 *array, exint sz=1)
Definition: UT_IStream.h:300
virtual void close()
bool isBinary() const
Definition: UT_IStream.h:146
GLuint GLfloat * val
Definition: glcorearb.h:1607
bool aread(std::string &bytes)
Definition: UT_IStream.h:462
Name readString(std::istream &is)
Definition: Name.h:47
exint read(int32 *array, exint sz=1)
Definition: UT_IStream.h:292
const char * buffer() const
void clearError()
Definition: UT_IStream.h:481
exint read(int32 *val, exint sz=1)
Definition: UT_IStream.h:392
bool read(UT_StringHolder &string)
Definition: UT_IStream.h:316
bool readChar(char &result)
Definition: UT_IStream.h:376
exint bread(unsigned char *buffer, exint asize=1)
Definition: UT_IStream.h:418
int peek()
Definition: UT_IStream.h:262
exint read(uint16 *array, exint sz=1)
Definition: UT_IStream.h:288
exint read(bool *array, exint sz, exint max_elem)
Definition: UT_IStream.h:338
short int16
Definition: SYS_Types.h:32
UT_IStreamAutoBinary(UT_IStream &is, bool binary)
Definition: UT_IStream.h:560
float fpreal32
Definition: SYS_Types.h:190
bool bread(UT_StringHolder &bytes)
Definition: UT_IStream.h:434
exint read(fpreal64 *val, exint sz=1)
Definition: UT_IStream.h:400
int getc()
Definition: UT_IStream.h:260
GLenum src
Definition: glcorearb.h:1792
unsigned int uint32
Definition: SYS_Types.h:35