22 #ifndef KJS_IDENTIFIER_H
23 #define KJS_IDENTIFIER_H
47 explicit Identifier(
const UString &s) : _ustring(add(s.rep)) { }
53 DOM::DOMString string()
const;
62 const UChar *
data()
const {
return _ustring.data(); }
66 int size()
const {
return _ustring.size(); }
71 const char *
ascii()
const {
return _ustring.ascii(); }
78 bool isNull()
const {
return _ustring.isNull(); }
82 bool isEmpty()
const {
return _ustring.isEmpty(); }
84 unsigned long toULong(
bool *ok)
const {
return _ustring.toULong(ok); }
85 unsigned toStrictUInt32(
bool *ok)
const {
return _ustring.toStrictUInt32(ok); }
86 unsigned toArrayIndex(
bool *ok)
const {
return _ustring.toArrayIndex(ok); }
88 double toDouble()
const {
return _ustring.toDouble(); }
93 static const Identifier &
null();
95 friend bool operator==(
const Identifier &,
const Identifier &);
96 friend bool operator!=(
const Identifier &,
const Identifier &);
98 friend bool operator==(
const Identifier &,
const char *);
100 static void remove(UString::Rep *);
105 static bool equal(UString::Rep *,
const char *);
106 static bool equal(UString::Rep *,
const UChar *,
int length);
107 static bool equal(UString::Rep *, UString::Rep *);
109 static bool equal(
const Identifier &a,
const Identifier &b)
110 {
return a._ustring.rep == b._ustring.rep; }
111 static bool equal(
const Identifier &a,
const char *b)
112 {
return equal(a._ustring.rep, b); }
114 static UString::Rep *add(
const char *);
115 static UString::Rep *add(
const UChar *,
int length);
116 static UString::Rep *add(UString::Rep *);
118 static void insert(UString::Rep *);
120 static void rehash(
int newTableSize);
121 static void expand();
122 static void shrink();
125 static UString::Rep **_table;
126 static int _tableSize;
127 static int _tableSizeMask;
128 static int _keyCount;
131 inline bool operator==(
const Identifier &a,
const Identifier &b)
132 {
return Identifier::equal(a, b); }
134 inline bool operator!=(
const Identifier &a,
const Identifier &b)
135 {
return !Identifier::equal(a, b); }
137 inline bool operator==(
const Identifier &a,
const char *b)
138 {
return Identifier::equal(a, b); }
140 KJS_EXPORT
extern const Identifier argumentsPropertyName;
141 KJS_EXPORT
extern const Identifier calleePropertyName;
142 KJS_EXPORT
extern const Identifier callerPropertyName;
143 KJS_EXPORT
extern const Identifier constructorPropertyName;
144 KJS_EXPORT
extern const Identifier lengthPropertyName;
145 KJS_EXPORT
extern const Identifier messagePropertyName;
146 KJS_EXPORT
extern const Identifier namePropertyName;
147 KJS_EXPORT
extern const Identifier prototypePropertyName;
148 KJS_EXPORT
extern const Identifier specialPrototypePropertyName;
149 KJS_EXPORT
extern const Identifier toLocaleStringPropertyName;
150 KJS_EXPORT
extern const Identifier toStringPropertyName;
151 KJS_EXPORT
extern const Identifier valueOfPropertyName;
Represents an Identifier for a Javascript object.
Identifier()
Creates an empty identifier.
const char * ascii() const
Char * of the identifier's string.
Identifier(const char *s)
Creates an identifier with the name of the string.
TQString qstring() const
returns a TQString of the identifier
int size() const
The size of the UChar string returned.
bool isNull() const
Returns the identfiers state of being unset.
bool isEmpty() const
Returns that the identifiers string is set, but is empty.
const UString & ustring() const
returns a UString of the identifier
const UChar * data() const
returns a UChar pointer to the string of the identifier with a size defined by size().
static UString from(int i)
Constructs a string from an int.
const TDEShortcut & insert()