Gnash  0.8.11dev
SWFParser.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 // The SWFMovieDefinition is the 'root' definition of a SWF movie, including
20 // movies loaded into another SWF file. Each self-contained SWF file has exactly
21 // one SWFMovieDefinition.
22 
23 #ifndef GNASH_SWFPARSER_H
24 #define GNASH_SWFPARSER_H
25 
26 #include "SWF.h"
27 
28 namespace gnash {
29  class SWFStream;
30  class movie_definition;
31  class RunResources;
32 }
33 
34 namespace gnash {
35 
36 
38 //
41 //
46 //
50 class SWFParser
51 {
52 
53 public:
54  SWFParser(SWFStream& in, movie_definition* md, const RunResources& runResources)
55  :
56  _stream(in),
57  _md(md),
58  _runResources(runResources),
59  _bytesRead(0),
60  _tagOpen(false),
61  _endRead(0),
62  _nextTagEnd(0)
63 
64  {
65  }
66 
68  size_t bytesRead() const {
69  return _bytesRead;
70  }
71 
73  //
77  //
81  //
85  bool read(std::streamsize bytes);
86 
87 private:
88 
89  size_t openTag();
90 
91  void closeTag();
92 
93  SWFStream& _stream;
94 
95  movie_definition* _md;
96 
97  const RunResources& _runResources;
98 
99  size_t _bytesRead;
100 
101  bool _tagOpen;
102 
103  size_t _endRead;
104 
105  size_t _nextTagEnd;
106 
107  SWF::TagType _tag;
108 
109 };
110 
111 } // namespace gnash
112 
113 #endif
Client program's interface to the definition of a movie or sprite.
Definition: movie_definition.h:95
TagType
SWF tag types. Symbolic names copied from Ming.
Definition: SWF.h:30
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
bool read(std::streamsize bytes)
Parse a specified number of bytes from the stream.
Definition: SWFParser.cpp:51
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:43
size_t bytesRead() const
The number of bytes processed by this SWFParser.
Definition: SWFParser.h:68
The SWFParser parses tags from a SWFStream.
Definition: SWFParser.h:50
SWFParser(SWFStream &in, movie_definition *md, const RunResources &runResources)
Definition: SWFParser.h:54
SWF stream wrapper class.
Definition: SWFStream.h:58