removed a bunch of statically constructed objects

This commit is contained in:
rickg%netscape.com 1999-09-19 16:51:08 +00:00
Родитель 825883efbc
Коммит f196a4219b
20 изменённых файлов: 392 добавлений и 106 удалений

Просмотреть файл

@ -506,8 +506,8 @@ PRInt32 CRTFControlWord::GetTokenType() {
} }
nsresult CRTFControlWord::Consume(PRUnichar aChar,nsScanner& aScanner) { nsresult CRTFControlWord::Consume(PRUnichar aChar,nsScanner& aScanner) {
static nsString gAlphaChars("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); const char* gAlphaChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
static nsAutoString gDigits("-0123456789"); const char* gDigits="-0123456789";
PRInt32 result=aScanner.ReadWhile(mTextValue,gAlphaChars,PR_TRUE,PR_FALSE); PRInt32 result=aScanner.ReadWhile(mTextValue,gAlphaChars,PR_TRUE,PR_FALSE);
if(NS_OK==result) { if(NS_OK==result) {
@ -585,7 +585,7 @@ PRInt32 CRTFContent::GetTokenType() {
*/ */
nsresult CRTFContent::Consume(PRUnichar aChar,nsScanner& aScanner) { nsresult CRTFContent::Consume(PRUnichar aChar,nsScanner& aScanner) {
static nsString textTerminators("\\{}"); static const char* textTerminators="\\{}";
PRInt32 result=aScanner.ReadUntil(mTextValue,textTerminators,PR_FALSE,PR_FALSE); PRInt32 result=aScanner.ReadUntil(mTextValue,textTerminators,PR_FALSE,PR_FALSE);
return result; return result;
} }

Просмотреть файл

@ -414,7 +414,7 @@ PRInt32 nsDTDContext::TokenCountAt(PRInt32 aID)
* @update gess7/25/98 * @update gess7/25/98
* @param * @param
*/ */
CTokenRecycler::CTokenRecycler() : nsITokenRecycler() { CTokenRecycler::CTokenRecycler() : nsITokenRecycler(),mEmpty("") {
int i=0; int i=0;
for(i=0;i<eToken_last-1;i++) { for(i=0;i<eToken_last-1;i++) {
mTokenCache[i]=new nsDeque(new CTokenDeallocator()); mTokenCache[i]=new nsDeque(new CTokenDeallocator());
@ -523,9 +523,8 @@ CToken* CTokenRecycler::CreateTokenOfType(eHTMLTokenTypes aType,eHTMLTags aTag)
CToken* result=(CToken*)mTokenCache[aType-1]->Pop(); CToken* result=(CToken*)mTokenCache[aType-1]->Pop();
static nsAutoString theEmpty;
if(result) { if(result) {
result->Reinitialize(aTag,theEmpty); result->Reinitialize(aTag,mEmpty);
} }
else { else {
#ifdef NS_DEBUG #ifdef NS_DEBUG
@ -539,10 +538,10 @@ CToken* CTokenRecycler::CreateTokenOfType(eHTMLTokenTypes aType,eHTMLTags aTag)
case eToken_entity: result=new CEntityToken(); break; case eToken_entity: result=new CEntityToken(); break;
case eToken_whitespace: result=new CWhitespaceToken(); break; case eToken_whitespace: result=new CWhitespaceToken(); break;
case eToken_newline: result=new CNewlineToken(); break; case eToken_newline: result=new CNewlineToken(); break;
case eToken_text: result=new CTextToken(theEmpty); break; case eToken_text: result=new CTextToken(mEmpty); break;
case eToken_script: result=new CScriptToken(); break; case eToken_script: result=new CScriptToken(); break;
case eToken_style: result=new CStyleToken(); break; case eToken_style: result=new CStyleToken(); break;
case eToken_skippedcontent: result=new CSkippedContentToken(theEmpty); break; case eToken_skippedcontent: result=new CSkippedContentToken(mEmpty); break;
case eToken_instruction: result=new CInstructionToken(); break; case eToken_instruction: result=new CInstructionToken(); break;
case eToken_cdatasection: result=new CCDATASectionToken(); break; case eToken_cdatasection: result=new CCDATASectionToken(); break;
case eToken_error: result=new CErrorToken(); break; case eToken_error: result=new CErrorToken(); break;

Просмотреть файл

@ -158,6 +158,7 @@ public:
protected: protected:
nsDeque* mTokenCache[eToken_last-1]; nsDeque* mTokenCache[eToken_last-1];
nsString mEmpty;
#ifdef NS_DEBUG #ifdef NS_DEBUG
int mTotals[eToken_last-1]; int mTotals[eToken_last-1];
#endif #endif

Просмотреть файл

@ -184,8 +184,11 @@ nsHTMLEntities::UnicodeToEntity(PRInt32 aUnicode)
return found->mStr; return found->mStr;
} }
} }
static const nsCString kNullStr; static const nsCString* kNullStr=0;
return kNullStr; if(!kNullStr) {
kNullStr=new nsCString("");
}
return *kNullStr;
} }

Просмотреть файл

@ -132,8 +132,10 @@ nsHTMLTags::GetStringValue(nsHTMLTag aTag)
return gTagArray[aTag - 1].mStr; return gTagArray[aTag - 1].mStr;
} }
else { else {
static const nsCString kNullStr; static const nsCString* kNullStr=0;
return kNullStr; if(!kNullStr)
kNullStr=new nsCString("");
return *kNullStr;
} }
} }

Просмотреть файл

@ -146,6 +146,14 @@ void nsHTMLTokenizer::AddToken(CToken*& aToken,nsresult aResult,nsDeque& aDeque,
* @return ptr to recycler (or null) * @return ptr to recycler (or null)
*/ */
nsITokenRecycler* nsHTMLTokenizer::GetTokenRecycler(void) { nsITokenRecycler* nsHTMLTokenizer::GetTokenRecycler(void) {
#if 0
//let's move to this once we eliminate the leaking of tokens...
static CTokenRecycler* gTokenRecycler=0;
if(!gTokenRecycler)
gTokenRecycler=new CTokenRecycler();
return gTokenRecycler;
#endif
static CTokenRecycler gTokenRecycler; static CTokenRecycler gTokenRecycler;
return (nsITokenRecycler*)&gTokenRecycler; return (nsITokenRecycler*)&gTokenRecycler;
} }

Просмотреть файл

@ -33,6 +33,8 @@
static const char* gUserdefined = "userdefined"; static const char* gUserdefined = "userdefined";
static const char* gIdentChars="-0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
static const char* gNumChars="0123456789ABCDEFabcdef";
const PRInt32 kMAXNAMELEN=10; const PRInt32 kMAXNAMELEN=10;
@ -192,17 +194,6 @@ PRBool CStartToken::IsEmpty(void) {
return mEmpty; return mEmpty;
} }
static
nsString& GetIdentChars(void) {
static nsString gIdentChars("-0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz");
return gIdentChars;
}
static
nsString& GetNumericChars(void) {
static nsString gNumChars("0123456789ABCDEFabcdef");
return gNumChars;
}
/* /*
* Consume the identifier portion of the start tag * Consume the identifier portion of the start tag
@ -220,7 +211,7 @@ nsresult CStartToken::Consume(PRUnichar aChar, nsScanner& aScanner) {
//NOTE: We don't Consume the tag attributes here, nor do we eat the ">" //NOTE: We don't Consume the tag attributes here, nor do we eat the ">"
mTextValue=aChar; mTextValue=aChar;
nsresult result=aScanner.ReadWhile(mTextValue,GetIdentChars(),PR_TRUE,PR_FALSE); nsresult result=aScanner.ReadWhile(mTextValue,gIdentChars,PR_TRUE,PR_FALSE);
mTypeID = nsHTMLTags::LookupTag(mTextValue); mTypeID = nsHTMLTags::LookupTag(mTextValue);
//Good. Now, let's skip whitespace after the identifier, //Good. Now, let's skip whitespace after the identifier,
@ -448,12 +439,12 @@ PRInt32 CTextToken::GetTokenType(void) {
* @return error result * @return error result
*/ */
nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner) { nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner) {
static nsAutoString terminals("&<\r\n"); static const char* theTerminals="&<\r\n";
nsresult result=NS_OK; nsresult result=NS_OK;
PRBool done=PR_FALSE; PRBool done=PR_FALSE;
while((NS_OK==result) && (!done)) { while((NS_OK==result) && (!done)) {
result=aScanner.ReadUntil(mTextValue,terminals,PR_FALSE,PR_FALSE); result=aScanner.ReadUntil(mTextValue,theTerminals,PR_FALSE,PR_FALSE);
if(NS_OK==result) { if(NS_OK==result) {
result=aScanner.Peek(aChar); result=aScanner.Peek(aChar);
if((kCR==aChar) && (NS_OK==result)) { if((kCR==aChar) && (NS_OK==result)) {
@ -502,7 +493,6 @@ nsresult CTextToken::ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScann
//If we find either, just eat them. If we find text or a tag, then go to the //If we find either, just eat them. If we find text or a tag, then go to the
//target endtag, or the start of another comment. //target endtag, or the start of another comment.
static nsAutoString theWhitespace2("\b\t ");
PRInt32 termStrLen=aTerminalString.Length(); PRInt32 termStrLen=aTerminalString.Length();
while((!done) && (NS_OK==result)) { while((!done) && (NS_OK==result)) {
@ -527,7 +517,7 @@ nsresult CTextToken::ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScann
result=aScanner.ReadUntil(mTextValue,kGreaterThan,PR_TRUE); result=aScanner.ReadUntil(mTextValue,kGreaterThan,PR_TRUE);
} }
} }
else if(0<=theWhitespace2.BinarySearch(aChar)) { else if(('\b'==theChar) || ('\t'==theChar) || (' '==theChar)) {
static CWhitespaceToken theWS; static CWhitespaceToken theWS;
result=theWS.Consume(aChar,aScanner); result=theWS.Consume(aChar,aScanner);
if(NS_OK==result) { if(NS_OK==result) {
@ -609,12 +599,12 @@ PRInt32 CCDATASectionToken::GetTokenType(void) {
* @return error result * @return error result
*/ */
nsresult CCDATASectionToken::Consume(PRUnichar aChar, nsScanner& aScanner) { nsresult CCDATASectionToken::Consume(PRUnichar aChar, nsScanner& aScanner) {
static nsAutoString terminals("]\r"); static const char* theTerminals="]\r";
nsresult result=NS_OK; nsresult result=NS_OK;
PRBool done=PR_FALSE; PRBool done=PR_FALSE;
while((NS_OK==result) && (!done)) { while((NS_OK==result) && (!done)) {
result=aScanner.ReadUntil(mTextValue,terminals,PR_FALSE,PR_FALSE); result=aScanner.ReadUntil(mTextValue,theTerminals,PR_FALSE,PR_FALSE);
if(NS_OK==result) { if(NS_OK==result) {
result=aScanner.Peek(aChar); result=aScanner.Peek(aChar);
if((kCR==aChar) && (NS_OK==result)) { if((kCR==aChar) && (NS_OK==result)) {
@ -698,7 +688,7 @@ CCommentToken::CCommentToken(const nsString& aName) : CHTMLToken(aName) {
*/ */
static static
nsresult ConsumeStrictComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString) { nsresult ConsumeStrictComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString) {
static nsAutoString gMinus("-"); static const char* gMinus="-";
nsresult result=NS_OK; nsresult result=NS_OK;
/********************************************************* /*********************************************************
@ -767,11 +757,7 @@ nsresult ConsumeStrictComment(PRUnichar aChar, nsScanner& aScanner,nsString& aSt
*/ */
static static
nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString) { nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString) {
static nsAutoString gEdibles("!-");
static nsAutoString gMinus("-");
static nsAutoString gWhitespace("\b\t\n\r ");
static nsAutoString gDfltEndComment("-->");
nsresult result=NS_OK; nsresult result=NS_OK;
@ -794,6 +780,9 @@ nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString)
if(NS_OK==result) { if(NS_OK==result) {
if(kMinus==aChar) { if(kMinus==aChar) {
//in this case, we're reading a long-form comment <-- xxx --> //in this case, we're reading a long-form comment <-- xxx -->
nsAutoString gDfltEndComment("-->");
aString+=aChar; aString+=aChar;
PRInt32 findpos=kNotFound; PRInt32 findpos=kNotFound;
while((kNotFound==findpos) && (NS_OK==result)) { while((kNotFound==findpos) && (NS_OK==result)) {
@ -948,8 +937,10 @@ PRInt32 CNewlineToken::GetTokenType(void) {
* @return nsString reference to internal string value * @return nsString reference to internal string value
*/ */
nsString& CNewlineToken::GetStringValueXXX(void) { nsString& CNewlineToken::GetStringValueXXX(void) {
static nsAutoString theStr("\n"); static nsString* theStr=0;
return theStr; if(!theStr)
theStr=new nsString("\n");
return *theStr;
} }
/* /*
@ -1151,8 +1142,8 @@ nsresult ConsumeQuotedString(PRUnichar aChar,nsString& aString,nsScanner& aScann
*/ */
static static
nsresult ConsumeAttributeValueText(PRUnichar,nsString& aString,nsScanner& aScanner){ nsresult ConsumeAttributeValueText(PRUnichar,nsString& aString,nsScanner& aScanner){
static nsAutoString terminals("\b\t\n\r >"); static const char* theTerminals="\b\t\n\r >";
nsresult result=aScanner.ReadUntil(aString,terminals,PR_FALSE,PR_FALSE); nsresult result=aScanner.ReadUntil(aString,theTerminals,PR_FALSE,PR_FALSE);
//Let's force quotes if either the first or last char is quoted. //Let's force quotes if either the first or last char is quoted.
PRUnichar theLast=aString.Last(); PRUnichar theLast=aString.Last();
@ -1205,15 +1196,16 @@ nsresult CAttributeToken::Consume(PRUnichar aChar, nsScanner& aScanner) {
result=aScanner.GetChar(aChar); //skip the hash sign... result=aScanner.GetChar(aChar); //skip the hash sign...
if(NS_OK==result) { if(NS_OK==result) {
mTextKey=aChar; mTextKey=aChar;
static nsAutoString gDigits("0123456789");
static const char* gDigits="0123456789";
result=aScanner.ReadWhile(mTextKey,gDigits,PR_TRUE,PR_FALSE); result=aScanner.ReadWhile(mTextKey,gDigits,PR_TRUE,PR_FALSE);
} }
} }
else { else {
//If you're here, handle an unquoted key. //If you're here, handle an unquoted key.
//Don't forget to reduce entities inline! //Don't forget to reduce entities inline!
static nsAutoString terminals("\b\t\n\r \"<=>"); static const char* theTerminals="\b\t\n\r \"<=>";
result=aScanner.ReadUntil(mTextKey,terminals,PR_TRUE,PR_FALSE); result=aScanner.ReadUntil(mTextKey,theTerminals,PR_TRUE,PR_FALSE);
} }
//now it's time to Consume the (optional) value... //now it's time to Consume the (optional) value...
@ -1355,7 +1347,7 @@ PRInt32 CWhitespaceToken::GetTokenType(void) {
nsresult CWhitespaceToken::Consume(PRUnichar aChar, nsScanner& aScanner) { nsresult CWhitespaceToken::Consume(PRUnichar aChar, nsScanner& aScanner) {
mTextValue=aChar; mTextValue=aChar;
static nsAutoString theWhitespace("\b\t "); static const char* theWhitespace="\b\t ";
nsresult result=aScanner.ReadWhile(mTextValue,theWhitespace,PR_FALSE,PR_FALSE); nsresult result=aScanner.ReadWhile(mTextValue,theWhitespace,PR_FALSE,PR_FALSE);
if(NS_OK==result) { if(NS_OK==result) {
mTextValue.StripChars("\r"); mTextValue.StripChars("\r");
@ -1468,10 +1460,10 @@ PRInt32 CEntityToken::ConsumeEntity(PRUnichar aChar,nsString& aString,nsScanner&
aString+=theChar; aString+=theChar;
} }
if(NS_OK==result){ if(NS_OK==result){
result=aScanner.ReadWhile(aString,GetNumericChars(),PR_TRUE,PR_FALSE); result=aScanner.ReadWhile(aString,gNumChars,PR_TRUE,PR_FALSE);
} }
} }
else result=aScanner.ReadWhile(aString,GetIdentChars(),PR_TRUE,PR_FALSE); else result=aScanner.ReadWhile(aString,gIdentChars,PR_TRUE,PR_FALSE);
if(NS_OK==result) { if(NS_OK==result) {
result=aScanner.Peek(theChar); result=aScanner.Peek(theChar);
if(NS_OK==result) { if(NS_OK==result) {
@ -1721,8 +1713,6 @@ nsresult CSkippedContentToken::Consume(PRUnichar aChar,nsScanner& aScanner) {
//If we find either, just eat them. If we find text or a tag, then go to the //If we find either, just eat them. If we find text or a tag, then go to the
//target endtag, or the start of another comment. //target endtag, or the start of another comment.
static nsAutoString theWhitespace2("\b\t ");
while((!done) && (NS_OK==result)) { while((!done) && (NS_OK==result)) {
result=aScanner.GetChar(aChar); result=aScanner.GetChar(aChar);
if((NS_OK==result) && (kLessThan==aChar)) { if((NS_OK==result) && (kLessThan==aChar)) {
@ -1743,7 +1733,7 @@ nsresult CSkippedContentToken::Consume(PRUnichar aChar,nsScanner& aScanner) {
result=aScanner.ReadUntil(temp,kGreaterThan,PR_TRUE); result=aScanner.ReadUntil(temp,kGreaterThan,PR_TRUE);
} }
} }
else if(0<=theWhitespace2.BinarySearch(aChar)) { else if(('\b'==theChar) || ('\t'==theChar) || (' '==theChar)) {
static CWhitespaceToken theWS; static CWhitespaceToken theWS;
result=theWS.Consume(aChar,aScanner); result=theWS.Consume(aChar,aScanner);
if(NS_OK==result) { if(NS_OK==result) {

Просмотреть файл

@ -28,9 +28,11 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, NS_PARSER_NODE_IID); static NS_DEFINE_IID(kClassIID, NS_PARSER_NODE_IID);
static NS_DEFINE_IID(kIParserNodeIID, NS_IPARSER_NODE_IID); static NS_DEFINE_IID(kIParserNodeIID, NS_IPARSER_NODE_IID);
nsAutoString& GetEmptyString() { nsString& GetEmptyString() {
static nsAutoString theEmptyString(""); static nsString* gEmptyStr=0;
return theEmptyString; if(!gEmptyStr)
gEmptyStr=new nsString("");
return *gEmptyStr;
} }
/** /**

Просмотреть файл

@ -430,8 +430,12 @@ nsresult nsScanner::PutBack(PRUnichar aChar) {
* @return error status * @return error status
*/ */
nsresult nsScanner::SkipWhitespace(void) { nsresult nsScanner::SkipWhitespace(void) {
static nsAutoString chars(" \n\r\t\b"); static const char* gSpaces=" \n\r\t\b";
return SkipOver(chars);
int len=strlen(gSpaces);
CBufDescriptor buf(gSpaces,PR_TRUE,len+1,len);
nsAutoString theWS(buf);
return SkipOver(theWS);
} }
/** /**
@ -561,6 +565,72 @@ nsresult nsScanner::ReadWhile(nsString& aString,
return result; return result;
} }
/**
* Consume chars as long as they are <i>in</i> the
* given validSet of input chars.
*
* @update gess 3/25/98
* @param aString will contain the result of this method
* @param aValidSet is an ordered string that contains the
* valid characters
* @return error code
*/
nsresult nsScanner::ReadWhile(nsString& aString,
nsCString& aValidSet,
PRBool anOrderedSet,
PRBool addTerminal){
NS_ASSERTION(((PR_FALSE==anOrderedSet) || aValidSet.IsOrdered()),kUnorderedStringError);
PRUnichar theChar=0;
nsresult result=NS_OK;
while(NS_OK==result) {
result=GetChar(theChar);
if(NS_OK==result) {
PRInt32 pos=(anOrderedSet) ? aValidSet.BinarySearch(theChar) : aValidSet.FindChar(theChar);
if(kNotFound==pos) {
if(addTerminal)
aString+=theChar;
else PutBack(theChar);
break;
}
else aString+=theChar;
}
}
return result;
}
/**
* Consume chars as long as they are <i>in</i> the
* given validSet of input chars.
*
* @update gess 3/25/98
* @param aString will contain the result of this method
* @param anInputSet contains the legal input chars
* valid characters
* @return error code
*/
nsresult nsScanner::ReadWhile(nsString& aString,
const char* anInputSet,
PRBool anOrderedSet,
PRBool addTerminal)
{
nsresult result=NS_OK;
if(anInputSet) {
PRInt32 len=nsCRT::strlen(anInputSet);
if(0<len) {
CBufDescriptor buf(anInputSet,PR_TRUE,len+1,len);
nsCAutoString theSet(buf);
result=ReadWhile(aString,theSet,anOrderedSet,addTerminal);
} //if
}//if
return result;
}
/** /**
* Consume characters until you encounter one contained in given * Consume characters until you encounter one contained in given
* input set. * input set.
@ -597,6 +667,70 @@ nsresult nsScanner::ReadUntil(nsString& aString,
return result; return result;
} }
/**
* Consume characters until you encounter one contained in given
* input set.
*
* @update gess 3/25/98
* @param aString will contain the result of this method
* @param aTerminalSet is an ordered string that contains
* the set of INVALID characters
* @return error code
*/
nsresult nsScanner::ReadUntil(nsString& aString,
nsCString& aTerminalSet,
PRBool anOrderedSet,
PRBool addTerminal){
NS_ASSERTION(((PR_FALSE==anOrderedSet) || aTerminalSet.IsOrdered()),kUnorderedStringError);
PRUnichar theChar=0;
nsresult result=NS_OK;
while(NS_OK == result) {
result=GetChar(theChar);
if(NS_OK==result) {
PRInt32 pos=(anOrderedSet) ? aTerminalSet.BinarySearch(theChar) : aTerminalSet.FindChar(theChar);
if(kNotFound!=pos) {
if(addTerminal)
aString+=theChar;
else PutBack(theChar);
break;
}
else aString+=theChar;
}
}
return result;
}
/**
* Consume characters until you encounter one contained in given
* input set.
*
* @update gess 3/25/98
* @param aString will contain the result of this method
* @param aTerminalSet is an ordered string that contains
* the set of INVALID characters
* @return error code
*/
nsresult nsScanner::ReadUntil(nsString& aString,
const char* aTerminalSet,
PRBool anOrderedSet,
PRBool addTerminal)
{
nsresult result=NS_OK;
if(aTerminalSet) {
PRInt32 len=nsCRT::strlen(aTerminalSet);
if(0<len) {
CBufDescriptor buf(aTerminalSet,PR_TRUE,len+1,len);
nsCAutoString theSet(buf);
result=ReadUntil(aString,theSet,anOrderedSet,addTerminal);
} //if
}//if
return result;
}
/** /**
* Consumes chars until you see the given terminalChar * Consumes chars until you see the given terminalChar

Просмотреть файл

@ -185,6 +185,8 @@ class nsScanner {
* @return error code * @return error code
*/ */
nsresult ReadUntil(nsString& aString,nsString& aTermSet,PRBool anOrderedSet,PRBool addTerminal); nsresult ReadUntil(nsString& aString,nsString& aTermSet,PRBool anOrderedSet,PRBool addTerminal);
nsresult ReadUntil(nsString& aString,nsCString& aTermSet,PRBool anOrderedSet,PRBool addTerminal);
nsresult ReadUntil(nsString& aString,const char* aTermSet,PRBool anOrderedSet,PRBool addTerminal);
/** /**
* Consume characters while they're members of anInputSet * Consume characters while they're members of anInputSet
@ -196,6 +198,8 @@ class nsScanner {
* @return error code * @return error code
*/ */
nsresult ReadWhile(nsString& aString,nsString& anInputSet,PRBool anOrderedSet,PRBool addTerminal); nsresult ReadWhile(nsString& aString,nsString& anInputSet,PRBool anOrderedSet,PRBool addTerminal);
nsresult ReadWhile(nsString& aString,nsCString& anInputSet,PRBool anOrderedSet,PRBool addTerminal);
nsresult ReadWhile(nsString& aString,const char* anInputSet, PRBool anOrderedSet, PRBool addTerminal);
/** /**
* Records current offset position in input stream. This allows us * Records current offset position in input stream. This allows us

Просмотреть файл

@ -506,8 +506,8 @@ PRInt32 CRTFControlWord::GetTokenType() {
} }
nsresult CRTFControlWord::Consume(PRUnichar aChar,nsScanner& aScanner) { nsresult CRTFControlWord::Consume(PRUnichar aChar,nsScanner& aScanner) {
static nsString gAlphaChars("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); const char* gAlphaChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
static nsAutoString gDigits("-0123456789"); const char* gDigits="-0123456789";
PRInt32 result=aScanner.ReadWhile(mTextValue,gAlphaChars,PR_TRUE,PR_FALSE); PRInt32 result=aScanner.ReadWhile(mTextValue,gAlphaChars,PR_TRUE,PR_FALSE);
if(NS_OK==result) { if(NS_OK==result) {
@ -585,7 +585,7 @@ PRInt32 CRTFContent::GetTokenType() {
*/ */
nsresult CRTFContent::Consume(PRUnichar aChar,nsScanner& aScanner) { nsresult CRTFContent::Consume(PRUnichar aChar,nsScanner& aScanner) {
static nsString textTerminators("\\{}"); static const char* textTerminators="\\{}";
PRInt32 result=aScanner.ReadUntil(mTextValue,textTerminators,PR_FALSE,PR_FALSE); PRInt32 result=aScanner.ReadUntil(mTextValue,textTerminators,PR_FALSE,PR_FALSE);
return result; return result;
} }

Просмотреть файл

@ -414,7 +414,7 @@ PRInt32 nsDTDContext::TokenCountAt(PRInt32 aID)
* @update gess7/25/98 * @update gess7/25/98
* @param * @param
*/ */
CTokenRecycler::CTokenRecycler() : nsITokenRecycler() { CTokenRecycler::CTokenRecycler() : nsITokenRecycler(),mEmpty("") {
int i=0; int i=0;
for(i=0;i<eToken_last-1;i++) { for(i=0;i<eToken_last-1;i++) {
mTokenCache[i]=new nsDeque(new CTokenDeallocator()); mTokenCache[i]=new nsDeque(new CTokenDeallocator());
@ -523,9 +523,8 @@ CToken* CTokenRecycler::CreateTokenOfType(eHTMLTokenTypes aType,eHTMLTags aTag)
CToken* result=(CToken*)mTokenCache[aType-1]->Pop(); CToken* result=(CToken*)mTokenCache[aType-1]->Pop();
static nsAutoString theEmpty;
if(result) { if(result) {
result->Reinitialize(aTag,theEmpty); result->Reinitialize(aTag,mEmpty);
} }
else { else {
#ifdef NS_DEBUG #ifdef NS_DEBUG
@ -539,10 +538,10 @@ CToken* CTokenRecycler::CreateTokenOfType(eHTMLTokenTypes aType,eHTMLTags aTag)
case eToken_entity: result=new CEntityToken(); break; case eToken_entity: result=new CEntityToken(); break;
case eToken_whitespace: result=new CWhitespaceToken(); break; case eToken_whitespace: result=new CWhitespaceToken(); break;
case eToken_newline: result=new CNewlineToken(); break; case eToken_newline: result=new CNewlineToken(); break;
case eToken_text: result=new CTextToken(theEmpty); break; case eToken_text: result=new CTextToken(mEmpty); break;
case eToken_script: result=new CScriptToken(); break; case eToken_script: result=new CScriptToken(); break;
case eToken_style: result=new CStyleToken(); break; case eToken_style: result=new CStyleToken(); break;
case eToken_skippedcontent: result=new CSkippedContentToken(theEmpty); break; case eToken_skippedcontent: result=new CSkippedContentToken(mEmpty); break;
case eToken_instruction: result=new CInstructionToken(); break; case eToken_instruction: result=new CInstructionToken(); break;
case eToken_cdatasection: result=new CCDATASectionToken(); break; case eToken_cdatasection: result=new CCDATASectionToken(); break;
case eToken_error: result=new CErrorToken(); break; case eToken_error: result=new CErrorToken(); break;

Просмотреть файл

@ -158,6 +158,7 @@ public:
protected: protected:
nsDeque* mTokenCache[eToken_last-1]; nsDeque* mTokenCache[eToken_last-1];
nsString mEmpty;
#ifdef NS_DEBUG #ifdef NS_DEBUG
int mTotals[eToken_last-1]; int mTotals[eToken_last-1];
#endif #endif

Просмотреть файл

@ -184,8 +184,11 @@ nsHTMLEntities::UnicodeToEntity(PRInt32 aUnicode)
return found->mStr; return found->mStr;
} }
} }
static const nsCString kNullStr; static const nsCString* kNullStr=0;
return kNullStr; if(!kNullStr) {
kNullStr=new nsCString("");
}
return *kNullStr;
} }

Просмотреть файл

@ -132,8 +132,10 @@ nsHTMLTags::GetStringValue(nsHTMLTag aTag)
return gTagArray[aTag - 1].mStr; return gTagArray[aTag - 1].mStr;
} }
else { else {
static const nsCString kNullStr; static const nsCString* kNullStr=0;
return kNullStr; if(!kNullStr)
kNullStr=new nsCString("");
return *kNullStr;
} }
} }

Просмотреть файл

@ -146,6 +146,14 @@ void nsHTMLTokenizer::AddToken(CToken*& aToken,nsresult aResult,nsDeque& aDeque,
* @return ptr to recycler (or null) * @return ptr to recycler (or null)
*/ */
nsITokenRecycler* nsHTMLTokenizer::GetTokenRecycler(void) { nsITokenRecycler* nsHTMLTokenizer::GetTokenRecycler(void) {
#if 0
//let's move to this once we eliminate the leaking of tokens...
static CTokenRecycler* gTokenRecycler=0;
if(!gTokenRecycler)
gTokenRecycler=new CTokenRecycler();
return gTokenRecycler;
#endif
static CTokenRecycler gTokenRecycler; static CTokenRecycler gTokenRecycler;
return (nsITokenRecycler*)&gTokenRecycler; return (nsITokenRecycler*)&gTokenRecycler;
} }

Просмотреть файл

@ -33,6 +33,8 @@
static const char* gUserdefined = "userdefined"; static const char* gUserdefined = "userdefined";
static const char* gIdentChars="-0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
static const char* gNumChars="0123456789ABCDEFabcdef";
const PRInt32 kMAXNAMELEN=10; const PRInt32 kMAXNAMELEN=10;
@ -192,17 +194,6 @@ PRBool CStartToken::IsEmpty(void) {
return mEmpty; return mEmpty;
} }
static
nsString& GetIdentChars(void) {
static nsString gIdentChars("-0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz");
return gIdentChars;
}
static
nsString& GetNumericChars(void) {
static nsString gNumChars("0123456789ABCDEFabcdef");
return gNumChars;
}
/* /*
* Consume the identifier portion of the start tag * Consume the identifier portion of the start tag
@ -220,7 +211,7 @@ nsresult CStartToken::Consume(PRUnichar aChar, nsScanner& aScanner) {
//NOTE: We don't Consume the tag attributes here, nor do we eat the ">" //NOTE: We don't Consume the tag attributes here, nor do we eat the ">"
mTextValue=aChar; mTextValue=aChar;
nsresult result=aScanner.ReadWhile(mTextValue,GetIdentChars(),PR_TRUE,PR_FALSE); nsresult result=aScanner.ReadWhile(mTextValue,gIdentChars,PR_TRUE,PR_FALSE);
mTypeID = nsHTMLTags::LookupTag(mTextValue); mTypeID = nsHTMLTags::LookupTag(mTextValue);
//Good. Now, let's skip whitespace after the identifier, //Good. Now, let's skip whitespace after the identifier,
@ -448,12 +439,12 @@ PRInt32 CTextToken::GetTokenType(void) {
* @return error result * @return error result
*/ */
nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner) { nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner) {
static nsAutoString terminals("&<\r\n"); static const char* theTerminals="&<\r\n";
nsresult result=NS_OK; nsresult result=NS_OK;
PRBool done=PR_FALSE; PRBool done=PR_FALSE;
while((NS_OK==result) && (!done)) { while((NS_OK==result) && (!done)) {
result=aScanner.ReadUntil(mTextValue,terminals,PR_FALSE,PR_FALSE); result=aScanner.ReadUntil(mTextValue,theTerminals,PR_FALSE,PR_FALSE);
if(NS_OK==result) { if(NS_OK==result) {
result=aScanner.Peek(aChar); result=aScanner.Peek(aChar);
if((kCR==aChar) && (NS_OK==result)) { if((kCR==aChar) && (NS_OK==result)) {
@ -502,7 +493,6 @@ nsresult CTextToken::ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScann
//If we find either, just eat them. If we find text or a tag, then go to the //If we find either, just eat them. If we find text or a tag, then go to the
//target endtag, or the start of another comment. //target endtag, or the start of another comment.
static nsAutoString theWhitespace2("\b\t ");
PRInt32 termStrLen=aTerminalString.Length(); PRInt32 termStrLen=aTerminalString.Length();
while((!done) && (NS_OK==result)) { while((!done) && (NS_OK==result)) {
@ -527,7 +517,7 @@ nsresult CTextToken::ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScann
result=aScanner.ReadUntil(mTextValue,kGreaterThan,PR_TRUE); result=aScanner.ReadUntil(mTextValue,kGreaterThan,PR_TRUE);
} }
} }
else if(0<=theWhitespace2.BinarySearch(aChar)) { else if(('\b'==theChar) || ('\t'==theChar) || (' '==theChar)) {
static CWhitespaceToken theWS; static CWhitespaceToken theWS;
result=theWS.Consume(aChar,aScanner); result=theWS.Consume(aChar,aScanner);
if(NS_OK==result) { if(NS_OK==result) {
@ -609,12 +599,12 @@ PRInt32 CCDATASectionToken::GetTokenType(void) {
* @return error result * @return error result
*/ */
nsresult CCDATASectionToken::Consume(PRUnichar aChar, nsScanner& aScanner) { nsresult CCDATASectionToken::Consume(PRUnichar aChar, nsScanner& aScanner) {
static nsAutoString terminals("]\r"); static const char* theTerminals="]\r";
nsresult result=NS_OK; nsresult result=NS_OK;
PRBool done=PR_FALSE; PRBool done=PR_FALSE;
while((NS_OK==result) && (!done)) { while((NS_OK==result) && (!done)) {
result=aScanner.ReadUntil(mTextValue,terminals,PR_FALSE,PR_FALSE); result=aScanner.ReadUntil(mTextValue,theTerminals,PR_FALSE,PR_FALSE);
if(NS_OK==result) { if(NS_OK==result) {
result=aScanner.Peek(aChar); result=aScanner.Peek(aChar);
if((kCR==aChar) && (NS_OK==result)) { if((kCR==aChar) && (NS_OK==result)) {
@ -698,7 +688,7 @@ CCommentToken::CCommentToken(const nsString& aName) : CHTMLToken(aName) {
*/ */
static static
nsresult ConsumeStrictComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString) { nsresult ConsumeStrictComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString) {
static nsAutoString gMinus("-"); static const char* gMinus="-";
nsresult result=NS_OK; nsresult result=NS_OK;
/********************************************************* /*********************************************************
@ -767,11 +757,7 @@ nsresult ConsumeStrictComment(PRUnichar aChar, nsScanner& aScanner,nsString& aSt
*/ */
static static
nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString) { nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString) {
static nsAutoString gEdibles("!-");
static nsAutoString gMinus("-");
static nsAutoString gWhitespace("\b\t\n\r ");
static nsAutoString gDfltEndComment("-->");
nsresult result=NS_OK; nsresult result=NS_OK;
@ -794,6 +780,9 @@ nsresult ConsumeComment(PRUnichar aChar, nsScanner& aScanner,nsString& aString)
if(NS_OK==result) { if(NS_OK==result) {
if(kMinus==aChar) { if(kMinus==aChar) {
//in this case, we're reading a long-form comment <-- xxx --> //in this case, we're reading a long-form comment <-- xxx -->
nsAutoString gDfltEndComment("-->");
aString+=aChar; aString+=aChar;
PRInt32 findpos=kNotFound; PRInt32 findpos=kNotFound;
while((kNotFound==findpos) && (NS_OK==result)) { while((kNotFound==findpos) && (NS_OK==result)) {
@ -948,8 +937,10 @@ PRInt32 CNewlineToken::GetTokenType(void) {
* @return nsString reference to internal string value * @return nsString reference to internal string value
*/ */
nsString& CNewlineToken::GetStringValueXXX(void) { nsString& CNewlineToken::GetStringValueXXX(void) {
static nsAutoString theStr("\n"); static nsString* theStr=0;
return theStr; if(!theStr)
theStr=new nsString("\n");
return *theStr;
} }
/* /*
@ -1151,8 +1142,8 @@ nsresult ConsumeQuotedString(PRUnichar aChar,nsString& aString,nsScanner& aScann
*/ */
static static
nsresult ConsumeAttributeValueText(PRUnichar,nsString& aString,nsScanner& aScanner){ nsresult ConsumeAttributeValueText(PRUnichar,nsString& aString,nsScanner& aScanner){
static nsAutoString terminals("\b\t\n\r >"); static const char* theTerminals="\b\t\n\r >";
nsresult result=aScanner.ReadUntil(aString,terminals,PR_FALSE,PR_FALSE); nsresult result=aScanner.ReadUntil(aString,theTerminals,PR_FALSE,PR_FALSE);
//Let's force quotes if either the first or last char is quoted. //Let's force quotes if either the first or last char is quoted.
PRUnichar theLast=aString.Last(); PRUnichar theLast=aString.Last();
@ -1205,15 +1196,16 @@ nsresult CAttributeToken::Consume(PRUnichar aChar, nsScanner& aScanner) {
result=aScanner.GetChar(aChar); //skip the hash sign... result=aScanner.GetChar(aChar); //skip the hash sign...
if(NS_OK==result) { if(NS_OK==result) {
mTextKey=aChar; mTextKey=aChar;
static nsAutoString gDigits("0123456789");
static const char* gDigits="0123456789";
result=aScanner.ReadWhile(mTextKey,gDigits,PR_TRUE,PR_FALSE); result=aScanner.ReadWhile(mTextKey,gDigits,PR_TRUE,PR_FALSE);
} }
} }
else { else {
//If you're here, handle an unquoted key. //If you're here, handle an unquoted key.
//Don't forget to reduce entities inline! //Don't forget to reduce entities inline!
static nsAutoString terminals("\b\t\n\r \"<=>"); static const char* theTerminals="\b\t\n\r \"<=>";
result=aScanner.ReadUntil(mTextKey,terminals,PR_TRUE,PR_FALSE); result=aScanner.ReadUntil(mTextKey,theTerminals,PR_TRUE,PR_FALSE);
} }
//now it's time to Consume the (optional) value... //now it's time to Consume the (optional) value...
@ -1355,7 +1347,7 @@ PRInt32 CWhitespaceToken::GetTokenType(void) {
nsresult CWhitespaceToken::Consume(PRUnichar aChar, nsScanner& aScanner) { nsresult CWhitespaceToken::Consume(PRUnichar aChar, nsScanner& aScanner) {
mTextValue=aChar; mTextValue=aChar;
static nsAutoString theWhitespace("\b\t "); static const char* theWhitespace="\b\t ";
nsresult result=aScanner.ReadWhile(mTextValue,theWhitespace,PR_FALSE,PR_FALSE); nsresult result=aScanner.ReadWhile(mTextValue,theWhitespace,PR_FALSE,PR_FALSE);
if(NS_OK==result) { if(NS_OK==result) {
mTextValue.StripChars("\r"); mTextValue.StripChars("\r");
@ -1468,10 +1460,10 @@ PRInt32 CEntityToken::ConsumeEntity(PRUnichar aChar,nsString& aString,nsScanner&
aString+=theChar; aString+=theChar;
} }
if(NS_OK==result){ if(NS_OK==result){
result=aScanner.ReadWhile(aString,GetNumericChars(),PR_TRUE,PR_FALSE); result=aScanner.ReadWhile(aString,gNumChars,PR_TRUE,PR_FALSE);
} }
} }
else result=aScanner.ReadWhile(aString,GetIdentChars(),PR_TRUE,PR_FALSE); else result=aScanner.ReadWhile(aString,gIdentChars,PR_TRUE,PR_FALSE);
if(NS_OK==result) { if(NS_OK==result) {
result=aScanner.Peek(theChar); result=aScanner.Peek(theChar);
if(NS_OK==result) { if(NS_OK==result) {
@ -1721,8 +1713,6 @@ nsresult CSkippedContentToken::Consume(PRUnichar aChar,nsScanner& aScanner) {
//If we find either, just eat them. If we find text or a tag, then go to the //If we find either, just eat them. If we find text or a tag, then go to the
//target endtag, or the start of another comment. //target endtag, or the start of another comment.
static nsAutoString theWhitespace2("\b\t ");
while((!done) && (NS_OK==result)) { while((!done) && (NS_OK==result)) {
result=aScanner.GetChar(aChar); result=aScanner.GetChar(aChar);
if((NS_OK==result) && (kLessThan==aChar)) { if((NS_OK==result) && (kLessThan==aChar)) {
@ -1743,7 +1733,7 @@ nsresult CSkippedContentToken::Consume(PRUnichar aChar,nsScanner& aScanner) {
result=aScanner.ReadUntil(temp,kGreaterThan,PR_TRUE); result=aScanner.ReadUntil(temp,kGreaterThan,PR_TRUE);
} }
} }
else if(0<=theWhitespace2.BinarySearch(aChar)) { else if(('\b'==theChar) || ('\t'==theChar) || (' '==theChar)) {
static CWhitespaceToken theWS; static CWhitespaceToken theWS;
result=theWS.Consume(aChar,aScanner); result=theWS.Consume(aChar,aScanner);
if(NS_OK==result) { if(NS_OK==result) {

Просмотреть файл

@ -28,9 +28,11 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, NS_PARSER_NODE_IID); static NS_DEFINE_IID(kClassIID, NS_PARSER_NODE_IID);
static NS_DEFINE_IID(kIParserNodeIID, NS_IPARSER_NODE_IID); static NS_DEFINE_IID(kIParserNodeIID, NS_IPARSER_NODE_IID);
nsAutoString& GetEmptyString() { nsString& GetEmptyString() {
static nsAutoString theEmptyString(""); static nsString* gEmptyStr=0;
return theEmptyString; if(!gEmptyStr)
gEmptyStr=new nsString("");
return *gEmptyStr;
} }
/** /**

Просмотреть файл

@ -430,8 +430,12 @@ nsresult nsScanner::PutBack(PRUnichar aChar) {
* @return error status * @return error status
*/ */
nsresult nsScanner::SkipWhitespace(void) { nsresult nsScanner::SkipWhitespace(void) {
static nsAutoString chars(" \n\r\t\b"); static const char* gSpaces=" \n\r\t\b";
return SkipOver(chars);
int len=strlen(gSpaces);
CBufDescriptor buf(gSpaces,PR_TRUE,len+1,len);
nsAutoString theWS(buf);
return SkipOver(theWS);
} }
/** /**
@ -561,6 +565,72 @@ nsresult nsScanner::ReadWhile(nsString& aString,
return result; return result;
} }
/**
* Consume chars as long as they are <i>in</i> the
* given validSet of input chars.
*
* @update gess 3/25/98
* @param aString will contain the result of this method
* @param aValidSet is an ordered string that contains the
* valid characters
* @return error code
*/
nsresult nsScanner::ReadWhile(nsString& aString,
nsCString& aValidSet,
PRBool anOrderedSet,
PRBool addTerminal){
NS_ASSERTION(((PR_FALSE==anOrderedSet) || aValidSet.IsOrdered()),kUnorderedStringError);
PRUnichar theChar=0;
nsresult result=NS_OK;
while(NS_OK==result) {
result=GetChar(theChar);
if(NS_OK==result) {
PRInt32 pos=(anOrderedSet) ? aValidSet.BinarySearch(theChar) : aValidSet.FindChar(theChar);
if(kNotFound==pos) {
if(addTerminal)
aString+=theChar;
else PutBack(theChar);
break;
}
else aString+=theChar;
}
}
return result;
}
/**
* Consume chars as long as they are <i>in</i> the
* given validSet of input chars.
*
* @update gess 3/25/98
* @param aString will contain the result of this method
* @param anInputSet contains the legal input chars
* valid characters
* @return error code
*/
nsresult nsScanner::ReadWhile(nsString& aString,
const char* anInputSet,
PRBool anOrderedSet,
PRBool addTerminal)
{
nsresult result=NS_OK;
if(anInputSet) {
PRInt32 len=nsCRT::strlen(anInputSet);
if(0<len) {
CBufDescriptor buf(anInputSet,PR_TRUE,len+1,len);
nsCAutoString theSet(buf);
result=ReadWhile(aString,theSet,anOrderedSet,addTerminal);
} //if
}//if
return result;
}
/** /**
* Consume characters until you encounter one contained in given * Consume characters until you encounter one contained in given
* input set. * input set.
@ -597,6 +667,70 @@ nsresult nsScanner::ReadUntil(nsString& aString,
return result; return result;
} }
/**
* Consume characters until you encounter one contained in given
* input set.
*
* @update gess 3/25/98
* @param aString will contain the result of this method
* @param aTerminalSet is an ordered string that contains
* the set of INVALID characters
* @return error code
*/
nsresult nsScanner::ReadUntil(nsString& aString,
nsCString& aTerminalSet,
PRBool anOrderedSet,
PRBool addTerminal){
NS_ASSERTION(((PR_FALSE==anOrderedSet) || aTerminalSet.IsOrdered()),kUnorderedStringError);
PRUnichar theChar=0;
nsresult result=NS_OK;
while(NS_OK == result) {
result=GetChar(theChar);
if(NS_OK==result) {
PRInt32 pos=(anOrderedSet) ? aTerminalSet.BinarySearch(theChar) : aTerminalSet.FindChar(theChar);
if(kNotFound!=pos) {
if(addTerminal)
aString+=theChar;
else PutBack(theChar);
break;
}
else aString+=theChar;
}
}
return result;
}
/**
* Consume characters until you encounter one contained in given
* input set.
*
* @update gess 3/25/98
* @param aString will contain the result of this method
* @param aTerminalSet is an ordered string that contains
* the set of INVALID characters
* @return error code
*/
nsresult nsScanner::ReadUntil(nsString& aString,
const char* aTerminalSet,
PRBool anOrderedSet,
PRBool addTerminal)
{
nsresult result=NS_OK;
if(aTerminalSet) {
PRInt32 len=nsCRT::strlen(aTerminalSet);
if(0<len) {
CBufDescriptor buf(aTerminalSet,PR_TRUE,len+1,len);
nsCAutoString theSet(buf);
result=ReadUntil(aString,theSet,anOrderedSet,addTerminal);
} //if
}//if
return result;
}
/** /**
* Consumes chars until you see the given terminalChar * Consumes chars until you see the given terminalChar

Просмотреть файл

@ -185,6 +185,8 @@ class nsScanner {
* @return error code * @return error code
*/ */
nsresult ReadUntil(nsString& aString,nsString& aTermSet,PRBool anOrderedSet,PRBool addTerminal); nsresult ReadUntil(nsString& aString,nsString& aTermSet,PRBool anOrderedSet,PRBool addTerminal);
nsresult ReadUntil(nsString& aString,nsCString& aTermSet,PRBool anOrderedSet,PRBool addTerminal);
nsresult ReadUntil(nsString& aString,const char* aTermSet,PRBool anOrderedSet,PRBool addTerminal);
/** /**
* Consume characters while they're members of anInputSet * Consume characters while they're members of anInputSet
@ -196,6 +198,8 @@ class nsScanner {
* @return error code * @return error code
*/ */
nsresult ReadWhile(nsString& aString,nsString& anInputSet,PRBool anOrderedSet,PRBool addTerminal); nsresult ReadWhile(nsString& aString,nsString& anInputSet,PRBool anOrderedSet,PRBool addTerminal);
nsresult ReadWhile(nsString& aString,nsCString& anInputSet,PRBool anOrderedSet,PRBool addTerminal);
nsresult ReadWhile(nsString& aString,const char* anInputSet, PRBool anOrderedSet, PRBool addTerminal);
/** /**
* Records current offset position in input stream. This allows us * Records current offset position in input stream. This allows us