зеркало из https://github.com/mozilla/pjs.git
made comments more complete
This commit is contained in:
Родитель
ba2be950ad
Коммит
51bd1c4367
|
@ -118,7 +118,7 @@ class nsIParserNode {
|
|||
* @param aString will contain the resulting unicode string value
|
||||
* @return int (unicode char or unicode index from table)
|
||||
*/
|
||||
virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const = 0;
|
||||
virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -46,27 +46,107 @@ class nsCParserNode : public nsIParserNode {
|
|||
|
||||
public:
|
||||
|
||||
nsCParserNode(CHTMLToken* aToken);
|
||||
~nsCParserNode();
|
||||
virtual const nsString& GetName() const; //to get name of tag
|
||||
virtual const nsString& GetText() const; //get plain text if available
|
||||
virtual const nsString& GetSkippedContent() const;
|
||||
/**
|
||||
* Default constructor
|
||||
* @update gess5/11/98
|
||||
* @param aToken is the token this node "refers" to
|
||||
*/
|
||||
nsCParserNode(CHTMLToken* aToken);
|
||||
|
||||
//methods for determining the type of parser node...
|
||||
virtual PRInt32 GetNodeType() const;
|
||||
virtual PRInt32 GetTokenType() const;
|
||||
/**
|
||||
* Destructor
|
||||
* @update gess5/11/98
|
||||
*/
|
||||
~nsCParserNode();
|
||||
|
||||
//methods for accessing key/value pairs
|
||||
virtual PRInt32 GetAttributeCount(void) const;
|
||||
virtual const nsString& GetKeyAt(PRInt32 anIndex) const;
|
||||
virtual const nsString& GetValueAt(PRInt32 anIndex) const;
|
||||
/**
|
||||
* Retrieve the name of the node
|
||||
* @update gess5/11/98
|
||||
* @return string containing node name
|
||||
*/
|
||||
virtual const nsString& GetName() const;
|
||||
|
||||
virtual void AddAttribute(CHTMLToken* aToken);
|
||||
virtual void SetSkippedContent(CHTMLToken* aToken);
|
||||
/**
|
||||
* Retrieve the text from the given node
|
||||
* @update gess5/11/98
|
||||
* @return string containing node text
|
||||
*/
|
||||
virtual const nsString& GetText() const;
|
||||
|
||||
// misc
|
||||
virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const;
|
||||
/**
|
||||
* Retrieve skipped context from node
|
||||
* @update gess5/11/98
|
||||
* @return string containing skipped content
|
||||
*/
|
||||
virtual const nsString& GetSkippedContent() const;
|
||||
|
||||
/**
|
||||
* Retrieve the type of the parser node.
|
||||
* @update gess5/11/98
|
||||
* @return node type.
|
||||
*/
|
||||
virtual PRInt32 GetNodeType() const;
|
||||
|
||||
/**
|
||||
* Retrieve token type of parser node
|
||||
* @update gess5/11/98
|
||||
* @return token type
|
||||
*/
|
||||
virtual PRInt32 GetTokenType() const;
|
||||
|
||||
//***************************************
|
||||
//methods for accessing key/value pairs
|
||||
//***************************************
|
||||
|
||||
/**
|
||||
* Retrieve the number of attributes in this node.
|
||||
* @update gess5/11/98
|
||||
* @return count of attributes (may be 0)
|
||||
*/
|
||||
virtual PRInt32 GetAttributeCount(void) const;
|
||||
|
||||
/**
|
||||
* Retrieve the key (of key/value pair) at given index
|
||||
* @update gess5/11/98
|
||||
* @param anIndex is the index of the key you want
|
||||
* @return string containing key.
|
||||
*/
|
||||
virtual const nsString& GetKeyAt(PRInt32 anIndex) const;
|
||||
|
||||
/**
|
||||
* Retrieve the value (of key/value pair) at given index
|
||||
* @update gess5/11/98
|
||||
* @param anIndex is the index of the value you want
|
||||
* @return string containing value.
|
||||
*/
|
||||
virtual const nsString& GetValueAt(PRInt32 anIndex) const;
|
||||
|
||||
/**
|
||||
* NOTE: When the node is an entity, this will translate the entity
|
||||
* to it's unicode value, and store it in aString.
|
||||
* @update gess5/11/98
|
||||
* @param aString will contain the resulting unicode string value
|
||||
* @return int (unicode char or unicode index from table)
|
||||
*/
|
||||
virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const;
|
||||
|
||||
/**
|
||||
*
|
||||
* @update gess5/11/98
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
virtual void AddAttribute(CHTMLToken* aToken);
|
||||
|
||||
/**
|
||||
*
|
||||
* @update gess5/11/98
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
virtual void SetSkippedContent(CHTMLToken* aToken);
|
||||
|
||||
|
||||
protected:
|
||||
PRInt32 mAttributeCount;
|
||||
CHTMLToken* mToken;
|
||||
|
|
|
@ -52,20 +52,99 @@ class CScanner;
|
|||
*/
|
||||
class CToken {
|
||||
public:
|
||||
CToken(const nsString& aName);
|
||||
~CToken();
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
* @update gess5/11/98
|
||||
* @param aName is the given name of the token
|
||||
*/
|
||||
CToken(const nsString& aName);
|
||||
|
||||
/**
|
||||
* destructor
|
||||
* @update gess5/11/98
|
||||
*/
|
||||
~CToken();
|
||||
|
||||
virtual nsString& GetStringValue(void);
|
||||
virtual nsString& GetText(void);
|
||||
virtual void SetStringValue(const char* name);
|
||||
virtual void SetOrdinal(PRInt32 value);
|
||||
virtual PRInt32 GetOrdinal(void);
|
||||
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
|
||||
virtual void DebugDumpToken(ostream& out);
|
||||
virtual void DebugDumpSource(ostream& out);
|
||||
virtual PRInt32 GetTokenType(void);
|
||||
virtual const char* GetClassName(void);
|
||||
virtual void SelfTest(void);
|
||||
/**
|
||||
* Retrieve string value of the token
|
||||
* @update gess5/11/98
|
||||
* @return reference to string containing string value
|
||||
*/
|
||||
virtual nsString& GetStringValue(void);
|
||||
|
||||
/**
|
||||
* Get text of this token
|
||||
* @update gess5/11/98
|
||||
* @return string ref containing text value of this token
|
||||
*/
|
||||
virtual nsString& GetText(void);
|
||||
|
||||
/**
|
||||
* Setter method that changes the string value of this token
|
||||
* @update gess5/11/98
|
||||
* @param name is a char* value containing new string value
|
||||
*/
|
||||
virtual void SetStringValue(const char* name);
|
||||
|
||||
/**
|
||||
* Sets the ordinal value of this token (not currently used)
|
||||
* @update gess5/11/98
|
||||
* @param value is the new ord value for this token
|
||||
*/
|
||||
virtual void SetOrdinal(PRInt32 value);
|
||||
|
||||
/**
|
||||
* Getter which retrieves the current ordinal value for this token
|
||||
* @update gess5/11/98
|
||||
* @return current ordinal value
|
||||
*/
|
||||
virtual PRInt32 GetOrdinal(void);
|
||||
|
||||
/**
|
||||
* Causes token to consume data from given scanner.
|
||||
* Note that behavior varies wildly between CToken subclasses.
|
||||
* @update gess5/11/98
|
||||
* @param aChar -- most recent char consumed
|
||||
* @param aScanner -- input source where token should get data
|
||||
* @return error code (0 means ok)
|
||||
*/
|
||||
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
|
||||
|
||||
/**
|
||||
* Causes token to dump itself in debug form to given output stream
|
||||
* @update gess5/11/98
|
||||
* @param out is the output stream where token should write itself
|
||||
*/
|
||||
virtual void DebugDumpToken(ostream& out);
|
||||
|
||||
/**
|
||||
* Causes token to dump itself in source form to given output stream
|
||||
* @update gess5/11/98
|
||||
* @param out is the output stream where token should write itself
|
||||
*/
|
||||
virtual void DebugDumpSource(ostream& out);
|
||||
|
||||
/**
|
||||
* Getter which retrieves type of token
|
||||
* @update gess5/11/98
|
||||
* @return int containing token type
|
||||
*/
|
||||
virtual PRInt32 GetTokenType(void);
|
||||
|
||||
/**
|
||||
* Getter which retrieves the class name for this token
|
||||
* This method is only used for debug purposes.
|
||||
* @update gess5/11/98
|
||||
* @return const char* containing class name
|
||||
*/
|
||||
virtual const char* GetClassName(void);
|
||||
|
||||
/**
|
||||
* perform self test.
|
||||
* @update gess5/11/98
|
||||
*/
|
||||
virtual void SelfTest(void);
|
||||
|
||||
protected:
|
||||
PRInt32 mOrdinalValue;
|
||||
|
|
|
@ -118,7 +118,7 @@ class nsIParserNode {
|
|||
* @param aString will contain the resulting unicode string value
|
||||
* @return int (unicode char or unicode index from table)
|
||||
*/
|
||||
virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const = 0;
|
||||
virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -46,27 +46,107 @@ class nsCParserNode : public nsIParserNode {
|
|||
|
||||
public:
|
||||
|
||||
nsCParserNode(CHTMLToken* aToken);
|
||||
~nsCParserNode();
|
||||
virtual const nsString& GetName() const; //to get name of tag
|
||||
virtual const nsString& GetText() const; //get plain text if available
|
||||
virtual const nsString& GetSkippedContent() const;
|
||||
/**
|
||||
* Default constructor
|
||||
* @update gess5/11/98
|
||||
* @param aToken is the token this node "refers" to
|
||||
*/
|
||||
nsCParserNode(CHTMLToken* aToken);
|
||||
|
||||
//methods for determining the type of parser node...
|
||||
virtual PRInt32 GetNodeType() const;
|
||||
virtual PRInt32 GetTokenType() const;
|
||||
/**
|
||||
* Destructor
|
||||
* @update gess5/11/98
|
||||
*/
|
||||
~nsCParserNode();
|
||||
|
||||
//methods for accessing key/value pairs
|
||||
virtual PRInt32 GetAttributeCount(void) const;
|
||||
virtual const nsString& GetKeyAt(PRInt32 anIndex) const;
|
||||
virtual const nsString& GetValueAt(PRInt32 anIndex) const;
|
||||
/**
|
||||
* Retrieve the name of the node
|
||||
* @update gess5/11/98
|
||||
* @return string containing node name
|
||||
*/
|
||||
virtual const nsString& GetName() const;
|
||||
|
||||
virtual void AddAttribute(CHTMLToken* aToken);
|
||||
virtual void SetSkippedContent(CHTMLToken* aToken);
|
||||
/**
|
||||
* Retrieve the text from the given node
|
||||
* @update gess5/11/98
|
||||
* @return string containing node text
|
||||
*/
|
||||
virtual const nsString& GetText() const;
|
||||
|
||||
// misc
|
||||
virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const;
|
||||
/**
|
||||
* Retrieve skipped context from node
|
||||
* @update gess5/11/98
|
||||
* @return string containing skipped content
|
||||
*/
|
||||
virtual const nsString& GetSkippedContent() const;
|
||||
|
||||
/**
|
||||
* Retrieve the type of the parser node.
|
||||
* @update gess5/11/98
|
||||
* @return node type.
|
||||
*/
|
||||
virtual PRInt32 GetNodeType() const;
|
||||
|
||||
/**
|
||||
* Retrieve token type of parser node
|
||||
* @update gess5/11/98
|
||||
* @return token type
|
||||
*/
|
||||
virtual PRInt32 GetTokenType() const;
|
||||
|
||||
//***************************************
|
||||
//methods for accessing key/value pairs
|
||||
//***************************************
|
||||
|
||||
/**
|
||||
* Retrieve the number of attributes in this node.
|
||||
* @update gess5/11/98
|
||||
* @return count of attributes (may be 0)
|
||||
*/
|
||||
virtual PRInt32 GetAttributeCount(void) const;
|
||||
|
||||
/**
|
||||
* Retrieve the key (of key/value pair) at given index
|
||||
* @update gess5/11/98
|
||||
* @param anIndex is the index of the key you want
|
||||
* @return string containing key.
|
||||
*/
|
||||
virtual const nsString& GetKeyAt(PRInt32 anIndex) const;
|
||||
|
||||
/**
|
||||
* Retrieve the value (of key/value pair) at given index
|
||||
* @update gess5/11/98
|
||||
* @param anIndex is the index of the value you want
|
||||
* @return string containing value.
|
||||
*/
|
||||
virtual const nsString& GetValueAt(PRInt32 anIndex) const;
|
||||
|
||||
/**
|
||||
* NOTE: When the node is an entity, this will translate the entity
|
||||
* to it's unicode value, and store it in aString.
|
||||
* @update gess5/11/98
|
||||
* @param aString will contain the resulting unicode string value
|
||||
* @return int (unicode char or unicode index from table)
|
||||
*/
|
||||
virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const;
|
||||
|
||||
/**
|
||||
*
|
||||
* @update gess5/11/98
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
virtual void AddAttribute(CHTMLToken* aToken);
|
||||
|
||||
/**
|
||||
*
|
||||
* @update gess5/11/98
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
virtual void SetSkippedContent(CHTMLToken* aToken);
|
||||
|
||||
|
||||
protected:
|
||||
PRInt32 mAttributeCount;
|
||||
CHTMLToken* mToken;
|
||||
|
|
|
@ -52,20 +52,99 @@ class CScanner;
|
|||
*/
|
||||
class CToken {
|
||||
public:
|
||||
CToken(const nsString& aName);
|
||||
~CToken();
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
* @update gess5/11/98
|
||||
* @param aName is the given name of the token
|
||||
*/
|
||||
CToken(const nsString& aName);
|
||||
|
||||
/**
|
||||
* destructor
|
||||
* @update gess5/11/98
|
||||
*/
|
||||
~CToken();
|
||||
|
||||
virtual nsString& GetStringValue(void);
|
||||
virtual nsString& GetText(void);
|
||||
virtual void SetStringValue(const char* name);
|
||||
virtual void SetOrdinal(PRInt32 value);
|
||||
virtual PRInt32 GetOrdinal(void);
|
||||
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
|
||||
virtual void DebugDumpToken(ostream& out);
|
||||
virtual void DebugDumpSource(ostream& out);
|
||||
virtual PRInt32 GetTokenType(void);
|
||||
virtual const char* GetClassName(void);
|
||||
virtual void SelfTest(void);
|
||||
/**
|
||||
* Retrieve string value of the token
|
||||
* @update gess5/11/98
|
||||
* @return reference to string containing string value
|
||||
*/
|
||||
virtual nsString& GetStringValue(void);
|
||||
|
||||
/**
|
||||
* Get text of this token
|
||||
* @update gess5/11/98
|
||||
* @return string ref containing text value of this token
|
||||
*/
|
||||
virtual nsString& GetText(void);
|
||||
|
||||
/**
|
||||
* Setter method that changes the string value of this token
|
||||
* @update gess5/11/98
|
||||
* @param name is a char* value containing new string value
|
||||
*/
|
||||
virtual void SetStringValue(const char* name);
|
||||
|
||||
/**
|
||||
* Sets the ordinal value of this token (not currently used)
|
||||
* @update gess5/11/98
|
||||
* @param value is the new ord value for this token
|
||||
*/
|
||||
virtual void SetOrdinal(PRInt32 value);
|
||||
|
||||
/**
|
||||
* Getter which retrieves the current ordinal value for this token
|
||||
* @update gess5/11/98
|
||||
* @return current ordinal value
|
||||
*/
|
||||
virtual PRInt32 GetOrdinal(void);
|
||||
|
||||
/**
|
||||
* Causes token to consume data from given scanner.
|
||||
* Note that behavior varies wildly between CToken subclasses.
|
||||
* @update gess5/11/98
|
||||
* @param aChar -- most recent char consumed
|
||||
* @param aScanner -- input source where token should get data
|
||||
* @return error code (0 means ok)
|
||||
*/
|
||||
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner);
|
||||
|
||||
/**
|
||||
* Causes token to dump itself in debug form to given output stream
|
||||
* @update gess5/11/98
|
||||
* @param out is the output stream where token should write itself
|
||||
*/
|
||||
virtual void DebugDumpToken(ostream& out);
|
||||
|
||||
/**
|
||||
* Causes token to dump itself in source form to given output stream
|
||||
* @update gess5/11/98
|
||||
* @param out is the output stream where token should write itself
|
||||
*/
|
||||
virtual void DebugDumpSource(ostream& out);
|
||||
|
||||
/**
|
||||
* Getter which retrieves type of token
|
||||
* @update gess5/11/98
|
||||
* @return int containing token type
|
||||
*/
|
||||
virtual PRInt32 GetTokenType(void);
|
||||
|
||||
/**
|
||||
* Getter which retrieves the class name for this token
|
||||
* This method is only used for debug purposes.
|
||||
* @update gess5/11/98
|
||||
* @return const char* containing class name
|
||||
*/
|
||||
virtual const char* GetClassName(void);
|
||||
|
||||
/**
|
||||
* perform self test.
|
||||
* @update gess5/11/98
|
||||
*/
|
||||
virtual void SelfTest(void);
|
||||
|
||||
protected:
|
||||
PRInt32 mOrdinalValue;
|
||||
|
|
Загрузка…
Ссылка в новой задаче