00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 #ifndef STREAMREADER_H
00020 #define STREAMREADER_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "numeric_types.h"
00025 #include "littleEndian.h"
00026 #include "bigEndian.h"
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 class EXPCL_PANDAEXPRESS StreamReader {
00035 public:
00036   INLINE StreamReader(istream &in);
00037 PUBLISHED:
00038   INLINE StreamReader(istream *in, bool owns_stream);
00039   INLINE StreamReader(const StreamReader ©);
00040   INLINE void operator = (const StreamReader ©);
00041   INLINE ~StreamReader();
00042 
00043   INLINE istream *get_istream() const;
00044 
00045   INLINE bool get_bool();
00046   INLINE PN_int8 get_int8();
00047   INLINE PN_uint8 get_uint8();
00048 
00049   INLINE PN_int16 get_int16();
00050   INLINE PN_int32 get_int32();
00051   INLINE PN_int64 get_int64();
00052   INLINE PN_uint16 get_uint16();
00053   INLINE PN_uint32 get_uint32();
00054   INLINE PN_uint64 get_uint64();
00055   INLINE float get_float32();
00056   INLINE PN_float64 get_float64();
00057 
00058   INLINE PN_int16 get_be_int16();
00059   INLINE PN_int32 get_be_int32();
00060   INLINE PN_int64 get_be_int64();
00061   INLINE PN_uint16 get_be_uint16();
00062   INLINE PN_uint32 get_be_uint32();
00063   INLINE PN_uint64 get_be_uint64();
00064   INLINE float get_be_float32();
00065   INLINE PN_float64 get_be_float64();
00066 
00067   string get_string();
00068   string get_z_string();
00069   string get_fixed_string(size_t size);
00070 
00071   void skip_bytes(size_t size);
00072   string extract_bytes(size_t size);
00073 
00074   string readline();
00075 
00076 private:
00077   istream *_in;
00078   bool _owns_stream;
00079 };
00080 
00081 #include "streamReader.I"
00082 
00083 #endif