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 #ifndef GNASH_ASHANDLERS_H
00019 #define GNASH_ASHANDLERS_H
00020
00021 #include <string>
00022 #include <vector>
00023
00024
00025
00026 namespace gnash {
00027 class ActionExec;
00028 class as_environment;
00029 }
00030
00031 namespace gnash {
00032
00033 namespace SWF {
00034
00035 enum ArgumentType {
00036 ARG_NONE = 0,
00037 ARG_STR,
00038
00039 ARG_HEX,
00040 ARG_U8,
00041 ARG_U16,
00042 ARG_S16,
00043 ARG_PUSH_DATA,
00044 ARG_DECL_DICT,
00045 ARG_FUNCTION2
00046 };
00047
00048
00049 class ActionHandler
00050 {
00051 typedef void (*ActionCallback)(ActionExec& thread);
00052
00053 public:
00054
00055 ActionHandler();
00056 ActionHandler(ActionType type, ActionCallback func,
00057 ArgumentType format = ARG_NONE);
00058
00060 void execute(ActionExec& thread) const;
00061
00062 ActionType getType() const { return _type; }
00063 ArgumentType getArgFormat() const { return _arg_format; }
00064
00065 private:
00066
00067 ActionType _type;
00068 ActionCallback _callback;
00069 ArgumentType _arg_format;
00070 };
00071
00073 class SWFHandlers
00074 {
00075 public:
00076
00078 static const SWFHandlers& instance();
00079
00081 void execute(ActionType type, ActionExec& thread) const;
00082
00083 size_t size() const { return _handlers.size(); }
00084
00085 ActionType lastType() const {
00086 return ACTION_GOTOEXPRESSION;
00087 }
00088
00089 const ActionHandler& operator[](ActionType x) const {
00090 return _handlers[x];
00091 }
00092
00093 private:
00094
00095
00096 SWFHandlers();
00097
00098
00099 ~SWFHandlers();
00100
00101
00102 typedef std::vector<ActionHandler> container_type;
00103
00104 container_type _handlers;
00105
00106 };
00107
00108
00109 }
00110 }
00111
00112 #endif