1 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
2 // 2011 Free Software Foundation, Inc
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 #ifndef GNASH_ASHANDLERS_H
19 #define GNASH_ASHANDLERS_H
26 // Forward declarations
34 namespace SWF
{ // gnash::SWF
39 // default hex dump, in case the format is unknown or unsupported
52 typedef void (*ActionCallback
)(ActionExec
& thread
);
57 ActionHandler(ActionType type
, ActionCallback func
,
58 ArgumentType format
= ARG_NONE
);
60 /// Execute the action
61 void execute(ActionExec
& thread
) const;
63 ActionType
getType() const { return _type
; }
64 ArgumentType
getArgFormat() const { return _arg_format
; }
69 ActionCallback _callback
;
70 ArgumentType _arg_format
;
73 /// A singleton containing the supported SWF Action handlers.
78 /// Return the singleton instance of SWFHandlers class
79 static const SWFHandlers
& instance();
81 /// Execute the action identified by 'type' action type
82 void execute(ActionType type
, ActionExec
& thread
) const;
84 size_t size() const { return _handlers
.size(); }
86 ActionType
lastType() const {
87 return ACTION_GOTOEXPRESSION
;
90 const ActionHandler
& operator[](ActionType x
) const {
96 // Use the ::instance() method to get a reference
99 // You won't destroy a singleton
102 // Indexed by action id
103 typedef std::vector
<ActionHandler
> container_type
;
105 container_type _handlers
;