23 #ifndef _KJS_USTRING_H_
24 #define _KJS_USTRING_H_
57 UChar(
unsigned char u);
63 UChar(
unsigned char h ,
unsigned char l);
68 UChar(
unsigned short u);
73 unsigned char high()
const {
return uc >> 8; }
77 unsigned char low()
const {
return uc; }
81 unsigned short unicode()
const {
return uc; }
86 UChar toLower()
const;
90 UChar toUpper()
const;
100 inline UChar::UChar(
unsigned char h ,
unsigned char l) : uc(h << 8 | l) { }
134 unsigned short unicode()
const {
return ref().uc; }
138 unsigned char low()
const {
return ref().uc; }
142 unsigned char high()
const {
return ref().uc >> 8; }
160 inline UChar::UChar(
const UCharReference &c) : uc(c.unicode()) { }
167 CString() : data(0L), length(0) { }
169 CString(
const char *c,
int len);
175 CString &operator=(
const char *c);
179 int size()
const {
return length; }
180 const char *c_str()
const {
return data; }
198 struct KJS_EXPORT Rep {
202 static Rep *create(
UChar *d,
int l);
205 UChar *data()
const {
return dat; }
206 int size()
const {
return len; }
208 unsigned hash()
const {
if (_hash == 0) _hash = computeHash(dat, len);
return _hash; }
210 static unsigned computeHash(
const UChar *,
int length);
211 static unsigned computeHash(
const char *);
214 void deref() {
if (--rc == 0) destroy(); }
220 mutable unsigned _hash;
222 enum { capacityForIdentifier = 0x10000000 };
286 static UString from(
unsigned int u);
329 UString &operator=(
const char *c);
343 bool isNull()
const {
return (rep == &Rep::null); }
359 int size()
const {
return rep->size(); }
363 UChar operator[](
int pos)
const;
377 double toDouble(
bool tolerateTrailingJunk,
bool tolerateEmptyString)
const;
378 double toDouble(
bool tolerateTrailingJunk)
const;
379 double toDouble()
const;
386 unsigned long toULong(
bool *ok,
bool tolerateEmptyString)
const;
387 unsigned long toULong(
bool *ok = 0)
const;
389 unsigned int toUInt32(
bool *ok = 0)
const;
390 unsigned int toStrictUInt32(
bool *ok = 0)
const;
398 unsigned toArrayIndex(
bool *ok = 0)
const;
412 int find(
const UString &f,
int pos = 0)
const;
413 int find(
UChar,
int pos = 0)
const;
419 int rfind(
const UString &f,
int pos)
const;
420 int rfind(
UChar,
int pos)
const;
424 UString substr(
int pos = 0,
int len = -1)
const;
433 static void globalClear();
443 KJS_EXPORT
inline bool operator==(
const UChar &c1,
const UChar &c2) {
444 return (c1.uc == c2.uc);
446 KJS_EXPORT
inline bool operator!=(
const UChar& c1,
const UChar& c2) {
447 return !KJS::operator==(c1, c2);
449 KJS_EXPORT
bool operator==(
const UString& s1,
const UString& s2);
450 inline bool operator!=(
const UString& s1,
const UString& s2) {
451 return !KJS::operator==(s1, s2);
453 KJS_EXPORT
bool operator<(
const UString& s1,
const UString& s2);
454 KJS_EXPORT
bool operator==(
const UString& s1,
const char *s2);
455 KJS_EXPORT
inline bool operator!=(
const UString& s1,
const char *s2) {
456 return !KJS::operator==(s1, s2);
458 KJS_EXPORT
inline bool operator==(
const char *s1,
const UString& s2) {
459 return operator==(s2, s1);
461 KJS_EXPORT
inline bool operator!=(
const char *s1,
const UString& s2) {
462 return !KJS::operator==(s1, s2);
464 KJS_EXPORT
bool operator==(
const CString& s1,
const CString& s2);
465 KJS_EXPORT
inline bool operator!=(
const CString& s1,
const CString& s2) {
466 return !KJS::operator==(s1, s2);
468 KJS_EXPORT
inline UString operator+(
const UString& s1,
const UString& s2) {
469 return UString(s1, s2);
472 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