Gnash  0.8.10
CodeStream.h
Go to the documentation of this file.
00001 // CodeStream.h A class which allows bounds-checked reading from a char array
00002 //
00003 //   Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
00004 //   Free Software 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 #ifndef GNASH_CODESTREAM_H
00021 #define GNASH_CODESTREAM_H
00022 
00023 #include <string>
00024 #include <boost/utility.hpp>
00025 #include <boost/cstdint.hpp>
00026 #include <istream>
00027 #include <sstream>
00028 
00029 namespace gnash {
00030 
00033 class CodeStreamException { };
00034 
00040 class CodeStream : public std::istream, private boost::noncopyable
00041 {
00042 public:
00043         CodeStream(std::string data): std::istream(new std::stringbuf(data)){
00044                 
00045         }
00046 
00048 boost::uint32_t read_V32();
00049 
00051 boost::uint8_t read_as3op();
00052 
00054 void seekBy(int change);
00055 
00057 void seekTo(unsigned int set);
00058 
00060 boost::int32_t read_S24();
00061 
00063 int8_t read_s8();
00064 
00066 boost::uint8_t read_u8();
00067 
00070 void skip_V32();
00071 
00072 };
00073 
00074 } // namespace gnash
00075 #endif