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: