Gnash
0.8.10
|
00001 // 00002 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 00003 // 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 // The SWFMovieDefinition is the 'root' definition of a SWF movie, including 00020 // movies loaded into another SWF file. Each self-contained SWF file has exactly 00021 // one SWFMovieDefinition. 00022 00023 #ifndef GNASH_SWFPARSER_H 00024 #define GNASH_SWFPARSER_H 00025 00026 #include "SWF.h" 00027 00028 namespace gnash { 00029 class SWFStream; 00030 class movie_definition; 00031 class RunResources; 00032 } 00033 00034 namespace gnash { 00035 00036 00038 // 00041 // 00046 // 00050 class SWFParser 00051 { 00052 00053 public: 00054 SWFParser(SWFStream& in, movie_definition* md, const RunResources& runResources) 00055 : 00056 _stream(in), 00057 _md(md), 00058 _runResources(runResources), 00059 _bytesRead(0), 00060 _tagOpen(false), 00061 _endRead(0), 00062 _nextTagEnd(0) 00063 00064 { 00065 } 00066 00068 size_t bytesRead() const { 00069 return _bytesRead; 00070 } 00071 00073 // 00077 // 00081 // 00085 bool read(std::streamsize bytes); 00086 00087 private: 00088 00089 size_t openTag(); 00090 00091 void closeTag(); 00092 00093 SWFStream& _stream; 00094 00095 movie_definition* _md; 00096 00097 const RunResources& _runResources; 00098 00099 size_t _bytesRead; 00100 00101 bool _tagOpen; 00102 00103 size_t _endRead; 00104 00105 size_t _nextTagEnd; 00106 00107 SWF::TagType _tag; 00108 00109 }; 00110 00111 } // namespace gnash 00112 00113 #endif