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