• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

ScriptLimitsTag.h

Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
00003 // 
00004 // This program is free software; you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation; either version 3 of the License, or
00007 // (at your option) any later version.
00008 // 
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 // 
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00017 
00018 #ifndef GNASH_SWF_SCRIPTLIMITSTAG_H
00019 #define GNASH_SWF_SCRIPTLIMITSTAG_H
00020 
00021 #include "SWF.h" // for TagType definition
00022 #include "SWFStream.h" // for inlines
00023 #include "movie_root.h"
00024 #include "movie_definition.h"
00025 #include "ControlTag.h"
00026 
00027 namespace gnash {
00028 namespace SWF {
00029 
00031 //
00035 class ScriptLimitsTag : public ControlTag
00036 {
00037 public:
00038 
00039     virtual ~ScriptLimitsTag() {}
00040 
00041     virtual void executeState(MovieClip* m, DisplayList& /*dl*/) const {
00042 
00043         log_debug("Setting script limits: recursion %s, timeout %s",
00044                 _recursionLimit, _timeoutLimit);
00045         getRoot(*getObject(m)).setScriptLimits(_recursionLimit, _timeoutLimit);
00046     }
00047 
00048     static void loader(SWFStream& in, TagType tag, movie_definition& m,
00049             const RunResources& /*r*/)
00050     {
00051         assert(tag = SWF::SCRIPTLIMITS);
00052         std::auto_ptr<ScriptLimitsTag> s(new ScriptLimitsTag(in));
00053         m.addControlTag(s.release());
00054     }
00055 
00056 private:
00057 
00058     ScriptLimitsTag(SWFStream& in)
00059         :
00060         _recursionLimit(0),
00061         _timeoutLimit(0)
00062     {
00063         in.ensureBytes(4); 
00064         _recursionLimit = in.read_u16();
00065         _timeoutLimit = in.read_u16();      
00066 
00067         IF_VERBOSE_PARSE (
00068             log_parse(_("  ScriptLimits tag: recursion: %d, timeout: %d"),
00069                     _recursionLimit, _timeoutLimit);
00070             );
00071 
00072     }
00073     
00074     boost::uint16_t _recursionLimit;
00075     boost::uint16_t _timeoutLimit;
00076 };
00077 
00078 } // namespace gnash::SWF
00079 } // namespace gnash
00080 
00081 
00082 #endif // GNASH_SWF_SCRIPTLIMITSTAG_H
00083 
00084 
00085 // Local Variables:
00086 // mode: C++
00087 // indent-tabs-mode: t
00088 // End:

Generated on Thu Sep 30 2010 14:35:02 for Gnash by  doxygen 1.7.1