24 #ifndef _KJS_USTRING_H_
25 #define _KJS_USTRING_H_
58 UChar(
unsigned char u);
64 UChar(
unsigned char h ,
unsigned char l);
69 UChar(
unsigned short u);
74 unsigned char high()
const {
return uc >> 8; }
78 unsigned char low()
const {
return uc; }
82 unsigned short unicode()
const {
return uc; }
87 UChar toLower()
const;
91 UChar toUpper()
const;
101 inline UChar::UChar(
unsigned char h ,
unsigned char l) : uc(h << 8 | l) { }
135 unsigned short unicode()
const {
return ref().uc; }
139 unsigned char low()
const {
return ref().uc; }
143 unsigned char high()
const {
return ref().uc >> 8; }
161 inline UChar::UChar(
const UCharReference &c) : uc(c.unicode()) { }
168 CString() : data(0L), length(0) { }
170 CString(
const char *c,
int len);
176 CString &operator=(
const char *c);
180 int size()
const {
return length; }
181 const char *c_str()
const {
return data; }
199 struct KJS_EXPORT Rep {
203 static Rep *create(
UChar *d,
int l);
206 UChar *data()
const {
return dat; }
207 int size()
const {
return len; }
209 unsigned hash()
const {
if (_hash == 0) _hash = computeHash(dat, len);
return _hash; }
211 static unsigned computeHash(
const UChar *,
int length);
212 static unsigned computeHash(
const char *);
215 void deref() {
if (--rc == 0) destroy(); }
221 mutable unsigned _hash;
223 enum { capacityForIdentifier = 0x10000000 };
287 static UString from(
unsigned int u);
330 UString &operator=(
const char *c);
344 bool isNull()
const {
return (rep == &Rep::null); }
360 int size()
const {
return rep->size(); }
364 UChar operator[](
int pos)
const;
378 double toDouble(
bool tolerateTrailingJunk,
bool tolerateEmptyString)
const;
379 double toDouble(
bool tolerateTrailingJunk)
const;
380 double toDouble()
const;
387 unsigned long toULong(
bool *ok,
bool tolerateEmptyString)
const;
388 unsigned long toULong(
bool *ok = 0)
const;
390 unsigned int toUInt32(
bool *ok = 0)
const;
391 unsigned int toStrictUInt32(
bool *ok = 0)
const;
399 unsigned toArrayIndex(
bool *ok = 0)
const;
413 int find(
const UString &f,
int pos = 0)
const;
414 int find(
UChar,
int pos = 0)
const;
420 int rfind(
const UString &f,
int pos)
const;
421 int rfind(
UChar,
int pos)
const;
425 UString substr(
int pos = 0,
int len = -1)
const;
434 static void globalClear();
444 KJS_EXPORT
inline bool operator==(
const UChar &c1,
const UChar &c2) {
445 return (c1.uc == c2.uc);
447 KJS_EXPORT
inline bool operator!=(
const UChar& c1,
const UChar& c2) {
448 return !KJS::operator==(c1, c2);
450 KJS_EXPORT
bool operator==(
const UString& s1,
const UString& s2);
451 inline bool operator!=(
const UString& s1,
const UString& s2) {
452 return !KJS::operator==(s1, s2);
454 KJS_EXPORT
bool operator<(
const UString& s1,
const UString& s2);
455 KJS_EXPORT
bool operator==(
const UString& s1,
const char *s2);
456 KJS_EXPORT
inline bool operator!=(
const UString& s1,
const char *s2) {
457 return !KJS::operator==(s1, s2);
459 KJS_EXPORT
inline bool operator==(
const char *s1,
const UString& s2) {
460 return operator==(s2, s1);
462 KJS_EXPORT
inline bool operator!=(
const char *s1,
const UString& s2) {
463 return !KJS::operator==(s1, s2);
465 KJS_EXPORT
bool operator==(
const CString& s1,
const CString& s2);
466 KJS_EXPORT
inline bool operator!=(
const CString& s1,
const CString& s2) {
467 return !KJS::operator==(s1, s2);
469 KJS_EXPORT
inline UString operator+(
const UString& s1,
const UString& s2) {
470 return UString(s1, s2);
473 KJS_EXPORT
int compare(
const UString &,
const UString &);
8 bit char based string class
Represents an Identifier for a Javascript object.
Dynamic reference to a string character.
unsigned char high() const
UCharReference & operator=(char c)
Same operator as above except the argument that it takes.
unsigned char low() const
unsigned short unicode() const
DOM::DOMString string() const
UString(const DOM::DOMString &)
Convenience declaration only ! See UString(const TQString&).
UString & operator+=(const UString &s)
Appends the specified string.
TQConstString qconststring() const
const UChar * data() const
UString(const UString &s)
Copy constructor.
UString(const TQString &)
Convenience declaration only ! You'll be on your own to write the implementation for a construction f...
A hashtable entry for the PropertyMap.
unsigned char low() const
UChar()
Construct a character with uninitialized value.
unsigned char high() const
unsigned short unicode() const