зеркало из https://github.com/mozilla/pjs.git
landing phase 2 to remove deprecated string calls
This commit is contained in:
Родитель
c617e3f2e9
Коммит
7c4f6b3293
|
@ -853,7 +853,7 @@ static PRBool EnumerateMediaString(const nsString& aStringList, nsStringEnumFunc
|
|||
while (running && (kNullCh != *start)) {
|
||||
PRBool quoted = PR_FALSE;
|
||||
|
||||
while ((kNullCh != *start) && nsString::IsSpace(*start)) { // skip leading space
|
||||
while ((kNullCh != *start) && nsCRT::IsAsciiSpace(*start)) { // skip leading space
|
||||
start++;
|
||||
}
|
||||
|
||||
|
@ -884,8 +884,8 @@ static PRBool EnumerateMediaString(const nsString& aStringList, nsStringEnumFunc
|
|||
// truncate at first non letter, digit or hyphen
|
||||
PRUnichar* test = start;
|
||||
while (test <= end) {
|
||||
if ((PR_FALSE == nsString::IsAlpha(*test)) &&
|
||||
(PR_FALSE == nsString::IsDigit(*test)) && (kMinus != *test)) {
|
||||
if ((PR_FALSE == nsCRT::IsAsciiAlpha(*test)) &&
|
||||
(PR_FALSE == nsCRT::IsAsciiDigit(*test)) && (kMinus != *test)) {
|
||||
*test = kNullCh;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2198,12 +2198,12 @@ static PRBool ValueIncludes(const nsString& aValueList, const nsString& aValue,
|
|||
PRUnichar* end = start;
|
||||
|
||||
while (kNullCh != *start) {
|
||||
while ((kNullCh != *start) && nsString::IsSpace(*start)) { // skip leading space
|
||||
while ((kNullCh != *start) && nsCRT::IsAsciiSpace(*start)) { // skip leading space
|
||||
start++;
|
||||
}
|
||||
end = start;
|
||||
|
||||
while ((kNullCh != *end) && (PR_FALSE == nsString::IsSpace(*end))) { // look for space or end
|
||||
while ((kNullCh != *end) && (PR_FALSE == nsCRT::IsAsciiSpace(*end))) { // look for space or end
|
||||
end++;
|
||||
}
|
||||
*end = kNullCh; // end string here
|
||||
|
@ -2239,7 +2239,7 @@ static PRBool ValueDashMatch(const nsString& aValueList, const nsString& aValue,
|
|||
PRUnichar* end = start;
|
||||
|
||||
if (kNullCh != *start) {
|
||||
while ((kNullCh != *start) && nsString::IsSpace(*start)) { // skip leading space
|
||||
while ((kNullCh != *start) && nsCRT::IsAsciiSpace(*start)) { // skip leading space
|
||||
start++;
|
||||
}
|
||||
end = start;
|
||||
|
|
|
@ -978,12 +978,12 @@ static void ParseClasses(const nsString& aClassString, nsClassList& aClassList)
|
|||
|
||||
nsClassList* list = &aClassList;
|
||||
while (list && (kNullCh != *start)) {
|
||||
while ((kNullCh != *start) && nsString::IsSpace(*start)) { // skip leading space
|
||||
while ((kNullCh != *start) && nsCRT::IsAsciiSpace(*start)) { // skip leading space
|
||||
start++;
|
||||
}
|
||||
end = start;
|
||||
|
||||
while ((kNullCh != *end) && (PR_FALSE == nsString::IsSpace(*end))) { // look for space or end
|
||||
while ((kNullCh != *end) && (PR_FALSE == nsCRT::IsAsciiSpace(*end))) { // look for space or end
|
||||
end++;
|
||||
}
|
||||
*end = kNullCh; // end string here
|
||||
|
|
|
@ -2771,7 +2771,7 @@ NS_IMETHODIMP GlobalWindowImpl::CheckWindowName(JSContext* cx, nsString& aName)
|
|||
for(strIndex = 0; strIndex < aName.Length(); strIndex++)
|
||||
{
|
||||
mChar = aName.CharAt(strIndex);
|
||||
if(!nsString::IsAlpha(mChar) && !nsString::IsDigit(mChar) &&
|
||||
if(!nsCRT::IsAsciiAlpha(mChar) && !nsCRT::IsAsciiDigit(mChar) &&
|
||||
mChar != '_')
|
||||
{
|
||||
char* cp = aName.ToNewCString();
|
||||
|
|
|
@ -3823,7 +3823,7 @@ nsHTMLEditRules::DoTextNodeWhitespace(nsIDOMCharacterData *aTextNode, PRInt32 aS
|
|||
PRInt32 runStart = -1, runEnd = -1;
|
||||
do {
|
||||
PRUnichar c = tempString[j];
|
||||
PRBool isSpace = nsString::IsSpace(c);
|
||||
PRBool isSpace = nsCRT::IsAsciiSpace(c);
|
||||
if (isSpace || c==nbsp)
|
||||
{
|
||||
if (runStart<0) runStart = j;
|
||||
|
|
|
@ -909,7 +909,7 @@ nsHTMLEditorLog::PrintUnicode(const nsString &aString)
|
|||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (nsString::IsAlpha(uc[i]) || nsString::IsDigit(uc[i]) || uc[i] == ' ')
|
||||
if (nsCRT::IsAsciiAlpha(uc[i]) || nsCRT::IsAsciiDigit(uc[i]) || uc[i] == ' ')
|
||||
sprintf(buf, "%c", uc[i]);
|
||||
else
|
||||
sprintf(buf, "\\u%.4x", uc[i]);
|
||||
|
|
|
@ -3823,7 +3823,7 @@ nsHTMLEditRules::DoTextNodeWhitespace(nsIDOMCharacterData *aTextNode, PRInt32 aS
|
|||
PRInt32 runStart = -1, runEnd = -1;
|
||||
do {
|
||||
PRUnichar c = tempString[j];
|
||||
PRBool isSpace = nsString::IsSpace(c);
|
||||
PRBool isSpace = nsCRT::IsAsciiSpace(c);
|
||||
if (isSpace || c==nbsp)
|
||||
{
|
||||
if (runStart<0) runStart = j;
|
||||
|
|
|
@ -909,7 +909,7 @@ nsHTMLEditorLog::PrintUnicode(const nsString &aString)
|
|||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (nsString::IsAlpha(uc[i]) || nsString::IsDigit(uc[i]) || uc[i] == ' ')
|
||||
if (nsCRT::IsAsciiAlpha(uc[i]) || nsCRT::IsAsciiDigit(uc[i]) || uc[i] == ' ')
|
||||
sprintf(buf, "%c", uc[i]);
|
||||
else
|
||||
sprintf(buf, "\\u%.4x", uc[i]);
|
||||
|
|
|
@ -132,18 +132,9 @@ nsColorNames::LookupName(const nsCString& aColorName)
|
|||
}
|
||||
|
||||
nsColorName
|
||||
nsColorNames::LookupName(const nsString& aColorName)
|
||||
{
|
||||
NS_ASSERTION(gColorTree, "no lookup table, needs addref");
|
||||
if (gColorTree) {
|
||||
ColorNode node(aColorName, eColorName_UNKNOWN);
|
||||
ColorNode* found = (ColorNode*)gColorTree->FindItem(&node);
|
||||
if (found) {
|
||||
NS_ASSERTION(found->mStr.EqualsIgnoreCase(aColorName), "bad tree");
|
||||
return found->mEnum;
|
||||
}
|
||||
}
|
||||
return eColorName_UNKNOWN;
|
||||
nsColorNames::LookupName(const nsString& aColorName) {
|
||||
nsCAutoString theName(aColorName);
|
||||
return LookupName(theName);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ PRBool nsFont::EnumerateFamilies(nsFontFamilyEnumFunc aFunc, void* aData) const
|
|||
PRBool quoted = PR_FALSE;
|
||||
PRBool generic = PR_FALSE;
|
||||
|
||||
while ((kNullCh != *start) && nsString::IsSpace(*start)) { // skip leading space
|
||||
while ((kNullCh != *start) && nsCRT::IsAsciiSpace(*start)) { // skip leading space
|
||||
start++;
|
||||
}
|
||||
|
||||
|
|
|
@ -853,7 +853,7 @@ static PRBool EnumerateMediaString(const nsString& aStringList, nsStringEnumFunc
|
|||
while (running && (kNullCh != *start)) {
|
||||
PRBool quoted = PR_FALSE;
|
||||
|
||||
while ((kNullCh != *start) && nsString::IsSpace(*start)) { // skip leading space
|
||||
while ((kNullCh != *start) && nsCRT::IsAsciiSpace(*start)) { // skip leading space
|
||||
start++;
|
||||
}
|
||||
|
||||
|
@ -884,8 +884,8 @@ static PRBool EnumerateMediaString(const nsString& aStringList, nsStringEnumFunc
|
|||
// truncate at first non letter, digit or hyphen
|
||||
PRUnichar* test = start;
|
||||
while (test <= end) {
|
||||
if ((PR_FALSE == nsString::IsAlpha(*test)) &&
|
||||
(PR_FALSE == nsString::IsDigit(*test)) && (kMinus != *test)) {
|
||||
if ((PR_FALSE == nsCRT::IsAsciiAlpha(*test)) &&
|
||||
(PR_FALSE == nsCRT::IsAsciiDigit(*test)) && (kMinus != *test)) {
|
||||
*test = kNullCh;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2198,12 +2198,12 @@ static PRBool ValueIncludes(const nsString& aValueList, const nsString& aValue,
|
|||
PRUnichar* end = start;
|
||||
|
||||
while (kNullCh != *start) {
|
||||
while ((kNullCh != *start) && nsString::IsSpace(*start)) { // skip leading space
|
||||
while ((kNullCh != *start) && nsCRT::IsAsciiSpace(*start)) { // skip leading space
|
||||
start++;
|
||||
}
|
||||
end = start;
|
||||
|
||||
while ((kNullCh != *end) && (PR_FALSE == nsString::IsSpace(*end))) { // look for space or end
|
||||
while ((kNullCh != *end) && (PR_FALSE == nsCRT::IsAsciiSpace(*end))) { // look for space or end
|
||||
end++;
|
||||
}
|
||||
*end = kNullCh; // end string here
|
||||
|
@ -2239,7 +2239,7 @@ static PRBool ValueDashMatch(const nsString& aValueList, const nsString& aValue,
|
|||
PRUnichar* end = start;
|
||||
|
||||
if (kNullCh != *start) {
|
||||
while ((kNullCh != *start) && nsString::IsSpace(*start)) { // skip leading space
|
||||
while ((kNullCh != *start) && nsCRT::IsAsciiSpace(*start)) { // skip leading space
|
||||
start++;
|
||||
}
|
||||
end = start;
|
||||
|
|
|
@ -978,12 +978,12 @@ static void ParseClasses(const nsString& aClassString, nsClassList& aClassList)
|
|||
|
||||
nsClassList* list = &aClassList;
|
||||
while (list && (kNullCh != *start)) {
|
||||
while ((kNullCh != *start) && nsString::IsSpace(*start)) { // skip leading space
|
||||
while ((kNullCh != *start) && nsCRT::IsAsciiSpace(*start)) { // skip leading space
|
||||
start++;
|
||||
}
|
||||
end = start;
|
||||
|
||||
while ((kNullCh != *end) && (PR_FALSE == nsString::IsSpace(*end))) { // look for space or end
|
||||
while ((kNullCh != *end) && (PR_FALSE == nsCRT::IsAsciiSpace(*end))) { // look for space or end
|
||||
end++;
|
||||
}
|
||||
*end = kNullCh; // end string here
|
||||
|
|
|
@ -853,7 +853,7 @@ static PRBool EnumerateMediaString(const nsString& aStringList, nsStringEnumFunc
|
|||
while (running && (kNullCh != *start)) {
|
||||
PRBool quoted = PR_FALSE;
|
||||
|
||||
while ((kNullCh != *start) && nsString::IsSpace(*start)) { // skip leading space
|
||||
while ((kNullCh != *start) && nsCRT::IsAsciiSpace(*start)) { // skip leading space
|
||||
start++;
|
||||
}
|
||||
|
||||
|
@ -884,8 +884,8 @@ static PRBool EnumerateMediaString(const nsString& aStringList, nsStringEnumFunc
|
|||
// truncate at first non letter, digit or hyphen
|
||||
PRUnichar* test = start;
|
||||
while (test <= end) {
|
||||
if ((PR_FALSE == nsString::IsAlpha(*test)) &&
|
||||
(PR_FALSE == nsString::IsDigit(*test)) && (kMinus != *test)) {
|
||||
if ((PR_FALSE == nsCRT::IsAsciiAlpha(*test)) &&
|
||||
(PR_FALSE == nsCRT::IsAsciiDigit(*test)) && (kMinus != *test)) {
|
||||
*test = kNullCh;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2198,12 +2198,12 @@ static PRBool ValueIncludes(const nsString& aValueList, const nsString& aValue,
|
|||
PRUnichar* end = start;
|
||||
|
||||
while (kNullCh != *start) {
|
||||
while ((kNullCh != *start) && nsString::IsSpace(*start)) { // skip leading space
|
||||
while ((kNullCh != *start) && nsCRT::IsAsciiSpace(*start)) { // skip leading space
|
||||
start++;
|
||||
}
|
||||
end = start;
|
||||
|
||||
while ((kNullCh != *end) && (PR_FALSE == nsString::IsSpace(*end))) { // look for space or end
|
||||
while ((kNullCh != *end) && (PR_FALSE == nsCRT::IsAsciiSpace(*end))) { // look for space or end
|
||||
end++;
|
||||
}
|
||||
*end = kNullCh; // end string here
|
||||
|
@ -2239,7 +2239,7 @@ static PRBool ValueDashMatch(const nsString& aValueList, const nsString& aValue,
|
|||
PRUnichar* end = start;
|
||||
|
||||
if (kNullCh != *start) {
|
||||
while ((kNullCh != *start) && nsString::IsSpace(*start)) { // skip leading space
|
||||
while ((kNullCh != *start) && nsCRT::IsAsciiSpace(*start)) { // skip leading space
|
||||
start++;
|
||||
}
|
||||
end = start;
|
||||
|
|
|
@ -143,27 +143,6 @@ void nsCString::Truncate(PRUint32 anIndex) {
|
|||
nsStr::Truncate(*this,anIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in sorted order.
|
||||
*
|
||||
* @update gess 8/25/98
|
||||
* @return TRUE if ordered.
|
||||
*/
|
||||
PRBool nsCString::IsOrdered(void) const {
|
||||
PRBool result=PR_TRUE;
|
||||
if(mLength>1) {
|
||||
PRUint32 theIndex;
|
||||
for(theIndex=1;theIndex<mLength;theIndex++) {
|
||||
if(mStr[theIndex-1]>mStr[theIndex]) {
|
||||
result=PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call this method if you want to force the string to a certain capacity
|
||||
|
@ -1205,30 +1184,6 @@ nsCString& nsCString::Cut(PRUint32 anOffset, PRInt32 aCount) {
|
|||
Searching methods...
|
||||
*********************************************************************/
|
||||
|
||||
/**
|
||||
* Search for given character within this string.
|
||||
* This method does so by using a binary search,
|
||||
* so your string HAD BETTER BE ORDERED!
|
||||
*
|
||||
* @param aChar is the unicode char to be found
|
||||
* @return offset in string, or -1 (kNotFound)
|
||||
*/
|
||||
PRInt32 nsCString::BinarySearch(PRUnichar aChar) const{
|
||||
PRInt32 low=0;
|
||||
PRInt32 high=mLength-1;
|
||||
|
||||
while (low <= high) {
|
||||
int middle = (low + high) >> 1;
|
||||
PRUnichar theChar=GetCharAt(*this,middle);
|
||||
if (theChar==aChar)
|
||||
return middle;
|
||||
if (theChar>aChar)
|
||||
high = middle - 1;
|
||||
else
|
||||
low = middle + 1;
|
||||
}
|
||||
return kNotFound;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for given cstr within this string
|
||||
|
|
|
@ -130,16 +130,6 @@ public:
|
|||
*/
|
||||
void Truncate(PRUint32 anIndex=0);
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in sorted order.
|
||||
*
|
||||
* @return TRUE if ordered.
|
||||
*/
|
||||
PRBool IsOrdered(void) const;
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether or not this string has a length of 0
|
||||
*
|
||||
|
@ -516,15 +506,6 @@ public:
|
|||
Searching methods...
|
||||
*********************************************************************/
|
||||
|
||||
/**
|
||||
* Search for given character within this string.
|
||||
* This method does so by using a binary search,
|
||||
* so your string HAD BETTER BE ORDERED!
|
||||
*
|
||||
* @param aChar is the unicode char to be found
|
||||
* @return offset in string, or -1 (kNotFound)
|
||||
*/
|
||||
PRInt32 BinarySearch(PRUnichar aChar) const;
|
||||
|
||||
/**
|
||||
* Search for given substring within this string
|
||||
|
|
|
@ -153,31 +153,6 @@ void nsString::Truncate(PRUint32 anIndex) {
|
|||
nsStr::Truncate(*this,anIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in sorted order.
|
||||
*
|
||||
* @update gess 8/25/98
|
||||
* @return TRUE if ordered.
|
||||
*/
|
||||
PRBool nsString::IsOrdered(void) const {
|
||||
PRBool result=PR_TRUE;
|
||||
if(mLength>1) {
|
||||
PRUint32 theIndex;
|
||||
PRUnichar c1=0;
|
||||
PRUnichar c2=GetCharAt(*this,0);
|
||||
for(theIndex=1;theIndex<mLength;theIndex++) {
|
||||
c1=c2;
|
||||
c2=GetCharAt(*this,theIndex);
|
||||
if(c1>c2) {
|
||||
result=PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call this method if you want to force the string to a certain capacity
|
||||
|
@ -1411,31 +1386,6 @@ nsString& nsString::Cut(PRUint32 anOffset, PRInt32 aCount) {
|
|||
Searching methods...
|
||||
*********************************************************************/
|
||||
|
||||
/**
|
||||
* Search for given character within this string.
|
||||
* This method does so by using a binary search,
|
||||
* so your string HAD BETTER BE ORDERED!
|
||||
*
|
||||
* @param aChar is the unicode char to be found
|
||||
* @return offset in string, or -1 (kNotFound)
|
||||
*/
|
||||
PRInt32 nsString::BinarySearch(PRUnichar aChar) const{
|
||||
PRInt32 low=0;
|
||||
PRInt32 high=mLength-1;
|
||||
|
||||
while (low <= high) {
|
||||
int middle = (low + high) >> 1;
|
||||
PRUnichar theChar=GetCharAt(*this,middle);
|
||||
if (theChar==aChar)
|
||||
return middle;
|
||||
if (theChar>aChar)
|
||||
high = middle - 1;
|
||||
else
|
||||
low = middle + 1;
|
||||
}
|
||||
return kNotFound;
|
||||
}
|
||||
|
||||
/**
|
||||
* search for given string within this string
|
||||
*
|
||||
|
|
|
@ -144,14 +144,6 @@ public:
|
|||
void Truncate(PRUint32 anIndex=0);
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in sorted order.
|
||||
*
|
||||
* @return TRUE if ordered.
|
||||
*/
|
||||
PRBool IsOrdered(void) const;
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in store as 1 or 2 byte (unicode) strings.
|
||||
|
@ -566,16 +558,6 @@ public:
|
|||
Searching methods...
|
||||
*********************************************************************/
|
||||
|
||||
/**
|
||||
* Search for given character within this string.
|
||||
* This method does so by using a binary search,
|
||||
* so your string HAD BETTER BE ORDERED!
|
||||
*
|
||||
* @param aChar is the unicode char to be found
|
||||
* @return offset in string, or -1 (kNotFound)
|
||||
*/
|
||||
PRInt32 BinarySearch(PRUnichar aChar) const;
|
||||
|
||||
/**
|
||||
* Search for given substring within this string
|
||||
*
|
||||
|
|
|
@ -258,8 +258,11 @@ nsStringKey::nsStringKey(const PRUnichar* str)
|
|||
mStr.Assign(str);
|
||||
}
|
||||
|
||||
nsStringKey::nsStringKey(const nsStr& str)
|
||||
{
|
||||
nsStringKey::nsStringKey(const nsString& str) {
|
||||
mStr.Assign(str);
|
||||
}
|
||||
|
||||
nsStringKey::nsStringKey(const nsCString& str) {
|
||||
mStr.Assign(str);
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,8 @@ protected:
|
|||
public:
|
||||
nsStringKey(const char* str);
|
||||
nsStringKey(const PRUnichar* str);
|
||||
nsStringKey(const nsStr& str);
|
||||
nsStringKey(const nsString& str);
|
||||
nsStringKey(const nsCString& str);
|
||||
|
||||
~nsStringKey(void);
|
||||
|
||||
|
|
|
@ -143,27 +143,6 @@ void nsCString::Truncate(PRUint32 anIndex) {
|
|||
nsStr::Truncate(*this,anIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in sorted order.
|
||||
*
|
||||
* @update gess 8/25/98
|
||||
* @return TRUE if ordered.
|
||||
*/
|
||||
PRBool nsCString::IsOrdered(void) const {
|
||||
PRBool result=PR_TRUE;
|
||||
if(mLength>1) {
|
||||
PRUint32 theIndex;
|
||||
for(theIndex=1;theIndex<mLength;theIndex++) {
|
||||
if(mStr[theIndex-1]>mStr[theIndex]) {
|
||||
result=PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call this method if you want to force the string to a certain capacity
|
||||
|
@ -1205,30 +1184,6 @@ nsCString& nsCString::Cut(PRUint32 anOffset, PRInt32 aCount) {
|
|||
Searching methods...
|
||||
*********************************************************************/
|
||||
|
||||
/**
|
||||
* Search for given character within this string.
|
||||
* This method does so by using a binary search,
|
||||
* so your string HAD BETTER BE ORDERED!
|
||||
*
|
||||
* @param aChar is the unicode char to be found
|
||||
* @return offset in string, or -1 (kNotFound)
|
||||
*/
|
||||
PRInt32 nsCString::BinarySearch(PRUnichar aChar) const{
|
||||
PRInt32 low=0;
|
||||
PRInt32 high=mLength-1;
|
||||
|
||||
while (low <= high) {
|
||||
int middle = (low + high) >> 1;
|
||||
PRUnichar theChar=GetCharAt(*this,middle);
|
||||
if (theChar==aChar)
|
||||
return middle;
|
||||
if (theChar>aChar)
|
||||
high = middle - 1;
|
||||
else
|
||||
low = middle + 1;
|
||||
}
|
||||
return kNotFound;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for given cstr within this string
|
||||
|
|
|
@ -130,16 +130,6 @@ public:
|
|||
*/
|
||||
void Truncate(PRUint32 anIndex=0);
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in sorted order.
|
||||
*
|
||||
* @return TRUE if ordered.
|
||||
*/
|
||||
PRBool IsOrdered(void) const;
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether or not this string has a length of 0
|
||||
*
|
||||
|
@ -516,15 +506,6 @@ public:
|
|||
Searching methods...
|
||||
*********************************************************************/
|
||||
|
||||
/**
|
||||
* Search for given character within this string.
|
||||
* This method does so by using a binary search,
|
||||
* so your string HAD BETTER BE ORDERED!
|
||||
*
|
||||
* @param aChar is the unicode char to be found
|
||||
* @return offset in string, or -1 (kNotFound)
|
||||
*/
|
||||
PRInt32 BinarySearch(PRUnichar aChar) const;
|
||||
|
||||
/**
|
||||
* Search for given substring within this string
|
||||
|
|
|
@ -153,31 +153,6 @@ void nsString::Truncate(PRUint32 anIndex) {
|
|||
nsStr::Truncate(*this,anIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in sorted order.
|
||||
*
|
||||
* @update gess 8/25/98
|
||||
* @return TRUE if ordered.
|
||||
*/
|
||||
PRBool nsString::IsOrdered(void) const {
|
||||
PRBool result=PR_TRUE;
|
||||
if(mLength>1) {
|
||||
PRUint32 theIndex;
|
||||
PRUnichar c1=0;
|
||||
PRUnichar c2=GetCharAt(*this,0);
|
||||
for(theIndex=1;theIndex<mLength;theIndex++) {
|
||||
c1=c2;
|
||||
c2=GetCharAt(*this,theIndex);
|
||||
if(c1>c2) {
|
||||
result=PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call this method if you want to force the string to a certain capacity
|
||||
|
@ -1411,31 +1386,6 @@ nsString& nsString::Cut(PRUint32 anOffset, PRInt32 aCount) {
|
|||
Searching methods...
|
||||
*********************************************************************/
|
||||
|
||||
/**
|
||||
* Search for given character within this string.
|
||||
* This method does so by using a binary search,
|
||||
* so your string HAD BETTER BE ORDERED!
|
||||
*
|
||||
* @param aChar is the unicode char to be found
|
||||
* @return offset in string, or -1 (kNotFound)
|
||||
*/
|
||||
PRInt32 nsString::BinarySearch(PRUnichar aChar) const{
|
||||
PRInt32 low=0;
|
||||
PRInt32 high=mLength-1;
|
||||
|
||||
while (low <= high) {
|
||||
int middle = (low + high) >> 1;
|
||||
PRUnichar theChar=GetCharAt(*this,middle);
|
||||
if (theChar==aChar)
|
||||
return middle;
|
||||
if (theChar>aChar)
|
||||
high = middle - 1;
|
||||
else
|
||||
low = middle + 1;
|
||||
}
|
||||
return kNotFound;
|
||||
}
|
||||
|
||||
/**
|
||||
* search for given string within this string
|
||||
*
|
||||
|
|
|
@ -144,14 +144,6 @@ public:
|
|||
void Truncate(PRUint32 anIndex=0);
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in sorted order.
|
||||
*
|
||||
* @return TRUE if ordered.
|
||||
*/
|
||||
PRBool IsOrdered(void) const;
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in store as 1 or 2 byte (unicode) strings.
|
||||
|
@ -566,16 +558,6 @@ public:
|
|||
Searching methods...
|
||||
*********************************************************************/
|
||||
|
||||
/**
|
||||
* Search for given character within this string.
|
||||
* This method does so by using a binary search,
|
||||
* so your string HAD BETTER BE ORDERED!
|
||||
*
|
||||
* @param aChar is the unicode char to be found
|
||||
* @return offset in string, or -1 (kNotFound)
|
||||
*/
|
||||
PRInt32 BinarySearch(PRUnichar aChar) const;
|
||||
|
||||
/**
|
||||
* Search for given substring within this string
|
||||
*
|
||||
|
|
|
@ -143,27 +143,6 @@ void nsCString::Truncate(PRUint32 anIndex) {
|
|||
nsStr::Truncate(*this,anIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in sorted order.
|
||||
*
|
||||
* @update gess 8/25/98
|
||||
* @return TRUE if ordered.
|
||||
*/
|
||||
PRBool nsCString::IsOrdered(void) const {
|
||||
PRBool result=PR_TRUE;
|
||||
if(mLength>1) {
|
||||
PRUint32 theIndex;
|
||||
for(theIndex=1;theIndex<mLength;theIndex++) {
|
||||
if(mStr[theIndex-1]>mStr[theIndex]) {
|
||||
result=PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call this method if you want to force the string to a certain capacity
|
||||
|
@ -1205,30 +1184,6 @@ nsCString& nsCString::Cut(PRUint32 anOffset, PRInt32 aCount) {
|
|||
Searching methods...
|
||||
*********************************************************************/
|
||||
|
||||
/**
|
||||
* Search for given character within this string.
|
||||
* This method does so by using a binary search,
|
||||
* so your string HAD BETTER BE ORDERED!
|
||||
*
|
||||
* @param aChar is the unicode char to be found
|
||||
* @return offset in string, or -1 (kNotFound)
|
||||
*/
|
||||
PRInt32 nsCString::BinarySearch(PRUnichar aChar) const{
|
||||
PRInt32 low=0;
|
||||
PRInt32 high=mLength-1;
|
||||
|
||||
while (low <= high) {
|
||||
int middle = (low + high) >> 1;
|
||||
PRUnichar theChar=GetCharAt(*this,middle);
|
||||
if (theChar==aChar)
|
||||
return middle;
|
||||
if (theChar>aChar)
|
||||
high = middle - 1;
|
||||
else
|
||||
low = middle + 1;
|
||||
}
|
||||
return kNotFound;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for given cstr within this string
|
||||
|
|
|
@ -130,16 +130,6 @@ public:
|
|||
*/
|
||||
void Truncate(PRUint32 anIndex=0);
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in sorted order.
|
||||
*
|
||||
* @return TRUE if ordered.
|
||||
*/
|
||||
PRBool IsOrdered(void) const;
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether or not this string has a length of 0
|
||||
*
|
||||
|
@ -516,15 +506,6 @@ public:
|
|||
Searching methods...
|
||||
*********************************************************************/
|
||||
|
||||
/**
|
||||
* Search for given character within this string.
|
||||
* This method does so by using a binary search,
|
||||
* so your string HAD BETTER BE ORDERED!
|
||||
*
|
||||
* @param aChar is the unicode char to be found
|
||||
* @return offset in string, or -1 (kNotFound)
|
||||
*/
|
||||
PRInt32 BinarySearch(PRUnichar aChar) const;
|
||||
|
||||
/**
|
||||
* Search for given substring within this string
|
||||
|
|
|
@ -153,31 +153,6 @@ void nsString::Truncate(PRUint32 anIndex) {
|
|||
nsStr::Truncate(*this,anIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in sorted order.
|
||||
*
|
||||
* @update gess 8/25/98
|
||||
* @return TRUE if ordered.
|
||||
*/
|
||||
PRBool nsString::IsOrdered(void) const {
|
||||
PRBool result=PR_TRUE;
|
||||
if(mLength>1) {
|
||||
PRUint32 theIndex;
|
||||
PRUnichar c1=0;
|
||||
PRUnichar c2=GetCharAt(*this,0);
|
||||
for(theIndex=1;theIndex<mLength;theIndex++) {
|
||||
c1=c2;
|
||||
c2=GetCharAt(*this,theIndex);
|
||||
if(c1>c2) {
|
||||
result=PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call this method if you want to force the string to a certain capacity
|
||||
|
@ -1411,31 +1386,6 @@ nsString& nsString::Cut(PRUint32 anOffset, PRInt32 aCount) {
|
|||
Searching methods...
|
||||
*********************************************************************/
|
||||
|
||||
/**
|
||||
* Search for given character within this string.
|
||||
* This method does so by using a binary search,
|
||||
* so your string HAD BETTER BE ORDERED!
|
||||
*
|
||||
* @param aChar is the unicode char to be found
|
||||
* @return offset in string, or -1 (kNotFound)
|
||||
*/
|
||||
PRInt32 nsString::BinarySearch(PRUnichar aChar) const{
|
||||
PRInt32 low=0;
|
||||
PRInt32 high=mLength-1;
|
||||
|
||||
while (low <= high) {
|
||||
int middle = (low + high) >> 1;
|
||||
PRUnichar theChar=GetCharAt(*this,middle);
|
||||
if (theChar==aChar)
|
||||
return middle;
|
||||
if (theChar>aChar)
|
||||
high = middle - 1;
|
||||
else
|
||||
low = middle + 1;
|
||||
}
|
||||
return kNotFound;
|
||||
}
|
||||
|
||||
/**
|
||||
* search for given string within this string
|
||||
*
|
||||
|
|
|
@ -144,14 +144,6 @@ public:
|
|||
void Truncate(PRUint32 anIndex=0);
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in sorted order.
|
||||
*
|
||||
* @return TRUE if ordered.
|
||||
*/
|
||||
PRBool IsOrdered(void) const;
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in store as 1 or 2 byte (unicode) strings.
|
||||
|
@ -566,16 +558,6 @@ public:
|
|||
Searching methods...
|
||||
*********************************************************************/
|
||||
|
||||
/**
|
||||
* Search for given character within this string.
|
||||
* This method does so by using a binary search,
|
||||
* so your string HAD BETTER BE ORDERED!
|
||||
*
|
||||
* @param aChar is the unicode char to be found
|
||||
* @return offset in string, or -1 (kNotFound)
|
||||
*/
|
||||
PRInt32 BinarySearch(PRUnichar aChar) const;
|
||||
|
||||
/**
|
||||
* Search for given substring within this string
|
||||
*
|
||||
|
|
Загрузка…
Ссылка в новой задаче