ScriptFunctionCall.h [plain text]
#ifndef ScriptFunctionCall_h
#define ScriptFunctionCall_h
#include "PlatformString.h"
#include "ScriptObject.h"
#include "ScriptState.h"
#include <runtime/ArgList.h>
namespace JSC {
class UString;
class JSValue;
}
namespace WebCore {
class ScriptValue;
class ScriptCallArgumentHandler {
public:
ScriptCallArgumentHandler(ScriptState* state) : m_exec(state) { }
void appendArgument(const ScriptObject&);
void appendArgument(const ScriptValue&);
void appendArgument(const String&);
void appendArgument(const char*);
void appendArgument(const JSC::UString&);
void appendArgument(JSC::JSValue);
void appendArgument(long);
void appendArgument(long long);
void appendArgument(unsigned int);
void appendArgument(unsigned long);
void appendArgument(int);
void appendArgument(bool);
protected:
JSC::MarkedArgumentBuffer m_arguments;
ScriptState* m_exec;
private:
void* operator new(size_t) { ASSERT_NOT_REACHED(); return reinterpret_cast<void*>(0xbadbeef); }
void* operator new[](size_t) { ASSERT_NOT_REACHED(); return reinterpret_cast<void*>(0xbadbeef); }
};
class ScriptFunctionCall : public ScriptCallArgumentHandler {
public:
ScriptFunctionCall(const ScriptObject& thisObject, const String& name);
ScriptValue call(bool& hadException, bool reportExceptions = true);
ScriptValue call();
ScriptObject construct(bool& hadException, bool reportExceptions = true);
protected:
ScriptObject m_thisObject;
String m_name;
};
class ScriptCallback : public ScriptCallArgumentHandler {
public:
ScriptCallback(ScriptState*, ScriptValue);
ScriptValue call();
ScriptValue call(bool& hadException);
private:
ScriptValue m_function;
};
}
#endif // ScriptFunctionCall