#include <nsScanner.h>
Public Member Functions | |
| nsScanner (const nsAString &anHTMLString, const nsACString &aCharset, PRInt32 aSource) | |
| Use this constructor if you want i/o to be based on a single string you hand in during construction. | |
| nsScanner (nsString &aFilename, PRBool aCreateStream, const nsACString &aCharset, PRInt32 aSource) | |
| Use this constructor if you want i/o to be based on a file (therefore a stream) or just data you provide via Append(). | |
| ~nsScanner () | |
| default destructor | |
| nsresult | GetChar (PRUnichar &ch) |
| retrieve next char from internal input stream | |
| nsresult | Peek (PRUnichar &ch, PRUint32 aOffset=0) |
| peek ahead to consume next char from scanner's internal input buffer | |
| nsresult | Peek (nsAString &aStr, PRInt32 aNumChars, PRInt32 aOffset=0) |
| nsresult | SkipOver (PRUnichar aSkipChar) |
| Skip over chars as long as they equal given char. | |
| nsresult | SkipWhitespace (PRInt32 &aNewlinesSkipped) |
| Skip whitespace on scanner input stream. | |
| nsresult | ReadTagIdentifier (nsScannerSharedSubstring &aString) |
| Consume characters until you run into space, a '<', a '>', or a '/'. | |
| nsresult | ReadEntityIdentifier (nsString &aString) |
| Consume characters until you run into a char that's not valid in an entity name. | |
| nsresult | ReadNumber (nsString &aString, PRInt32 aBase) |
| Consume digits. | |
| nsresult | ReadWhitespace (nsScannerSharedSubstring &aString, PRInt32 &aNewlinesSkipped, PRBool &aHaveCR) |
| Consume characters until you find the terminal char. | |
| nsresult | ReadWhitespace (nsScannerIterator &aStart, nsScannerIterator &aEnd, PRInt32 &aNewlinesSkipped) |
| nsresult | ReadUntil (nsAString &aString, PRUnichar aTerminal, PRBool addTerminal) |
| Consume characters until you find the terminal char. | |
| nsresult | ReadUntil (nsAString &aString, const nsReadEndCondition &aEndCondition, PRBool addTerminal) |
| Consume characters until you find one contained in given terminal set. | |
| nsresult | ReadUntil (nsScannerSharedSubstring &aString, const nsReadEndCondition &aEndCondition, PRBool addTerminal) |
| nsresult | ReadUntil (nsScannerIterator &aStart, nsScannerIterator &aEnd, const nsReadEndCondition &aEndCondition, PRBool addTerminal) |
| void | Mark (void) |
| Records current offset position in input stream. | |
| void | RewindToMark (void) |
| Resets current offset position of input stream to marked position. | |
| PRBool | UngetReadable (const nsAString &aBuffer) |
| harishd 01/12/99 | |
| nsresult | Append (const nsAString &aBuffer) |
| gess 5/13/98 | |
| nsresult | Append (const char *aBuffer, PRUint32 aLen, nsIRequest *aRequest) |
| gess 5/21/98 | |
| void | CopyUnusedData (nsString &aCopyBuffer) |
| Call this to copy bytes out of the scanner that have not yet been consumed by the tokenization process. | |
| nsString & | GetFilename (void) |
| Retrieve the name of the file that the scanner is reading from. | |
| nsresult | SetDocumentCharset (const nsACString &aCharset, PRInt32 aSource) |
| Use this setter to change the scanner's unicode decoder. | |
| void | BindSubstring (nsScannerSubstring &aSubstring, const nsScannerIterator &aStart, const nsScannerIterator &aEnd) |
| void | CurrentPosition (nsScannerIterator &aPosition) |
| void | EndReading (nsScannerIterator &aPosition) |
| void | SetPosition (nsScannerIterator &aPosition, PRBool aTruncate=PR_FALSE, PRBool aReverse=PR_FALSE) |
| void | ReplaceCharacter (nsScannerIterator &aPosition, PRUnichar aChar) |
| PRBool | IsIncremental (void) |
| Internal method used to cause the internal buffer to be filled with data. | |
| void | SetIncremental (PRBool anIncrValue) |
| PRInt32 | FirstNonWhitespacePosition () |
| Return the position of the first non-whitespace character. | |
| void | SetParser (nsParser *aParser) |
Static Public Member Functions | |
| static void | SelfTest () |
| Conduct self test. | |
Protected Member Functions | |
| void | AppendToBuffer (nsScannerString::Buffer *, nsIRequest *aRequest) |
| void | AppendToBuffer (const nsAString &aStr) |
Protected Attributes | |
| nsScannerString * | mSlidingBuffer |
| nsScannerIterator | mCurrentPosition |
| nsScannerIterator | mMarkPosition |
| nsScannerIterator | mEndPosition |
| nsString | mFilename |
| PRUint32 | mCountRemaining |
| PRPackedBool | mIncremental |
| PRInt32 | mFirstNonWhitespacePosition |
| PRInt32 | mCharsetSource |
| nsCString | mCharset |
| nsIUnicodeDecoder * | mUnicodeDecoder |
| nsParser * | mParser |
| nsScanner::nsScanner | ( | const nsAString & | anHTMLString, | |
| const nsACString & | aCharset, | |||
| PRInt32 | aSource | |||
| ) |
This short cut was added for Javascript.
ftang 3/02/99
| aCharset | charset | |
| aCharsetSource | - where the charset info came from | |
| aMode | represents the parser mode (nav, other) |
gess 5/12/98
| aMode | represents the parser mode (nav, other) |
| nsScanner::nsScanner | ( | nsString & | aFilename, | |
| PRBool | aCreateStream, | |||
| const nsACString & | aCharset, | |||
| PRInt32 | aSource | |||
| ) |
Use this constructor if you want i/o to be based on strings the scanner receives.
ftang 3/02/99
| aCharset | charset | |
| aCharsetSource | - where the charset info came from | |
| aMode | represents the parser mode (nav, other) |
gess 5/12/98
| aFilename | -- |
| nsScanner::~nsScanner | ( | ) |
gess 3/25/98
| @return |
gess 3/25/98
| ch | is the char to accept new value |
| @return |
gess 3/25/98
| @return | error status |
| nsresult nsScanner::ReadTagIdentifier | ( | nsScannerSharedSubstring & | aString | ) |
| nsresult nsScanner::ReadWhitespace | ( | nsScannerSharedSubstring & | aString, | |
| PRInt32 & | aNewlinesSkipped, | |||
| PRBool & | aHaveCR | |||
| ) |
gess 3/25/98
| aString | receives new data from stream | |
| addTerminal | tells us whether to append terminal to aString |
| nsresult nsScanner::ReadWhitespace | ( | nsScannerIterator & | aStart, | |
| nsScannerIterator & | aEnd, | |||
| PRInt32 & | aNewlinesSkipped | |||
| ) |
| nsresult nsScanner::ReadUntil | ( | nsAString & | aString, | |
| const nsReadEndCondition & | aEndCondition, | |||
| PRBool | addTerminal | |||
| ) |
Consume characters until you encounter one contained in given input set.
gess 3/25/98
| aString | receives new data from stream | |
| aTermSet | contains set of terminating chars | |
| addTerminal | tells us whether to append terminal to aString |
| aString | will contain the result of this method | |
| aTerminalSet | is an ordered string that contains the set of INVALID characters |
| nsresult nsScanner::ReadUntil | ( | nsScannerSharedSubstring & | aString, | |
| const nsReadEndCondition & | aEndCondition, | |||
| PRBool | addTerminal | |||
| ) |
| nsresult nsScanner::ReadUntil | ( | nsScannerIterator & | aStart, | |
| nsScannerIterator & | aEnd, | |||
| const nsReadEndCondition & | aEndCondition, | |||
| PRBool | addTerminal | |||
| ) |
| void nsScanner::Mark | ( | void | ) |
| void nsScanner::RewindToMark | ( | void | ) |
This allows us to back up to this point if the need should arise, such as when tokenization gets interrupted. NOTE: IT IS REALLY BAD FORM TO CALL RELEASE WITHOUT CALLING MARK FIRST!
gess 5/12/98
| @return |
| nsresult nsScanner::Append | ( | const char * | aBuffer, | |
| PRUint32 | aLen, | |||
| nsIRequest * | aRequest | |||
| ) |
| @return |
| void nsScanner::CopyUnusedData | ( | nsString & | aCopyBuffer | ) |
call this to copy bytes out of the scanner that have not yet been consumed by the tokenization process.
gess 5/12/98
| aCopyBuffer | is where the scanner buffer will be copied to |
| nsString & nsScanner::GetFilename | ( | void | ) |
In some cases, it's just a given name, because the scanner isn't really reading from a file.
gess 5/12/98
| void nsScanner::SelfTest | ( | void | ) | [static] |
Actually, selftesting for this class occurs in the parser selftest.
gess 3/25/98
| @return |
| nsresult nsScanner::SetDocumentCharset | ( | const nsACString & | aCharset, | |
| PRInt32 | aSource | |||
| ) |
ftang 3/02/99
| aCharset | a normalized (alias resolved) charset name | |
| aCharsetSource- | where the charset info came from |
| void nsScanner::BindSubstring | ( | nsScannerSubstring & | aSubstring, | |
| const nsScannerIterator & | aStart, | |||
| const nsScannerIterator & | aEnd | |||
| ) |
| void nsScanner::CurrentPosition | ( | nsScannerIterator & | aPosition | ) |
| void nsScanner::EndReading | ( | nsScannerIterator & | aPosition | ) |
| void nsScanner::SetPosition | ( | nsScannerIterator & | aPosition, | |
| PRBool | aTruncate = PR_FALSE, |
|||
| PRBool | aReverse = PR_FALSE | |||
| ) |
| void nsScanner::ReplaceCharacter | ( | nsScannerIterator & | aPosition, | |
| PRUnichar | aChar | |||
| ) |
| PRBool nsScanner::IsIncremental | ( | void | ) | [inline] |
gess4/3/98
| void nsScanner::SetIncremental | ( | PRBool | anIncrValue | ) | [inline] |
| PRInt32 nsScanner::FirstNonWhitespacePosition | ( | ) | [inline] |
This is only reliable before consumers start reading from this scanner.
| void nsScanner::SetParser | ( | nsParser * | aParser | ) | [inline] |
| void nsScanner::AppendToBuffer | ( | nsScannerString::Buffer * | aBuf, | |
| nsIRequest * | aRequest | |||
| ) | [protected] |
nsScannerString* nsScanner::mSlidingBuffer [protected] |
nsScannerIterator nsScanner::mCurrentPosition [protected] |
nsScannerIterator nsScanner::mMarkPosition [protected] |
nsScannerIterator nsScanner::mEndPosition [protected] |
nsString nsScanner::mFilename [protected] |
PRUint32 nsScanner::mCountRemaining [protected] |
PRPackedBool nsScanner::mIncremental [protected] |
PRInt32 nsScanner::mFirstNonWhitespacePosition [protected] |
PRInt32 nsScanner::mCharsetSource [protected] |
nsCString nsScanner::mCharset [protected] |
nsIUnicodeDecoder* nsScanner::mUnicodeDecoder [protected] |
nsParser* nsScanner::mParser [protected] |
1.5.6