Gnash
0.8.11dev
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
libcore
vm
ASHandlers.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2005, 2006, 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_ASHANDLERS_H
20
#define GNASH_ASHANDLERS_H
21
22
#include <vector>
23
24
#include "
SWF.h
"
25
26
// Forward declarations
27
namespace
gnash {
28
class
ActionExec;
29
}
30
31
namespace
gnash {
32
33
namespace
SWF
{
// gnash::SWF
34
35
enum
ArgumentType
{
36
ARG_NONE
= 0,
37
ARG_STR
,
38
// default hex dump, in case the format is unknown or unsupported
39
ARG_HEX
,
40
ARG_U8
,
41
ARG_U16
,
42
ARG_S16
,
43
ARG_PUSH_DATA
,
44
ARG_DECL_DICT
,
45
ARG_FUNCTION2
46
};
47
48
49
class
ActionHandler
50
{
51
typedef
void (*ActionCallback)(
ActionExec
& thread);
52
53
public
:
54
55
ActionHandler
();
56
ActionHandler
(
ActionType
type
, ActionCallback func,
57
ArgumentType
format =
ARG_NONE
);
58
60
void
execute
(
ActionExec
& thread)
const
;
61
62
ActionType
getType
()
const
{
return
_type; }
63
ArgumentType
getArgFormat
()
const
{
return
_arg_format; }
64
65
private
:
66
67
ActionType
_type;
68
ActionCallback _callback;
69
ArgumentType
_arg_format;
70
};
71
73
class
SWFHandlers
74
{
75
public
:
76
78
static
const
SWFHandlers
&
instance
();
79
81
void
execute
(
ActionType
type
,
ActionExec
& thread)
const
;
82
83
size_t
size
()
const
{
return
_handlers.size(); }
84
85
ActionType
lastType
()
const
{
86
return
ACTION_GOTOEXPRESSION
;
87
}
88
89
const
ActionHandler
&
operator[]
(
ActionType
x
)
const
{
90
return
_handlers[
x
];
91
}
92
93
private
:
94
95
// Use the ::instance() method to get a reference
96
SWFHandlers
();
97
98
// You won't destroy a singleton
99
~
SWFHandlers
();
100
101
// Indexed by action id
102
typedef
std::vector<ActionHandler> container_type;
103
104
container_type _handlers;
105
106
};
107
108
109
}
// namespace SWF
110
}
// namespace gnash
111
112
#endif
Generated on Mon Sep 9 2013 23:08:38 for Gnash by
1.8.4