Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GNASH_ASHANDLERS_H
00020 #define GNASH_ASHANDLERS_H
00021
00022 #include <string>
00023 #include <vector>
00024
00025 #include "SWF.h"
00026
00027
00028 namespace gnash {
00029 class ActionExec;
00030 }
00031
00032 namespace gnash {
00033
00034 namespace SWF {
00035
00036 enum ArgumentType {
00037 ARG_NONE = 0,
00038 ARG_STR,
00039
00040 ARG_HEX,
00041 ARG_U8,
00042 ARG_U16,
00043 ARG_S16,
00044 ARG_PUSH_DATA,
00045 ARG_DECL_DICT,
00046 ARG_FUNCTION2
00047 };
00048
00049
00050 class ActionHandler
00051 {
00052 typedef void (*ActionCallback)(ActionExec& thread);
00053
00054 public:
00055
00056 ActionHandler();
00057 ActionHandler(ActionType type, ActionCallback func,
00058 ArgumentType format = ARG_NONE);
00059
00061 void execute(ActionExec& thread) const;
00062
00063 ActionType getType() const { return _type; }
00064 ArgumentType getArgFormat() const { return _arg_format; }
00065
00066 private:
00067
00068 ActionType _type;
00069 ActionCallback _callback;
00070 ArgumentType _arg_format;
00071 };
00072
00074 class SWFHandlers
00075 {
00076 public:
00077
00079 static const SWFHandlers& instance();
00080
00082 void execute(ActionType type, ActionExec& thread) const;
00083
00084 size_t size() const { return _handlers.size(); }
00085
00086 ActionType lastType() const {
00087 return ACTION_GOTOEXPRESSION;
00088 }
00089
00090 const ActionHandler& operator[](ActionType x) const {
00091 return _handlers[x];
00092 }
00093
00094 private:
00095
00096
00097 SWFHandlers();
00098
00099
00100 ~SWFHandlers();
00101
00102
00103 typedef std::vector<ActionHandler> container_type;
00104
00105 container_type _handlers;
00106
00107 };
00108
00109
00110 }
00111 }
00112
00113 #endif