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