KJS-API
kjsobject.h
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
00020
00021
00022 #ifndef KJSOBJECT_H
00023 #define KJSOBJECT_H
00024
00025 #include "kjsapi_export.h"
00026 #include <QtCore/QString>
00027
00028 class QDateTime;
00029 class KJSContext;
00030 class KJSNull;
00031 class KJSUndefined;
00032 class KJSBoolean;
00033 class KJSNumber;
00034 class KJSString;
00035 class KJSArray;
00036 class KJSDate;
00037 class KJSArguments;
00038 class KJSInterpreter;
00039 class KJSObjectHandle;
00040 class KJSCustomProperty;
00041 class KJSCustomFunction;
00042
00048 class KJSAPI_EXPORT KJSObject
00049 {
00050 friend class KJSNull;
00051 friend class KJSUndefined;
00052 friend class KJSBoolean;
00053 friend class KJSNumber;
00054 friend class KJSString;
00055 friend class KJSArray;
00056 friend class KJSDate;
00057 friend class KJSGlobalObject;
00058 friend class KJSPrototype;
00059 friend class KJSContext;
00060 friend class KJSArguments;
00061 friend class KJSInterpreter;
00062 friend class KJSCustomProperty;
00063 friend class KJSCustomFunction;
00064 public:
00068 KJSObject();
00072 KJSObject(const KJSObject& o);
00076 KJSObject& operator=(const KJSObject& o);
00080 ~KJSObject();
00084 bool isUndefined() const;
00088 bool isNull() const;
00092 bool isBoolean() const;
00096 bool isNumber() const;
00100 bool isString() const;
00104 bool isObject() const;
00105
00110 bool toBoolean(KJSContext* ctx);
00115 double toNumber(KJSContext* ctx);
00121 int toInt32(KJSContext* ctx);
00126 QString toString(KJSContext* ctx);
00131 KJSObject property(KJSContext* ctx, const QString& name);
00136 void setProperty(KJSContext* ctx, const QString& name,
00137 const KJSObject& value);
00141 void setProperty(KJSContext* ctx, const QString& name, bool value);
00145 void setProperty(KJSContext* ctx, const QString& name, double value);
00149 void setProperty(KJSContext* ctx, const QString& name, int value);
00153 void setProperty(KJSContext* ctx, const QString& name,
00154 const QString &value);
00160 void setProperty(KJSContext* ctx, const QString& name,
00161 const char* value);
00162
00163
00164 private:
00165 KJSObject(KJSObjectHandle* h) : hnd(h) { }
00166 KJSObjectHandle* hnd;
00167 };
00168
00174 class KJSAPI_EXPORT KJSNull : public KJSObject
00175 {
00176 public:
00180 KJSNull();
00181 };
00182
00188 class KJSAPI_EXPORT KJSUndefined : public KJSObject
00189 {
00190 public:
00194 KJSUndefined();
00195 };
00196
00202 class KJSAPI_EXPORT KJSBoolean : public KJSObject
00203 {
00204 public:
00208 KJSBoolean(bool b);
00209 };
00210
00216 class KJSAPI_EXPORT KJSNumber : public KJSObject
00217 {
00218 public:
00222 KJSNumber(double d);
00223 };
00224
00230 class KJSAPI_EXPORT KJSString : public KJSObject
00231 {
00232 public:
00236 KJSString(const QString& s);
00244 KJSString(const char* s);
00245 };
00246
00252 class KJSAPI_EXPORT KJSArray : public KJSObject
00253 {
00254 public:
00258 KJSArray(KJSContext* ctx, int len = 0);
00259 };
00260
00266 class KJSAPI_EXPORT KJSDate : public KJSObject
00267 {
00268 public:
00272 KJSDate(KJSContext* ctx, const QDateTime& dt);
00273 };
00274
00280 class KJSAPI_EXPORT KJSGlobalObject : public KJSObject
00281 {
00282 friend class KJSPrototype;
00283 public:
00288 KJSGlobalObject();
00289
00290 private:
00291 KJSGlobalObject(KJSObjectHandle* h) : KJSObject(h) { }
00292 };
00293
00294 #endif