Gnash  0.8.11dev
DoActionTag.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 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 #ifndef GNASH_SWF_DOACTIONTAG_H
20 #define GNASH_SWF_DOACTIONTAG_H
21 
22 #include "ControlTag.h" // for inheritance
23 #include "SWF.h" // for TagType definition
24 #include "action_buffer.h" // for composition
25 #include "MovieClip.h" // for inlines
26 #include "SWFStream.h" // for inlines
27 
28 // Forward declarations
29 namespace gnash {
30  class movie_definition;
31 }
32 
33 namespace gnash {
34 namespace SWF {
35 
37 //
40 class DoActionTag : public ControlTag
41 {
42 public:
43 
45  //
46  void read(SWFStream& in) {
47  m_buf.read(in, in.get_tag_end_position());
48  }
49 
50  virtual void executeActions(MovieClip* m, DisplayList& /* dlist */) const {
51  m->add_action_buffer(&m_buf);
52  }
53 
54  static void loader(SWFStream& in, TagType tag, movie_definition& m,
55  const RunResources& /*r*/)
56  {
57  if (m.isAS3()) {
59  log_swferror("SWF contains DoAction tag, but is an "
60  "AS3 SWF!");
61  );
62  throw ParserException("DoAction tag found in AS3 SWF!");
63  }
64 
65  boost::intrusive_ptr<DoActionTag> da(new DoActionTag(m));
66  da->read(in);
67 
69  log_parse(_("tag %d: do_action_loader"), tag);
70  log_parse(_("-- actions in frame %d"), m.get_loading_frame());
71  );
72 
73  m.addControlTag(da); // ownership transferred
74  }
75 
76 private:
77 
79  :
80  m_buf(md)
81  {}
82 
83  action_buffer m_buf;
84 };
85 
86 } // namespace gnash::SWF
87 } // namespace gnash
88 
89 
90 #endif // GNASH_SWF_DOACTIONTAG_H
91 
92 
93 // Local Variables:
94 // mode: C++
95 // indent-tabs-mode: t
96 // End:
unsigned long get_tag_end_position()
Return the file position of the end of the current tag.
Definition: SWFStream.cpp:497
Client program&#39;s interface to the definition of a movie or sprite.
Definition: movie_definition.h:95
A MovieClip is a container for DisplayObjects.
Definition: MovieClip.h:83
TagType
SWF tag types. Symbolic names copied from Ming.
Definition: SWF.h:30
An SWF parsing exception.
Definition: GnashException.h:89
virtual size_t get_loading_frame() const =0
Returns 1 based index. Ex: if 1 then 1st frame as been fully loaded.
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
#define IF_VERBOSE_MALFORMED_SWF(x)
Definition: log.h:404
#define IF_VERBOSE_PARSE(x)
Definition: log.h:378
Control tags are swf tags that control the operation of the movie.
Definition: ControlTag.h:43
void log_parse(StringType msg, Args... args)
Definition: log.h:313
#define _(String)
Definition: log.h:44
void read(SWFStream &in)
Read a DoAction block from the stream.
Definition: DoActionTag.h:46
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:53
static void loader(SWFStream &in, TagType tag, movie_definition &m, const RunResources &)
Definition: DoActionTag.h:54
void read(SWFStream &in, unsigned long endPos)
Read action bytes from input stream up to but not including endPos.
Definition: action_buffer.cpp:48
void log_swferror(StringType msg, Args... args)
Definition: log.h:325
virtual bool isAS3() const
True if the SWFMovie should use AVM2.
Definition: movie_definition.h:410
virtual void executeActions(MovieClip *m, DisplayList &) const
Execute Action tags.
Definition: DoActionTag.h:50
SWF Tag DoAction (12)
Definition: DoActionTag.h:40
void add_action_buffer(const action_buffer *a)
Definition: MovieClip.h:388
Definition: GnashKey.h:159
A code segment.
Definition: action_buffer.h:49
virtual void addControlTag(boost::intrusive_ptr< SWF::ControlTag >)
Add an ControlTag to this movie_definition&#39;s playlist.
Definition: movie_definition.h:273
A list of on-stage DisplayObjects, ordered by depth.
Definition: DisplayList.h:64
Definition: GnashKey.h:331
SWF stream wrapper class.
Definition: SWFStream.h:58