Gnash  0.8.10
DoActionTag.h
Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 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 #ifndef GNASH_SWF_DOACTIONTAG_H
00020 #define GNASH_SWF_DOACTIONTAG_H
00021 
00022 #include "ControlTag.h" // for inheritance
00023 #include "SWF.h" // for TagType definition
00024 #include "action_buffer.h" // for composition
00025 #include "MovieClip.h" // for inlines
00026 #include "SWFStream.h" // for inlines
00027 
00028 // Forward declarations
00029 namespace gnash {
00030         class movie_definition;
00031 }
00032 
00033 namespace gnash {
00034 namespace SWF {
00035 
00037 //
00040 class DoActionTag : public ControlTag
00041 {
00042 public:
00043 
00045         //
00046         void read(SWFStream& in) {
00047         m_buf.read(in, in.get_tag_end_position());
00048         }
00049 
00050         virtual void executeActions(MovieClip* m, DisplayList& /* dlist */) const {
00051         m->add_action_buffer(&m_buf);
00052         }
00053 
00054         static void loader(SWFStream& in, TagType tag, movie_definition& m,
00055             const RunResources& /*r*/)
00056         {
00057         if (m.isAS3()) {
00058             IF_VERBOSE_MALFORMED_SWF(
00059                 log_swferror("SWF contains DoAction tag, but is an "
00060                     "AS3 SWF!");
00061             );
00062             throw ParserException("DoAction tag found in AS3 SWF!");
00063         }
00064         
00065                 boost::intrusive_ptr<DoActionTag> da(new DoActionTag(m));
00066                 da->read(in);
00067 
00068                 IF_VERBOSE_PARSE(
00069             log_parse(_("tag %d: do_action_loader"), tag);
00070             log_parse(_("-- actions in frame %d"), m.get_loading_frame());
00071                 );
00072 
00073                 m.addControlTag(da); // ownership transferred
00074         }
00075 
00076 private:
00077 
00078         DoActionTag(movie_definition& md)
00079                 :
00080                 m_buf(md)
00081         {}
00082 
00083         action_buffer m_buf;
00084 };
00085 
00086 } // namespace gnash::SWF
00087 } // namespace gnash
00088 
00089 
00090 #endif // GNASH_SWF_DOACTIONTAG_H
00091 
00092 
00093 // Local Variables:
00094 // mode: C++
00095 // indent-tabs-mode: t
00096 // End: