moved skipped content token from the attribute list to it's own slot

This commit is contained in:
peterl%netscape.com 1998-09-22 02:07:31 +00:00
parent 4e984fd8cc
commit fb20c625b9
4 changed files with 12 additions and 24 deletions

View File

@ -41,6 +41,7 @@ nsCParserNode::nsCParserNode(CToken* aToken,PRInt32 aLineNumber): nsIParserNode(
mLineNumber=aLineNumber;
mToken=aToken;
memset(mAttributes,0,sizeof(mAttributes));
mSkippedContent=nsnull;
}
@ -129,18 +130,15 @@ void nsCParserNode::AddAttribute(CToken* aToken) {
/**
* This method gets called when the parser encounters
* skipped content after a start token.
* NOTE: To determine if we have skipped content, simply
* check mAttributes[mAttributeCount].
*
* @update gess 3/26/98
* @param aToken -- really a skippedcontent token
* @return nada
*/
void nsCParserNode::SetSkippedContent(CToken* aToken){
NS_PRECONDITION(mAttributeCount<PRInt32(sizeof(mAttributes)-1), "Buffer overrun!");
NS_PRECONDITION(0!=aToken, "Error: Token shouldn't be null!");
if(aToken) {
mAttributes[mAttributeCount++]=aToken;
NS_ASSERTION(eToken_skippedcontent == aToken->GetTokenType(), "not a skipped content token");
mSkippedContent = aToken;
}
}
@ -179,13 +177,8 @@ const nsString& nsCParserNode::GetText() const {
* @return string ref of text from internal token
*/
const nsString& nsCParserNode::GetSkippedContent() const {
if (0 < mAttributeCount) {
if(mAttributes[mAttributeCount-1]) {
CSkippedContentToken* sc=(CSkippedContentToken*)(mAttributes[mAttributeCount-1]);
if(sc) {
return sc->GetKey();
}
}
if (nsnull != mSkippedContent) {
return ((CSkippedContentToken*)mSkippedContent)->GetKey();
}
return mEmptyString;
}

View File

@ -168,6 +168,7 @@ class nsCParserNode : public nsIParserNode {
PRInt32 mLineNumber;
CToken* mToken;
CToken* mAttributes[eMaxAttr]; // XXX Ack! This needs to be dynamic!
CToken* mSkippedContent;
// nsAutoString mName;
static const nsAutoString mEmptyString;

View File

@ -41,6 +41,7 @@ nsCParserNode::nsCParserNode(CToken* aToken,PRInt32 aLineNumber): nsIParserNode(
mLineNumber=aLineNumber;
mToken=aToken;
memset(mAttributes,0,sizeof(mAttributes));
mSkippedContent=nsnull;
}
@ -129,18 +130,15 @@ void nsCParserNode::AddAttribute(CToken* aToken) {
/**
* This method gets called when the parser encounters
* skipped content after a start token.
* NOTE: To determine if we have skipped content, simply
* check mAttributes[mAttributeCount].
*
* @update gess 3/26/98
* @param aToken -- really a skippedcontent token
* @return nada
*/
void nsCParserNode::SetSkippedContent(CToken* aToken){
NS_PRECONDITION(mAttributeCount<PRInt32(sizeof(mAttributes)-1), "Buffer overrun!");
NS_PRECONDITION(0!=aToken, "Error: Token shouldn't be null!");
if(aToken) {
mAttributes[mAttributeCount++]=aToken;
NS_ASSERTION(eToken_skippedcontent == aToken->GetTokenType(), "not a skipped content token");
mSkippedContent = aToken;
}
}
@ -179,13 +177,8 @@ const nsString& nsCParserNode::GetText() const {
* @return string ref of text from internal token
*/
const nsString& nsCParserNode::GetSkippedContent() const {
if (0 < mAttributeCount) {
if(mAttributes[mAttributeCount-1]) {
CSkippedContentToken* sc=(CSkippedContentToken*)(mAttributes[mAttributeCount-1]);
if(sc) {
return sc->GetKey();
}
}
if (nsnull != mSkippedContent) {
return ((CSkippedContentToken*)mSkippedContent)->GetKey();
}
return mEmptyString;
}

View File

@ -168,6 +168,7 @@ class nsCParserNode : public nsIParserNode {
PRInt32 mLineNumber;
CToken* mToken;
CToken* mAttributes[eMaxAttr]; // XXX Ack! This needs to be dynamic!
CToken* mSkippedContent;
// nsAutoString mName;
static const nsAutoString mEmptyString;