зеркало из https://github.com/mozilla/pjs.git
made comments more complete
This commit is contained in:
Родитель
ba2be950ad
Коммит
51bd1c4367
|
@ -46,26 +46,106 @@ class nsCParserNode : public nsIParserNode {
|
|||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
* @update gess5/11/98
|
||||
* @param aToken is the token this node "refers" to
|
||||
*/
|
||||
nsCParserNode(CHTMLToken* aToken);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
* @update gess5/11/98
|
||||
*/
|
||||
~nsCParserNode();
|
||||
virtual const nsString& GetName() const; //to get name of tag
|
||||
virtual const nsString& GetText() const; //get plain text if available
|
||||
|
||||
/**
|
||||
* Retrieve the name of the node
|
||||
* @update gess5/11/98
|
||||
* @return string containing node name
|
||||
*/
|
||||
virtual const nsString& GetName() const;
|
||||
|
||||
/**
|
||||
* Retrieve the text from the given node
|
||||
* @update gess5/11/98
|
||||
* @return string containing node text
|
||||
*/
|
||||
virtual const nsString& GetText() const;
|
||||
|
||||
/**
|
||||
* Retrieve skipped context from node
|
||||
* @update gess5/11/98
|
||||
* @return string containing skipped content
|
||||
*/
|
||||
virtual const nsString& GetSkippedContent() const;
|
||||
|
||||
//methods for determining the type of parser node...
|
||||
/**
|
||||
* 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);
|
||||
|
||||
// misc
|
||||
virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const;
|
||||
|
||||
protected:
|
||||
PRInt32 mAttributeCount;
|
||||
|
|
|
@ -52,19 +52,98 @@ class CScanner;
|
|||
*/
|
||||
class CToken {
|
||||
public:
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* 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:
|
||||
|
|
|
@ -46,26 +46,106 @@ class nsCParserNode : public nsIParserNode {
|
|||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
* @update gess5/11/98
|
||||
* @param aToken is the token this node "refers" to
|
||||
*/
|
||||
nsCParserNode(CHTMLToken* aToken);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
* @update gess5/11/98
|
||||
*/
|
||||
~nsCParserNode();
|
||||
virtual const nsString& GetName() const; //to get name of tag
|
||||
virtual const nsString& GetText() const; //get plain text if available
|
||||
|
||||
/**
|
||||
* Retrieve the name of the node
|
||||
* @update gess5/11/98
|
||||
* @return string containing node name
|
||||
*/
|
||||
virtual const nsString& GetName() const;
|
||||
|
||||
/**
|
||||
* Retrieve the text from the given node
|
||||
* @update gess5/11/98
|
||||
* @return string containing node text
|
||||
*/
|
||||
virtual const nsString& GetText() const;
|
||||
|
||||
/**
|
||||
* Retrieve skipped context from node
|
||||
* @update gess5/11/98
|
||||
* @return string containing skipped content
|
||||
*/
|
||||
virtual const nsString& GetSkippedContent() const;
|
||||
|
||||
//methods for determining the type of parser node...
|
||||
/**
|
||||
* 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);
|
||||
|
||||
// misc
|
||||
virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const;
|
||||
|
||||
protected:
|
||||
PRInt32 mAttributeCount;
|
||||
|
|
|
@ -52,19 +52,98 @@ class CScanner;
|
|||
*/
|
||||
class CToken {
|
||||
public:
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* 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:
|
||||
|
|
Загрузка…
Ссылка в новой задаче