• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

IOChannel.h

Go to the documentation of this file.
00001 // IOChannel.h - a virtual IO channel, for Gnash
00002 // 
00003 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
00004 //   Foundation, Inc
00005 // 
00006 // This program is free software; you can redistribute it and/or modify
00007 // it under the terms of the GNU General Public License as published by
00008 // the Free Software Foundation; either version 3 of the License, or
00009 // (at your option) any later version.
00010 // 
00011 // This program is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 // 
00016 // You should have received a copy of the GNU General Public License
00017 // along with this program; if not, write to the Free Software
00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019 
00020 
00021 #ifndef GNASH_IOCHANNEL_H
00022 #define GNASH_IOCHANNEL_H
00023 
00024 #include "dsodefs.h" // DSOEXPORT
00025 #include "GnashException.h" // for IOException inheritance
00026 
00027 #include <string>
00028 #include <boost/cstdint.hpp> // for boost int types
00029 #include <ios>
00030 
00031 namespace gnash {
00032 
00034 class DSOEXPORT IOException : public GnashException {
00035 public:
00036     IOException(const std::string& s) : GnashException(s) {}
00037     IOException() : GnashException("IO error") {}
00038 };
00039 
00041 class DSOEXPORT IOChannel
00042 {
00043 public:
00044 
00045     virtual ~IOChannel() {}
00046 
00049     //
00052     boost::uint32_t read_le32();
00053 
00055     //
00058     boost::uint16_t read_le16();
00059 
00061     //
00064     boost::uint8_t read_byte();
00065     
00067     //
00073     virtual std::streamsize read(void* dst, std::streamsize num)=0;
00074 
00076     //
00086     virtual std::streamsize readNonBlocking(void* dst, std::streamsize num)
00087     {
00088         return read(dst, num);
00089     }
00090 
00092     //
00095     virtual std::streamsize write(const void* src, std::streamsize num);
00096 
00100     //
00110     int    read_string(char* dst, int max_length);
00111     
00113     //
00119     float read_float32();
00120 
00122     //
00125     virtual std::streampos tell() const = 0;
00126 
00128     //
00134     virtual bool seek(std::streampos p) = 0;
00135 
00137     //
00140     virtual void go_to_end() = 0;
00141 
00143     //
00146     virtual bool eof() const = 0;
00147     
00149     //
00152     virtual bool bad() const = 0;
00153     
00155     //
00163     virtual size_t size() const { return static_cast<size_t>(-1); }
00164    
00165 };
00166 
00167 } // namespace gnash
00168 
00169 #endif // GNASH_IOCHANNEL_H
00170 
00171 
00172 // Local Variables:
00173 // mode: C++
00174 // indent-tabs-mode: t
00175 // End:

Generated on Thu Sep 30 2010 14:34:59 for Gnash by  doxygen 1.7.1