00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _STRING_OBJECT_H_
00023 #define _STRING_OBJECT_H_
00024
00025 #include "internal.h"
00026 #include "function_object.h"
00027
00028 namespace KJS {
00029
00030 class StringInstanceImp : public ObjectImp {
00031 public:
00032 StringInstanceImp(ObjectImp *proto);
00033 StringInstanceImp(ObjectImp *proto, const UString &string);
00034
00035 virtual Value get(ExecState *exec, const Identifier &propertyName) const;
00036 virtual void put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr = None);
00037 virtual bool hasProperty(ExecState *exec, const Identifier &propertyName) const;
00038 virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
00039 virtual ReferenceList propList(ExecState *exec, bool recursive);
00040
00041 virtual const ClassInfo *classInfo() const { return &info; }
00042 static const ClassInfo info;
00043 };
00044
00051 class StringPrototypeImp : public StringInstanceImp {
00052 public:
00053 StringPrototypeImp(ExecState *exec,
00054 ObjectPrototypeImp *objProto);
00055 Value get(ExecState *exec, const Identifier &p) const;
00056 virtual const ClassInfo *classInfo() const { return &info; }
00057 static const ClassInfo info;
00058 };
00059
00066 class StringProtoFuncImp : public InternalFunctionImp {
00067 public:
00068 StringProtoFuncImp(ExecState *exec, int i, int len);
00069
00070 virtual bool implementsCall() const;
00071 virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00072
00073 enum { ToString, ValueOf, CharAt, CharCodeAt, Concat, IndexOf, LastIndexOf,
00074 Match, Replace, Search, Slice, Split,
00075 Substr, Substring, FromCharCode, ToLowerCase, ToUpperCase,
00076 ToLocaleLowerCase, ToLocaleUpperCase, LocaleCompare
00077 #ifndef KJS_PURE_ECMA
00078 , Big, Small, Blink, Bold, Fixed, Italics, Strike, Sub, Sup,
00079 Fontcolor, Fontsize, Anchor, Link
00080 #endif
00081 };
00082 private:
00083 int id;
00084 };
00085
00091 class StringObjectImp : public InternalFunctionImp {
00092 public:
00093 StringObjectImp(ExecState *exec,
00094 FunctionPrototypeImp *funcProto,
00095 StringPrototypeImp *stringProto);
00096
00097 virtual bool implementsConstruct() const;
00098 virtual Object construct(ExecState *exec, const List &args);
00099 virtual bool implementsCall() const;
00100 virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00101 };
00102
00109 class StringObjectFuncImp : public InternalFunctionImp {
00110 public:
00111 StringObjectFuncImp(ExecState *exec, FunctionPrototypeImp *funcProto);
00112 virtual bool implementsCall() const;
00113 virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00114 };
00115
00116 }
00117
00118 #endif
00119