From 62af559c04acfa8aebfa0eb6b6406908e202e755 Mon Sep 17 00:00:00 2001 From: "rickg@netscape.com" Date: Wed, 2 Sep 1998 07:12:49 +0000 Subject: [PATCH] added new EnableParser() routine for kipp; WIP --- htmlparser/src/nsIParser.h | 1 + htmlparser/src/nsParser.cpp | 15 +++++++++++++++ htmlparser/src/nsParser.h | 13 +++++++++++++ parser/htmlparser/src/nsIParser.h | 1 + parser/htmlparser/src/nsParser.cpp | 15 +++++++++++++++ parser/htmlparser/src/nsParser.h | 13 +++++++++++++ 6 files changed, 58 insertions(+) diff --git a/htmlparser/src/nsIParser.h b/htmlparser/src/nsIParser.h index d6d178c5840f..9a7bb0bdd072 100644 --- a/htmlparser/src/nsIParser.h +++ b/htmlparser/src/nsIParser.h @@ -102,6 +102,7 @@ class nsIParser : public nsISupports { * until you wind up being emitted to the given contentsink (which may or may not * be a proxy for the NGLayout content model). ******************************************************************************************/ + virtual PRBool EnableParser(PRBool aState) = 0; virtual PRInt32 Parse(nsIURL* aURL,nsIStreamObserver* aListener = nsnull,PRBool aEnableVerify=PR_FALSE) = 0; virtual PRInt32 Parse(fstream& aStream,PRBool aEnableVerify=PR_FALSE) = 0; virtual PRInt32 Parse(nsString& aSourceBuffer,PRBool anHTMLString,PRBool aEnableVerify=PR_FALSE) = 0; diff --git a/htmlparser/src/nsParser.cpp b/htmlparser/src/nsParser.cpp index 229cc522651c..4fd1e6c8ec6d 100644 --- a/htmlparser/src/nsParser.cpp +++ b/htmlparser/src/nsParser.cpp @@ -439,6 +439,20 @@ CParserContext* nsParser::PopContext() { return oldContext; } +/** + * Call this when you want control whether or not the parser will parse + * and tokenize input (TRUE), or whether it just caches input to be + * parsed later (FALSE). + * + * @update gess 9/1/98 + * @param aState determines whether we parse/tokenize or just cache. + * @return current state + */ +PRBool nsParser::EnableParser(PRBool aState){ + mParserEnabled=aState; + return mParserEnabled; +} + /** * This is the main controlling routine in the parsing process. @@ -529,6 +543,7 @@ PRInt32 nsParser::Parse(nsString& aSourceBuffer,PRBool anHTMLString,PRBool aVeri return result; } + /** * This routine is called to cause the parser to continue * parsing it's underling stream. This call allows the diff --git a/htmlparser/src/nsParser.h b/htmlparser/src/nsParser.h index 1561ba1128b4..0f5f4e3fc65e 100644 --- a/htmlparser/src/nsParser.h +++ b/htmlparser/src/nsParser.h @@ -144,6 +144,18 @@ friend class CTokenHandler; */ virtual PRInt32 Parse(nsString& aSourceBuffer,PRBool anHTMLString,PRBool aEnableVerify=PR_FALSE); + + /** + * Call this when you want control whether or not the parser will parse + * and tokenize input (TRUE), or whether it just caches input to be + * parsed later (FALSE). + * + * @update gess 9/1/98 + * @param aState determines whether we parse/tokenize or just cache. + * @return current state + */ + virtual PRBool EnableParser(PRBool aState); + /** * This method gets called (automatically) during incremental parsing * @update gess5/11/98 @@ -284,6 +296,7 @@ protected: nsIContentSink* mSink; nsIParserFilter* mParserFilter; PRBool mDTDVerification; + PRBool mParserEnabled; }; diff --git a/parser/htmlparser/src/nsIParser.h b/parser/htmlparser/src/nsIParser.h index d6d178c5840f..9a7bb0bdd072 100644 --- a/parser/htmlparser/src/nsIParser.h +++ b/parser/htmlparser/src/nsIParser.h @@ -102,6 +102,7 @@ class nsIParser : public nsISupports { * until you wind up being emitted to the given contentsink (which may or may not * be a proxy for the NGLayout content model). ******************************************************************************************/ + virtual PRBool EnableParser(PRBool aState) = 0; virtual PRInt32 Parse(nsIURL* aURL,nsIStreamObserver* aListener = nsnull,PRBool aEnableVerify=PR_FALSE) = 0; virtual PRInt32 Parse(fstream& aStream,PRBool aEnableVerify=PR_FALSE) = 0; virtual PRInt32 Parse(nsString& aSourceBuffer,PRBool anHTMLString,PRBool aEnableVerify=PR_FALSE) = 0; diff --git a/parser/htmlparser/src/nsParser.cpp b/parser/htmlparser/src/nsParser.cpp index 229cc522651c..4fd1e6c8ec6d 100644 --- a/parser/htmlparser/src/nsParser.cpp +++ b/parser/htmlparser/src/nsParser.cpp @@ -439,6 +439,20 @@ CParserContext* nsParser::PopContext() { return oldContext; } +/** + * Call this when you want control whether or not the parser will parse + * and tokenize input (TRUE), or whether it just caches input to be + * parsed later (FALSE). + * + * @update gess 9/1/98 + * @param aState determines whether we parse/tokenize or just cache. + * @return current state + */ +PRBool nsParser::EnableParser(PRBool aState){ + mParserEnabled=aState; + return mParserEnabled; +} + /** * This is the main controlling routine in the parsing process. @@ -529,6 +543,7 @@ PRInt32 nsParser::Parse(nsString& aSourceBuffer,PRBool anHTMLString,PRBool aVeri return result; } + /** * This routine is called to cause the parser to continue * parsing it's underling stream. This call allows the diff --git a/parser/htmlparser/src/nsParser.h b/parser/htmlparser/src/nsParser.h index 1561ba1128b4..0f5f4e3fc65e 100644 --- a/parser/htmlparser/src/nsParser.h +++ b/parser/htmlparser/src/nsParser.h @@ -144,6 +144,18 @@ friend class CTokenHandler; */ virtual PRInt32 Parse(nsString& aSourceBuffer,PRBool anHTMLString,PRBool aEnableVerify=PR_FALSE); + + /** + * Call this when you want control whether or not the parser will parse + * and tokenize input (TRUE), or whether it just caches input to be + * parsed later (FALSE). + * + * @update gess 9/1/98 + * @param aState determines whether we parse/tokenize or just cache. + * @return current state + */ + virtual PRBool EnableParser(PRBool aState); + /** * This method gets called (automatically) during incremental parsing * @update gess5/11/98 @@ -284,6 +296,7 @@ protected: nsIContentSink* mSink; nsIParserFilter* mParserFilter; PRBool mDTDVerification; + PRBool mParserEnabled; };