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  _tag(SWF::END) // Initialized to zero to have a well known value
64 
65  {
66  }
67 
69  size_t bytesRead() const {
70  return _bytesRead;
71  }
72 
74  //
78  //
82  //
86  bool read(std::streamsize bytes);
87 
88 private:
89 
90  size_t openTag();
91 
92  void closeTag();
93 
94  SWFStream& _stream;
95 
96  movie_definition* _md;
97 
98  const RunResources& _runResources;
99 
100  size_t _bytesRead;
101 
102  bool _tagOpen;
103 
104  size_t _endRead;
105 
106  size_t _nextTagEnd;
107 
108  SWF::TagType _tag;
109 
110 };
111 
112 } // namespace gnash
113 
114 #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
size_t bytesRead() const
The number of bytes processed by this SWFParser.
Definition: SWFParser.h:69
Definition: GnashKey.h:212
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:53
The SWFParser parses tags from a SWFStream.
Definition: SWFParser.h:50
SWFParser(SWFStream &in, movie_definition *md, const RunResources &runResources)
Definition: SWFParser.h:54
Definition: GnashKey.h:331
SWF stream wrapper class.
Definition: SWFStream.h:58