Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef GNASH_IOCHANNEL_H
00022 #define GNASH_IOCHANNEL_H
00023
00024 #include <string>
00025 #include <boost/cstdint.hpp>
00026 #include <iosfwd>
00027
00028 #include "dsodefs.h"
00029 #include "GnashException.h"
00030
00031 namespace gnash {
00032
00034 class DSOEXPORT IOException : public GnashException
00035 {
00036 public:
00037 IOException(const std::string& s) : GnashException(s) {}
00038 IOException() : GnashException("IO error") {}
00039 };
00040
00042 class DSOEXPORT IOChannel
00043 {
00044 public:
00045
00046 virtual ~IOChannel() {}
00047
00050
00053 boost::uint32_t read_le32();
00054
00056
00059 boost::uint16_t read_le16();
00060
00062
00065 boost::uint8_t read_byte();
00066
00068
00074 virtual std::streamsize read(void* dst, std::streamsize num)=0;
00075
00077
00087 virtual std::streamsize readNonBlocking(void* dst, std::streamsize num)
00088 {
00089 return read(dst, num);
00090 }
00091
00093
00096 virtual std::streamsize write(const void* src, std::streamsize num);
00097
00101
00111 int read_string(char* dst, int max_length);
00112
00114
00120 float read_float32();
00121
00123
00126 virtual std::streampos tell() const = 0;
00127
00129
00135 virtual bool seek(std::streampos p) = 0;
00136
00138
00141 virtual void go_to_end() = 0;
00142
00144
00147 virtual bool eof() const = 0;
00148
00150
00153 virtual bool bad() const = 0;
00154
00156
00164 virtual size_t size() const { return static_cast<size_t>(-1); }
00165
00166 };
00167
00168 }
00169
00170 #endif // GNASH_IOCHANNEL_H
00171
00172
00173
00174
00175
00176