Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef TU_FILE_H
00010 #define TU_FILE_H
00011
00012 #include "dsodefs.h"
00013 #include "utility.h"
00014 #include "IOChannel.h"
00015
00016
00017 namespace gnash {
00018
00019
00020
00021
00022
00023 class DSOEXPORT tu_file : public gnash::IOChannel
00024 {
00025 public:
00026
00027
00028 tu_file(FILE* fp, bool autoclose);
00029
00030 ~tu_file();
00031
00034
00038 boost::uint32_t read_le32()
00039 {
00040
00041 boost::uint32_t result = static_cast<boost::uint32_t>(read_byte());
00042 result |= static_cast<boost::uint32_t>(read_byte()) << 8;
00043 result |= static_cast<boost::uint32_t>(read_byte()) << 16;
00044 result |= static_cast<boost::uint32_t>(read_byte()) << 24;
00045 return(result);
00046 }
00047
00049
00053 boost::uint16_t read_le16()
00054 {
00055 boost::uint16_t result = static_cast<boost::uint16_t>(read_byte());
00056 result |= static_cast<boost::uint16_t>(read_byte()) << 8;
00057 return(result);
00058 }
00059
00061
00065 boost::uint8_t read_byte() {
00066 boost::uint8_t u;
00067 read(&u, 1);
00068 return u;
00069 }
00070
00072
00076 std::streamsize read(void* dst, std::streamsize num);
00077
00079
00083 std::streamsize write(const void* src, std::streamsize num);
00084
00086
00090 std::streampos tell() const;
00091
00093
00100 bool seek(std::streampos p);
00101
00103
00106 void go_to_end();
00107
00109
00113 bool eof() const;
00114
00116
00123 bool bad() const;
00124
00126 size_t size() const;
00127
00128 private:
00129
00130 void close();
00131
00132 void * m_data;
00133
00134 bool _autoclose;
00135
00136 };
00137
00138
00139 }
00140 #endif // TU_FILE_H
00141
00142
00143
00144
00145
00146