Reviewed by Eric.
[WebKit-https.git] / JavaScriptGlue / JSObject.h
1 //
2 // JSObject.h
3 //
4
5 #ifndef JSObject_h
6 #define JSObject_h
7
8 #include "JSBase.h"
9 #include "JSUtils.h"
10
11 typedef void (*JSObjectMarkProcPtr)(void *data);
12 JSObjectRef JSObjectCreateInternal(void *data, JSObjectCallBacksPtr callBacks, JSObjectMarkProcPtr markProc, int dataType);
13
14 class JSUserObject : public JSBase {
15     public:
16         JSUserObject(JSObjectCallBacksPtr callBacks, JSObjectMarkProcPtr markProc, void *data, int dataType);
17         virtual ~JSUserObject();
18
19         CFArrayRef CopyPropertyNames(void);
20         JSUserObject* CopyProperty(CFStringRef propertyName);
21         void SetProperty(CFStringRef propertyName, JSUserObject* value);
22         bool ImplementsCall();
23         JSUserObject* CallFunction(JSUserObject* thisObj, CFArrayRef args);
24         CFTypeRef CopyCFValue() const;
25         virtual UInt8 Equal(JSBase* other);
26         void *GetData();
27         void Mark();
28
29                 int DataType() const { return fDataType; }
30     private:
31         JSObjectCallBacks fCallBacks;
32         JSObjectMarkProcPtr fMarkProc;
33         void *fData;
34                 int fDataType;
35 };
36
37 #endif