This commit is contained in:
rickg 1998-05-12 01:11:50 +00:00
Родитель bb750ae108
Коммит 6ab2e5a838
6 изменённых файлов: 378 добавлений и 60 удалений

Просмотреть файл

@ -118,7 +118,7 @@ class nsIParserNode {
* @param aString will contain the resulting unicode string value * @param aString will contain the resulting unicode string value
* @return int (unicode char or unicode index from table) * @return int (unicode char or unicode index from table)
*/ */
virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const = 0; virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const = 0;
}; };
#endif #endif

Просмотреть файл

@ -46,27 +46,107 @@ class nsCParserNode : public nsIParserNode {
public: public:
nsCParserNode(CHTMLToken* aToken); /**
~nsCParserNode(); * Default constructor
virtual const nsString& GetName() const; //to get name of tag * @update gess5/11/98
virtual const nsString& GetText() const; //get plain text if available * @param aToken is the token this node "refers" to
virtual const nsString& GetSkippedContent() const; */
nsCParserNode(CHTMLToken* aToken);
//methods for determining the type of parser node... /**
virtual PRInt32 GetNodeType() const; * Destructor
virtual PRInt32 GetTokenType() const; * @update gess5/11/98
*/
~nsCParserNode();
//methods for accessing key/value pairs /**
virtual PRInt32 GetAttributeCount(void) const; * Retrieve the name of the node
virtual const nsString& GetKeyAt(PRInt32 anIndex) const; * @update gess5/11/98
virtual const nsString& GetValueAt(PRInt32 anIndex) const; * @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: protected:
PRInt32 mAttributeCount; PRInt32 mAttributeCount;
CHTMLToken* mToken; CHTMLToken* mToken;

Просмотреть файл

@ -52,20 +52,99 @@ class CScanner;
*/ */
class CToken { class CToken {
public: 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); * Retrieve string value of the token
virtual void SetStringValue(const char* name); * @update gess5/11/98
virtual void SetOrdinal(PRInt32 value); * @return reference to string containing string value
virtual PRInt32 GetOrdinal(void); */
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner); virtual nsString& GetStringValue(void);
virtual void DebugDumpToken(ostream& out);
virtual void DebugDumpSource(ostream& out); /**
virtual PRInt32 GetTokenType(void); * Get text of this token
virtual const char* GetClassName(void); * @update gess5/11/98
virtual void SelfTest(void); * @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: protected:
PRInt32 mOrdinalValue; PRInt32 mOrdinalValue;

Просмотреть файл

@ -118,7 +118,7 @@ class nsIParserNode {
* @param aString will contain the resulting unicode string value * @param aString will contain the resulting unicode string value
* @return int (unicode char or unicode index from table) * @return int (unicode char or unicode index from table)
*/ */
virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const = 0; virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const = 0;
}; };
#endif #endif

Просмотреть файл

@ -46,27 +46,107 @@ class nsCParserNode : public nsIParserNode {
public: public:
nsCParserNode(CHTMLToken* aToken); /**
~nsCParserNode(); * Default constructor
virtual const nsString& GetName() const; //to get name of tag * @update gess5/11/98
virtual const nsString& GetText() const; //get plain text if available * @param aToken is the token this node "refers" to
virtual const nsString& GetSkippedContent() const; */
nsCParserNode(CHTMLToken* aToken);
//methods for determining the type of parser node... /**
virtual PRInt32 GetNodeType() const; * Destructor
virtual PRInt32 GetTokenType() const; * @update gess5/11/98
*/
~nsCParserNode();
//methods for accessing key/value pairs /**
virtual PRInt32 GetAttributeCount(void) const; * Retrieve the name of the node
virtual const nsString& GetKeyAt(PRInt32 anIndex) const; * @update gess5/11/98
virtual const nsString& GetValueAt(PRInt32 anIndex) const; * @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: protected:
PRInt32 mAttributeCount; PRInt32 mAttributeCount;
CHTMLToken* mToken; CHTMLToken* mToken;

Просмотреть файл

@ -52,20 +52,99 @@ class CScanner;
*/ */
class CToken { class CToken {
public: 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); * Retrieve string value of the token
virtual void SetStringValue(const char* name); * @update gess5/11/98
virtual void SetOrdinal(PRInt32 value); * @return reference to string containing string value
virtual PRInt32 GetOrdinal(void); */
virtual PRInt32 Consume(PRUnichar aChar,CScanner& aScanner); virtual nsString& GetStringValue(void);
virtual void DebugDumpToken(ostream& out);
virtual void DebugDumpSource(ostream& out); /**
virtual PRInt32 GetTokenType(void); * Get text of this token
virtual const char* GetClassName(void); * @update gess5/11/98
virtual void SelfTest(void); * @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: protected:
PRInt32 mOrdinalValue; PRInt32 mOrdinalValue;