version 1.48, 2002/08/17 00:59:36
|
version 1.49, 2002/08/20 17:39:37
|
|
|
return _rep->c16a.getData(); | return _rep->c16a.getData(); |
} | } |
| |
char* String::allocateCString(Uint32 extraBytes, Boolean noThrow) const |
char* String::allocateCString(Uint32 extraBytes, Boolean& truncatedCharacters) const |
{ | { |
|
truncatedCharacters = false; |
Uint32 n = size() + 1; | Uint32 n = size() + 1; |
char* str = new char[n + extraBytes]; | char* str = new char[n + extraBytes]; |
char* p = str; | char* p = str; |
|
|
Uint16 c = *q++; | Uint16 c = *q++; |
*p++ = char(c); | *p++ = char(c); |
| |
if ((c & 0xff00) && !noThrow) |
if (c & 0xff00) |
throw TruncatedCharacter(); |
truncatedCharacters = true; |
} | } |
| |
return str; | return str; |
} | } |
| |
|
char* String::allocateCString(Uint32 extraBytes) const |
|
{ |
|
Boolean truncatedCharacters = false; |
|
return allocateCString(extraBytes, truncatedCharacters); |
|
} |
|
|
Char16& String::operator[](Uint32 i) | Char16& String::operator[](Uint32 i) |
{ | { |
if (i > size()) | if (i > size()) |
throw OutOfBounds(); |
throw IndexOutOfBoundsException(); |
| |
return _rep->c16a[i]; | return _rep->c16a[i]; |
} | } |
|
|
const Char16 String::operator[](Uint32 i) const | const Char16 String::operator[](Uint32 i) const |
{ | { |
if (i > size()) | if (i > size()) |
throw OutOfBounds(); |
throw IndexOutOfBoundsException(); |
| |
return _rep->c16a[i]; | return _rep->c16a[i]; |
} | } |
|
|
size = this->size() - pos; | size = this->size() - pos; |
| |
if (pos + size > this->size()) | if (pos + size > this->size()) |
throw OutOfBounds(); |
throw IndexOutOfBoundsException(); |
| |
if (size) | if (size) |
_rep->c16a.remove(pos, size); | _rep->c16a.remove(pos, size); |