Gnash 0.8.10dev
|
00001 // CodeStream.h A class which allows bounds-checked reading from a char array 00002 // 00003 // Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 00019 #ifndef GNASH_CODESTREAM_H 00020 #define GNASH_CODESTREAM_H 00021 00022 #include <string> 00023 #include <boost/utility.hpp> 00024 #include <boost/cstdint.hpp> 00025 #include <istream> 00026 #include <sstream> 00027 00028 namespace gnash { 00029 00032 class CodeStreamException { }; 00033 00039 class CodeStream : public std::istream, private boost::noncopyable 00040 { 00041 public: 00042 CodeStream(std::string data): std::istream(new std::stringbuf(data)){ 00043 00044 } 00045 00047 boost::uint32_t read_V32(); 00048 00050 boost::uint8_t read_as3op(); 00051 00053 void seekBy(int change); 00054 00056 void seekTo(unsigned int set); 00057 00059 boost::int32_t read_S24(); 00060 00062 int8_t read_s8(); 00063 00065 boost::uint8_t read_u8(); 00066 00069 void skip_V32(); 00070 00071 }; 00072 00073 } // namespace gnash 00074 #endif