зеркало из https://github.com/mozilla/gecko-dev.git
modest improvements to string and deque
This commit is contained in:
Родитель
905cbfd9cc
Коммит
95d921dff4
|
@ -86,12 +86,12 @@ nsDeque& nsDeque::Erase() {
|
|||
|
||||
|
||||
/**
|
||||
* This method adds an item to the end of the queue.
|
||||
* This method adds an item to the end of the deque.
|
||||
* This operation has the potential to cause the
|
||||
* underlying buffer to resize.
|
||||
*
|
||||
* @update gess4/18/98
|
||||
* @param anItem: new item to be added to queue
|
||||
* @param anItem: new item to be added to deque
|
||||
* @return nada
|
||||
*/
|
||||
nsDeque& nsDeque::Push(void* anItem) {
|
||||
|
@ -122,6 +122,50 @@ nsDeque& nsDeque::Push(void* anItem) {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method adds an item to the front of the deque.
|
||||
* This operation has the potential to cause the
|
||||
* underlying buffer to resize.
|
||||
*
|
||||
* @update gess4/18/98
|
||||
* @param anItem: new item to be added to deque
|
||||
* @return nada
|
||||
*/
|
||||
nsDeque& nsDeque::PushFront(void* anItem) {
|
||||
if(mOrigin>0) {
|
||||
mOrigin-=1;
|
||||
mData[mOrigin]=anItem;
|
||||
mSize++;
|
||||
}
|
||||
else {
|
||||
Push(anItem);
|
||||
mOrigin=mSize-1;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove and return the last item in the container.
|
||||
*
|
||||
* @update gess4/18/98
|
||||
* @param none
|
||||
* @return ptr to last item in container
|
||||
*/
|
||||
void* nsDeque::Pop(void) {
|
||||
void* result=0;
|
||||
if(mSize>0) {
|
||||
int offset=mOrigin+mSize-1;
|
||||
if(offset>=mCapacity)
|
||||
offset-=mCapacity;
|
||||
result=mData[offset];
|
||||
mData[offset]=0;
|
||||
mSize--;
|
||||
if(0==mSize)
|
||||
mOrigin=0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method gets called you want to remove and return
|
||||
* the first member in the container.
|
||||
|
@ -130,7 +174,7 @@ nsDeque& nsDeque::Push(void* anItem) {
|
|||
* @param nada
|
||||
* @return last item in container
|
||||
*/
|
||||
void* nsDeque::Pop() {
|
||||
void* nsDeque::PopFront() {
|
||||
void* result=0;
|
||||
if(mSize>0) {
|
||||
result=mData[mOrigin];
|
||||
|
@ -161,28 +205,6 @@ void* nsDeque::Peek() {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove and return the last item in the container.
|
||||
*
|
||||
* @update gess4/18/98
|
||||
* @param none
|
||||
* @return ptr to last item in container
|
||||
*/
|
||||
void* nsDeque::PopBack(void) {
|
||||
void* result=0;
|
||||
if(mSize>0) {
|
||||
int offset=mOrigin+mSize-1;
|
||||
if(offset>=mCapacity)
|
||||
offset-=mCapacity;
|
||||
result=mData[offset];
|
||||
mData[offset]=0;
|
||||
mSize--;
|
||||
if(0==mSize)
|
||||
mOrigin=0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this to retrieve the ith element from this container.
|
||||
* Keep in mind that accessing the underlying elements is
|
||||
|
|
|
@ -94,6 +94,15 @@ friend class nsDequeIterator;
|
|||
*/
|
||||
nsDeque& Push(void* anItem);
|
||||
|
||||
/**
|
||||
* Pushes new member onto the front of the deque
|
||||
*
|
||||
* @update gess4/18/98
|
||||
* @param ptr to object to store
|
||||
* @return *this
|
||||
*/
|
||||
nsDeque& PushFront(void* anItem);
|
||||
|
||||
/**
|
||||
* Remove and return the first item in the container.
|
||||
*
|
||||
|
@ -103,6 +112,16 @@ friend class nsDequeIterator;
|
|||
*/
|
||||
void* Pop(void);
|
||||
|
||||
/**
|
||||
* Remove and return the first item in the container.
|
||||
*
|
||||
* @update gess4/18/98
|
||||
* @param none
|
||||
* @return ptr to first item in container
|
||||
*/
|
||||
void* PopFront(void);
|
||||
|
||||
|
||||
/**
|
||||
* Return topmost item without removing it.
|
||||
*
|
||||
|
@ -112,14 +131,6 @@ friend class nsDequeIterator;
|
|||
*/
|
||||
void* Peek(void);
|
||||
|
||||
/**
|
||||
* Remove and return the last item in the container.
|
||||
*
|
||||
* @update gess4/18/98
|
||||
* @param none
|
||||
* @return ptr to first item in container
|
||||
*/
|
||||
void* PopBack(void);
|
||||
|
||||
/**
|
||||
* Remove all items from container without destroying them
|
||||
|
|
|
@ -39,6 +39,63 @@ PRUnichar kCommonEmptyBuffer[100]; //shared by all strings; NEVER WRITE HERE!!
|
|||
PRBool nsString::mSelfTested = PR_FALSE;
|
||||
|
||||
|
||||
|
||||
#define NOT_USED 0xfffd
|
||||
|
||||
static PRUint16 PA_HackTable[] = {
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
0x201a, /* SINGLE LOW-9 QUOTATION MARK */
|
||||
0x0192, /* LATIN SMALL LETTER F WITH HOOK */
|
||||
0x201e, /* DOUBLE LOW-9 QUOTATION MARK */
|
||||
0x2026, /* HORIZONTAL ELLIPSIS */
|
||||
0x2020, /* DAGGER */
|
||||
0x2021, /* DOUBLE DAGGER */
|
||||
0x02c6, /* MODIFIER LETTER CIRCUMFLEX ACCENT */
|
||||
0x2030, /* PER MILLE SIGN */
|
||||
0x0160, /* LATIN CAPITAL LETTER S WITH CARON */
|
||||
0x2039, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */
|
||||
0x0152, /* LATIN CAPITAL LIGATURE OE */
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
|
||||
NOT_USED,
|
||||
0x2018, /* LEFT SINGLE QUOTATION MARK */
|
||||
0x2019, /* RIGHT SINGLE QUOTATION MARK */
|
||||
0x201c, /* LEFT DOUBLE QUOTATION MARK */
|
||||
0x201d, /* RIGHT DOUBLE QUOTATION MARK */
|
||||
0x2022, /* BULLET */
|
||||
0x2013, /* EN DASH */
|
||||
0x2014, /* EM DASH */
|
||||
0x02dc, /* SMALL TILDE */
|
||||
0x2122, /* TRADE MARK SIGN */
|
||||
0x0161, /* LATIN SMALL LETTER S WITH CARON */
|
||||
0x203a, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */
|
||||
0x0153, /* LATIN SMALL LIGATURE OE */
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
0x0178 /* LATIN CAPITAL LETTER Y WITH DIAERESIS */
|
||||
};
|
||||
|
||||
static PRUnichar gToUCS2[256];
|
||||
|
||||
class CTableConstructor {
|
||||
public:
|
||||
CTableConstructor(){
|
||||
PRUnichar* cp = gToUCS2;
|
||||
PRInt32 i;
|
||||
for (i = 0; i < 256; i++) {
|
||||
*cp++ = PRUnichar(i);
|
||||
}
|
||||
cp = gToUCS2;
|
||||
for (i = 0; i < 32; i++) {
|
||||
cp[0x80 + i] = PA_HackTable[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
static CTableConstructor gTableConstructor;
|
||||
|
||||
/***********************************************************************
|
||||
IMPLEMENTATION NOTES:
|
||||
|
||||
|
@ -402,6 +459,23 @@ void nsString::ToUpperCase()
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts all chars in given string to UCS2
|
||||
*/
|
||||
void nsString::ToUCS2(PRInt32 aStartOffset){
|
||||
if(aStartOffset<mLength){
|
||||
chartype* cp = &mStr[aStartOffset];
|
||||
chartype* end = cp + mLength;
|
||||
while (cp < end) {
|
||||
unsigned char ch = (unsigned char)*cp;
|
||||
*cp=gToUCS2[ch];
|
||||
cp++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Converts chars in this to lowercase, and
|
||||
* stores them in aOut
|
||||
|
|
|
@ -225,6 +225,12 @@ void ToLowerCase(nsString& aString) const;
|
|||
*/
|
||||
void ToUpperCase();
|
||||
|
||||
/**
|
||||
* Converts all chars in given string to UCS2
|
||||
* which ensure that the lower 256 chars are correct.
|
||||
*/
|
||||
void ToUCS2(PRInt32 aStartOffset);
|
||||
|
||||
/**
|
||||
* Converts all chars in internal string to upper
|
||||
*/
|
||||
|
|
|
@ -39,6 +39,63 @@ PRUnichar kCommonEmptyBuffer[100]; //shared by all strings; NEVER WRITE HERE!!
|
|||
PRBool nsString::mSelfTested = PR_FALSE;
|
||||
|
||||
|
||||
|
||||
#define NOT_USED 0xfffd
|
||||
|
||||
static PRUint16 PA_HackTable[] = {
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
0x201a, /* SINGLE LOW-9 QUOTATION MARK */
|
||||
0x0192, /* LATIN SMALL LETTER F WITH HOOK */
|
||||
0x201e, /* DOUBLE LOW-9 QUOTATION MARK */
|
||||
0x2026, /* HORIZONTAL ELLIPSIS */
|
||||
0x2020, /* DAGGER */
|
||||
0x2021, /* DOUBLE DAGGER */
|
||||
0x02c6, /* MODIFIER LETTER CIRCUMFLEX ACCENT */
|
||||
0x2030, /* PER MILLE SIGN */
|
||||
0x0160, /* LATIN CAPITAL LETTER S WITH CARON */
|
||||
0x2039, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */
|
||||
0x0152, /* LATIN CAPITAL LIGATURE OE */
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
|
||||
NOT_USED,
|
||||
0x2018, /* LEFT SINGLE QUOTATION MARK */
|
||||
0x2019, /* RIGHT SINGLE QUOTATION MARK */
|
||||
0x201c, /* LEFT DOUBLE QUOTATION MARK */
|
||||
0x201d, /* RIGHT DOUBLE QUOTATION MARK */
|
||||
0x2022, /* BULLET */
|
||||
0x2013, /* EN DASH */
|
||||
0x2014, /* EM DASH */
|
||||
0x02dc, /* SMALL TILDE */
|
||||
0x2122, /* TRADE MARK SIGN */
|
||||
0x0161, /* LATIN SMALL LETTER S WITH CARON */
|
||||
0x203a, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */
|
||||
0x0153, /* LATIN SMALL LIGATURE OE */
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
0x0178 /* LATIN CAPITAL LETTER Y WITH DIAERESIS */
|
||||
};
|
||||
|
||||
static PRUnichar gToUCS2[256];
|
||||
|
||||
class CTableConstructor {
|
||||
public:
|
||||
CTableConstructor(){
|
||||
PRUnichar* cp = gToUCS2;
|
||||
PRInt32 i;
|
||||
for (i = 0; i < 256; i++) {
|
||||
*cp++ = PRUnichar(i);
|
||||
}
|
||||
cp = gToUCS2;
|
||||
for (i = 0; i < 32; i++) {
|
||||
cp[0x80 + i] = PA_HackTable[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
static CTableConstructor gTableConstructor;
|
||||
|
||||
/***********************************************************************
|
||||
IMPLEMENTATION NOTES:
|
||||
|
||||
|
@ -402,6 +459,23 @@ void nsString::ToUpperCase()
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts all chars in given string to UCS2
|
||||
*/
|
||||
void nsString::ToUCS2(PRInt32 aStartOffset){
|
||||
if(aStartOffset<mLength){
|
||||
chartype* cp = &mStr[aStartOffset];
|
||||
chartype* end = cp + mLength;
|
||||
while (cp < end) {
|
||||
unsigned char ch = (unsigned char)*cp;
|
||||
*cp=gToUCS2[ch];
|
||||
cp++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Converts chars in this to lowercase, and
|
||||
* stores them in aOut
|
||||
|
|
|
@ -225,6 +225,12 @@ void ToLowerCase(nsString& aString) const;
|
|||
*/
|
||||
void ToUpperCase();
|
||||
|
||||
/**
|
||||
* Converts all chars in given string to UCS2
|
||||
* which ensure that the lower 256 chars are correct.
|
||||
*/
|
||||
void ToUCS2(PRInt32 aStartOffset);
|
||||
|
||||
/**
|
||||
* Converts all chars in internal string to upper
|
||||
*/
|
||||
|
|
|
@ -86,12 +86,12 @@ nsDeque& nsDeque::Erase() {
|
|||
|
||||
|
||||
/**
|
||||
* This method adds an item to the end of the queue.
|
||||
* This method adds an item to the end of the deque.
|
||||
* This operation has the potential to cause the
|
||||
* underlying buffer to resize.
|
||||
*
|
||||
* @update gess4/18/98
|
||||
* @param anItem: new item to be added to queue
|
||||
* @param anItem: new item to be added to deque
|
||||
* @return nada
|
||||
*/
|
||||
nsDeque& nsDeque::Push(void* anItem) {
|
||||
|
@ -122,6 +122,50 @@ nsDeque& nsDeque::Push(void* anItem) {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method adds an item to the front of the deque.
|
||||
* This operation has the potential to cause the
|
||||
* underlying buffer to resize.
|
||||
*
|
||||
* @update gess4/18/98
|
||||
* @param anItem: new item to be added to deque
|
||||
* @return nada
|
||||
*/
|
||||
nsDeque& nsDeque::PushFront(void* anItem) {
|
||||
if(mOrigin>0) {
|
||||
mOrigin-=1;
|
||||
mData[mOrigin]=anItem;
|
||||
mSize++;
|
||||
}
|
||||
else {
|
||||
Push(anItem);
|
||||
mOrigin=mSize-1;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove and return the last item in the container.
|
||||
*
|
||||
* @update gess4/18/98
|
||||
* @param none
|
||||
* @return ptr to last item in container
|
||||
*/
|
||||
void* nsDeque::Pop(void) {
|
||||
void* result=0;
|
||||
if(mSize>0) {
|
||||
int offset=mOrigin+mSize-1;
|
||||
if(offset>=mCapacity)
|
||||
offset-=mCapacity;
|
||||
result=mData[offset];
|
||||
mData[offset]=0;
|
||||
mSize--;
|
||||
if(0==mSize)
|
||||
mOrigin=0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method gets called you want to remove and return
|
||||
* the first member in the container.
|
||||
|
@ -130,7 +174,7 @@ nsDeque& nsDeque::Push(void* anItem) {
|
|||
* @param nada
|
||||
* @return last item in container
|
||||
*/
|
||||
void* nsDeque::Pop() {
|
||||
void* nsDeque::PopFront() {
|
||||
void* result=0;
|
||||
if(mSize>0) {
|
||||
result=mData[mOrigin];
|
||||
|
@ -161,28 +205,6 @@ void* nsDeque::Peek() {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove and return the last item in the container.
|
||||
*
|
||||
* @update gess4/18/98
|
||||
* @param none
|
||||
* @return ptr to last item in container
|
||||
*/
|
||||
void* nsDeque::PopBack(void) {
|
||||
void* result=0;
|
||||
if(mSize>0) {
|
||||
int offset=mOrigin+mSize-1;
|
||||
if(offset>=mCapacity)
|
||||
offset-=mCapacity;
|
||||
result=mData[offset];
|
||||
mData[offset]=0;
|
||||
mSize--;
|
||||
if(0==mSize)
|
||||
mOrigin=0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this to retrieve the ith element from this container.
|
||||
* Keep in mind that accessing the underlying elements is
|
||||
|
|
|
@ -94,6 +94,15 @@ friend class nsDequeIterator;
|
|||
*/
|
||||
nsDeque& Push(void* anItem);
|
||||
|
||||
/**
|
||||
* Pushes new member onto the front of the deque
|
||||
*
|
||||
* @update gess4/18/98
|
||||
* @param ptr to object to store
|
||||
* @return *this
|
||||
*/
|
||||
nsDeque& PushFront(void* anItem);
|
||||
|
||||
/**
|
||||
* Remove and return the first item in the container.
|
||||
*
|
||||
|
@ -103,6 +112,16 @@ friend class nsDequeIterator;
|
|||
*/
|
||||
void* Pop(void);
|
||||
|
||||
/**
|
||||
* Remove and return the first item in the container.
|
||||
*
|
||||
* @update gess4/18/98
|
||||
* @param none
|
||||
* @return ptr to first item in container
|
||||
*/
|
||||
void* PopFront(void);
|
||||
|
||||
|
||||
/**
|
||||
* Return topmost item without removing it.
|
||||
*
|
||||
|
@ -112,14 +131,6 @@ friend class nsDequeIterator;
|
|||
*/
|
||||
void* Peek(void);
|
||||
|
||||
/**
|
||||
* Remove and return the last item in the container.
|
||||
*
|
||||
* @update gess4/18/98
|
||||
* @param none
|
||||
* @return ptr to first item in container
|
||||
*/
|
||||
void* PopBack(void);
|
||||
|
||||
/**
|
||||
* Remove all items from container without destroying them
|
||||
|
|
|
@ -39,6 +39,63 @@ PRUnichar kCommonEmptyBuffer[100]; //shared by all strings; NEVER WRITE HERE!!
|
|||
PRBool nsString::mSelfTested = PR_FALSE;
|
||||
|
||||
|
||||
|
||||
#define NOT_USED 0xfffd
|
||||
|
||||
static PRUint16 PA_HackTable[] = {
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
0x201a, /* SINGLE LOW-9 QUOTATION MARK */
|
||||
0x0192, /* LATIN SMALL LETTER F WITH HOOK */
|
||||
0x201e, /* DOUBLE LOW-9 QUOTATION MARK */
|
||||
0x2026, /* HORIZONTAL ELLIPSIS */
|
||||
0x2020, /* DAGGER */
|
||||
0x2021, /* DOUBLE DAGGER */
|
||||
0x02c6, /* MODIFIER LETTER CIRCUMFLEX ACCENT */
|
||||
0x2030, /* PER MILLE SIGN */
|
||||
0x0160, /* LATIN CAPITAL LETTER S WITH CARON */
|
||||
0x2039, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */
|
||||
0x0152, /* LATIN CAPITAL LIGATURE OE */
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
|
||||
NOT_USED,
|
||||
0x2018, /* LEFT SINGLE QUOTATION MARK */
|
||||
0x2019, /* RIGHT SINGLE QUOTATION MARK */
|
||||
0x201c, /* LEFT DOUBLE QUOTATION MARK */
|
||||
0x201d, /* RIGHT DOUBLE QUOTATION MARK */
|
||||
0x2022, /* BULLET */
|
||||
0x2013, /* EN DASH */
|
||||
0x2014, /* EM DASH */
|
||||
0x02dc, /* SMALL TILDE */
|
||||
0x2122, /* TRADE MARK SIGN */
|
||||
0x0161, /* LATIN SMALL LETTER S WITH CARON */
|
||||
0x203a, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */
|
||||
0x0153, /* LATIN SMALL LIGATURE OE */
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
0x0178 /* LATIN CAPITAL LETTER Y WITH DIAERESIS */
|
||||
};
|
||||
|
||||
static PRUnichar gToUCS2[256];
|
||||
|
||||
class CTableConstructor {
|
||||
public:
|
||||
CTableConstructor(){
|
||||
PRUnichar* cp = gToUCS2;
|
||||
PRInt32 i;
|
||||
for (i = 0; i < 256; i++) {
|
||||
*cp++ = PRUnichar(i);
|
||||
}
|
||||
cp = gToUCS2;
|
||||
for (i = 0; i < 32; i++) {
|
||||
cp[0x80 + i] = PA_HackTable[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
static CTableConstructor gTableConstructor;
|
||||
|
||||
/***********************************************************************
|
||||
IMPLEMENTATION NOTES:
|
||||
|
||||
|
@ -402,6 +459,23 @@ void nsString::ToUpperCase()
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts all chars in given string to UCS2
|
||||
*/
|
||||
void nsString::ToUCS2(PRInt32 aStartOffset){
|
||||
if(aStartOffset<mLength){
|
||||
chartype* cp = &mStr[aStartOffset];
|
||||
chartype* end = cp + mLength;
|
||||
while (cp < end) {
|
||||
unsigned char ch = (unsigned char)*cp;
|
||||
*cp=gToUCS2[ch];
|
||||
cp++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Converts chars in this to lowercase, and
|
||||
* stores them in aOut
|
||||
|
|
|
@ -225,6 +225,12 @@ void ToLowerCase(nsString& aString) const;
|
|||
*/
|
||||
void ToUpperCase();
|
||||
|
||||
/**
|
||||
* Converts all chars in given string to UCS2
|
||||
* which ensure that the lower 256 chars are correct.
|
||||
*/
|
||||
void ToUCS2(PRInt32 aStartOffset);
|
||||
|
||||
/**
|
||||
* Converts all chars in internal string to upper
|
||||
*/
|
||||
|
|
|
@ -39,6 +39,63 @@ PRUnichar kCommonEmptyBuffer[100]; //shared by all strings; NEVER WRITE HERE!!
|
|||
PRBool nsString::mSelfTested = PR_FALSE;
|
||||
|
||||
|
||||
|
||||
#define NOT_USED 0xfffd
|
||||
|
||||
static PRUint16 PA_HackTable[] = {
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
0x201a, /* SINGLE LOW-9 QUOTATION MARK */
|
||||
0x0192, /* LATIN SMALL LETTER F WITH HOOK */
|
||||
0x201e, /* DOUBLE LOW-9 QUOTATION MARK */
|
||||
0x2026, /* HORIZONTAL ELLIPSIS */
|
||||
0x2020, /* DAGGER */
|
||||
0x2021, /* DOUBLE DAGGER */
|
||||
0x02c6, /* MODIFIER LETTER CIRCUMFLEX ACCENT */
|
||||
0x2030, /* PER MILLE SIGN */
|
||||
0x0160, /* LATIN CAPITAL LETTER S WITH CARON */
|
||||
0x2039, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */
|
||||
0x0152, /* LATIN CAPITAL LIGATURE OE */
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
|
||||
NOT_USED,
|
||||
0x2018, /* LEFT SINGLE QUOTATION MARK */
|
||||
0x2019, /* RIGHT SINGLE QUOTATION MARK */
|
||||
0x201c, /* LEFT DOUBLE QUOTATION MARK */
|
||||
0x201d, /* RIGHT DOUBLE QUOTATION MARK */
|
||||
0x2022, /* BULLET */
|
||||
0x2013, /* EN DASH */
|
||||
0x2014, /* EM DASH */
|
||||
0x02dc, /* SMALL TILDE */
|
||||
0x2122, /* TRADE MARK SIGN */
|
||||
0x0161, /* LATIN SMALL LETTER S WITH CARON */
|
||||
0x203a, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */
|
||||
0x0153, /* LATIN SMALL LIGATURE OE */
|
||||
NOT_USED,
|
||||
NOT_USED,
|
||||
0x0178 /* LATIN CAPITAL LETTER Y WITH DIAERESIS */
|
||||
};
|
||||
|
||||
static PRUnichar gToUCS2[256];
|
||||
|
||||
class CTableConstructor {
|
||||
public:
|
||||
CTableConstructor(){
|
||||
PRUnichar* cp = gToUCS2;
|
||||
PRInt32 i;
|
||||
for (i = 0; i < 256; i++) {
|
||||
*cp++ = PRUnichar(i);
|
||||
}
|
||||
cp = gToUCS2;
|
||||
for (i = 0; i < 32; i++) {
|
||||
cp[0x80 + i] = PA_HackTable[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
static CTableConstructor gTableConstructor;
|
||||
|
||||
/***********************************************************************
|
||||
IMPLEMENTATION NOTES:
|
||||
|
||||
|
@ -402,6 +459,23 @@ void nsString::ToUpperCase()
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts all chars in given string to UCS2
|
||||
*/
|
||||
void nsString::ToUCS2(PRInt32 aStartOffset){
|
||||
if(aStartOffset<mLength){
|
||||
chartype* cp = &mStr[aStartOffset];
|
||||
chartype* end = cp + mLength;
|
||||
while (cp < end) {
|
||||
unsigned char ch = (unsigned char)*cp;
|
||||
*cp=gToUCS2[ch];
|
||||
cp++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Converts chars in this to lowercase, and
|
||||
* stores them in aOut
|
||||
|
|
|
@ -225,6 +225,12 @@ void ToLowerCase(nsString& aString) const;
|
|||
*/
|
||||
void ToUpperCase();
|
||||
|
||||
/**
|
||||
* Converts all chars in given string to UCS2
|
||||
* which ensure that the lower 256 chars are correct.
|
||||
*/
|
||||
void ToUCS2(PRInt32 aStartOffset);
|
||||
|
||||
/**
|
||||
* Converts all chars in internal string to upper
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче