Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Static Protected Member Functions | Protected Attributes
nsCParserNode Class Reference

#include <nsParserNode.h>

Inheritance diagram for nsCParserNode:
Inheritance graph
[legend]
Collaboration diagram for nsCParserNode:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void AddRef ()
void Release (nsFixedSizeAllocator &aPool)
 nsCParserNode ()
 Default constructor.
 nsCParserNode (CToken *aToken, nsTokenAllocator *aTokenAllocator, nsNodeAllocator *aNodeAllocator=0)
 Constructor gess5/11/98.
virtual ~nsCParserNode ()
 Destructor gess5/11/98.
virtual nsresult Init (CToken *aToken, nsTokenAllocator *aTokenAllocator, nsNodeAllocator *aNodeAllocator=0)
 Init gess5/11/98.
virtual const nsAString & GetTagName () const
 Retrieve the name of the node gess5/11/98.
virtual const nsAString & GetText () const
 Retrieve the text from the given node gess5/11/98.
virtual PRInt32 GetNodeType () const
 Retrieve the type of the parser node.
virtual PRInt32 GetTokenType () const
 Retrieve token type of parser node gess5/11/98.
virtual PRInt32 GetAttributeCount (PRBool askToken=PR_FALSE) const
 Retrieve the number of attributes in this node.
virtual const nsAString & GetKeyAt (PRUint32 anIndex) const
 Retrieve the key (of key/value pair) at given index gess5/11/98.
virtual const nsAString & GetValueAt (PRUint32 anIndex) const
 Retrieve the value (of key/value pair) at given index gess5/11/98.
virtual PRInt32 TranslateToUnicodeStr (nsString &aString) const
 NOTE: When the node is an entity, this will translate the entity to it's unicode value, and store it in aString.
virtual void AddAttribute (CToken *aToken)
 gess5/11/98
virtual PRInt32 GetSourceLineNumber (void) const
 This getter retrieves the line number from the input source where the token occured.
virtual CTokenPopAttributeToken ()
 This method pop the attribute token from the given index harishd 03/25/99.
virtual CTokenPopAttributeTokenFront ()
 Like PopAttributeToken, but pops off the front of the attribute list.
virtual void GetSource (nsString &aString)
 Retrieve a string containing the tag and its attributes in "source" form rickg 06June2000.
virtual PRBool GetGenericState (void) const
 This pair of methods allows us to set a generic bit (for arbitrary use) on each node stored in the context.
virtual void SetGenericState (PRBool aState)
virtual nsresult ReleaseAll ()
 Release all the objects you're holding harishd 08/02/00.

Static Public Member Functions

static nsCParserNodeCreate (CToken *aToken, nsTokenAllocator *aTokenAllocator, nsNodeAllocator *aNodeAllocator)
static void Destroy (nsCParserNode *aNode, nsFixedSizeAllocator &aPool)

Public Attributes

PRPackedBool mGenericState
PRInt32 mUseCount
CTokenmToken
nsTokenAllocatormTokenAllocator

Static Protected Member Functions

static voidoperator new (size_t) CPP_THROW_NEW
 Hide operator new; clients should use Create() instead.
static void operator delete (void *, size_t)
 Hide operator delete; clients should use Destroy() instead.

Protected Attributes

PRInt32 mRefCnt

Detailed Description

Definition at line 67 of file nsParserNode.h.


Constructor & Destructor Documentation

Default constructor.

Default Constructor.

Definition at line 50 of file nsParserNode.cpp.

  : mRefCnt(0), mGenericState(PR_FALSE), mUseCount(0), mToken(nsnull),
    mTokenAllocator(nsnull)
{
  MOZ_COUNT_CTOR(nsCParserNode);
#ifdef HEAP_ALLOCATED_NODES
  mNodeAllocator = nsnull;
#endif
}

Here is the caller graph for this function:

nsCParserNode::nsCParserNode ( CToken aToken,
nsTokenAllocator aTokenAllocator,
nsNodeAllocator aNodeAllocator = 0 
)

Constructor gess5/11/98.

Constructor.

Parameters:
aTokenis the token this node "refers" to

gess 3/25/98

Parameters:
aToken-- token to init internal token
Returns:

Definition at line 67 of file nsParserNode.cpp.

  : mRefCnt(0), mGenericState(PR_FALSE), mUseCount(0), mToken(aToken),
    mTokenAllocator(aTokenAllocator)
{
  MOZ_COUNT_CTOR(nsCParserNode);

  static int theNodeCount = 0;
  ++theNodeCount;
  IF_HOLD(mToken);

#ifdef HEAP_ALLOCATED_NODES
  mNodeAllocator = aNodeAllocator;
#endif
}

Destructor gess5/11/98.

destructor NOTE: We intentionally DONT recycle mToken here.

  It may get cached for use elsewhere

gess 3/25/98

Parameters:
@return

Definition at line 92 of file nsParserNode.cpp.

                              {
  MOZ_COUNT_DTOR(nsCParserNode);
  ReleaseAll();
#ifdef HEAP_ALLOCATED_NODES
  if(mNodeAllocator) {
    mNodeAllocator->Recycle(this);
  }
  mNodeAllocator = nsnull;
#endif
  mTokenAllocator = 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

void nsCParserNode::AddAttribute ( CToken aToken) [virtual]

gess5/11/98

Parameters:
@return

Implements nsIParserNode.

Reimplemented in nsCParserStartNode.

Definition at line 130 of file nsParserNode.cpp.

{
}

Here is the caller graph for this function:

Definition at line 75 of file nsParserNode.h.

    {
      ++mRefCnt;
    }
static nsCParserNode* nsCParserNode::Create ( CToken aToken,
nsTokenAllocator aTokenAllocator,
nsNodeAllocator aNodeAllocator 
) [inline, static]

Reimplemented in nsCParserStartNode.

Definition at line 102 of file nsParserNode.h.

    {
#ifdef HEAP_ALLOCATED_NODES
      return new
#else
      nsFixedSizeAllocator& pool = aNodeAllocator->GetArenaPool();
      void* place = pool.Alloc(sizeof(nsCParserNode));
      return ::new (place)
#endif
        nsCParserNode(aToken, aTokenAllocator, aNodeAllocator);
    }

Here is the call graph for this function:

static void nsCParserNode::Destroy ( nsCParserNode aNode,
nsFixedSizeAllocator &  aPool 
) [inline, static]

Definition at line 116 of file nsParserNode.h.

    {
#ifdef HEAP_ALLOCATED_NODES
      delete aNode;
#else
      aNode->~nsCParserNode();
      aPool.Free(aNode, sizeof(*aNode));
#endif
    }

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsCParserNode::GetAttributeCount ( PRBool  askToken = PR_FALSE) const [virtual]

Retrieve the number of attributes in this node.

Retrieve the number of attributes on this node.

gess5/11/98

Returns:
count of attributes (may be 0)

gess 3/25/98

Parameters:
@returnint -- representing attribute count

Implements nsIParserNode.

Reimplemented in nsCParserStartNode.

Definition at line 203 of file nsParserNode.cpp.

{
  return 0;
}
virtual PRBool nsCParserNode::GetGenericState ( void  ) const [inline, virtual]

This pair of methods allows us to set a generic bit (for arbitrary use) on each node stored in the context.

gess 11May2000

Implements nsIParserNode.

Definition at line 255 of file nsParserNode.h.

{return mGenericState;}
const nsAString & nsCParserNode::GetKeyAt ( PRUint32  anIndex) const [virtual]

Retrieve the key (of key/value pair) at given index gess5/11/98.

Retrieve the string rep of the attribute key at the given index.

Parameters:
anIndexis the index of the key you want
Returns:
string containing key.

gess 3/25/98

Parameters:
anIndex--offset of attribute to retrieve
Returns:
string rep of given attribute text key

Implements nsIParserNode.

Reimplemented in nsCParserStartNode.

Definition at line 217 of file nsParserNode.cpp.

{
  return EmptyString();
}
PRInt32 nsCParserNode::GetNodeType ( void  ) const [virtual]

Retrieve the type of the parser node.

Get node type, meaning, get the tag type of the underlying token.

gess5/11/98

Returns:
node type.

gess 3/25/98

Parameters:
@returnint value that represents tag type

Implements nsIParserNode.

Definition at line 174 of file nsParserNode.cpp.

{
  return (mToken) ? mToken->GetTypeID() : 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsCParserNode::GetSource ( nsString aString) [virtual]

Retrieve a string containing the tag and its attributes in "source" form rickg 06June2000.

Returns:
void

Implements nsIParserNode.

Reimplemented in nsCParserStartNode.

Definition at line 277 of file nsParserNode.cpp.

{
  eHTMLTags theTag = mToken ? (eHTMLTags)mToken->GetTypeID() : eHTMLTag_unknown;
  aString.Assign(PRUnichar('<'));
  const PRUnichar* theTagName = nsHTMLTags::GetStringValue(theTag);
  if(theTagName) {
    aString.Append(theTagName);
  }
  aString.Append(PRUnichar('>'));
}

Here is the call graph for this function:

This getter retrieves the line number from the input source where the token occured.

Lines are interpreted as occuring between
characters. gess7/24/98

Returns:
int containing the line number the token was found on

Implements nsIParserNode.

Definition at line 252 of file nsParserNode.cpp.

                                             {
  return mToken ? mToken->GetLineNumber() : 0;
}

Here is the call graph for this function:

const nsAString & nsCParserNode::GetTagName ( ) const [virtual]

Retrieve the name of the node gess5/11/98.

Gets the name of this node.

Returns:
string containing node name

Currently unused.

gess 3/25/98

Parameters:
@returnstring ref containing node name

Implements nsIParserNode.

Definition at line 143 of file nsParserNode.cpp.

                                {
  return EmptyString();
}
const nsAString & nsCParserNode::GetText ( ) const [virtual]

Retrieve the text from the given node gess5/11/98.

Get text value of this node, which translates into getting the text value of the underlying token.

Returns:
string containing node text

gess 3/25/98

Parameters:
@returnstring ref of text from internal token

Implements nsIParserNode.

Definition at line 157 of file nsParserNode.cpp.

{
  if (mToken) {
    return mToken->GetStringValue();
  }
  return EmptyString();
}

Here is the call graph for this function:

PRInt32 nsCParserNode::GetTokenType ( void  ) const [virtual]

Retrieve token type of parser node gess5/11/98.

Gets the token type, which corresponds to a value from eHTMLTokens_xxx.

Returns:
token type

gess 3/25/98

Parameters:
@return

Implements nsIParserNode.

Definition at line 189 of file nsParserNode.cpp.

{
  return (mToken) ? mToken->GetTokenType() : 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const nsAString & nsCParserNode::GetValueAt ( PRUint32  anIndex) const [virtual]

Retrieve the value (of key/value pair) at given index gess5/11/98.

Retrieve the string rep of the attribute at given offset.

Parameters:
anIndexis the index of the value you want
Returns:
string containing value.

gess 3/25/98

Parameters:
anIndex--offset of attribute to retrieve
Returns:
string rep of given attribute text value

Implements nsIParserNode.

Reimplemented in nsCParserStartNode.

Definition at line 231 of file nsParserNode.cpp.

{
  return EmptyString();
}
nsresult nsCParserNode::Init ( CToken aToken,
nsTokenAllocator aTokenAllocator,
nsNodeAllocator aNodeAllocator = 0 
) [virtual]

Init gess5/11/98.

Init.

gess 3/25/98

Parameters:
@return

Reimplemented in nsCParserStartNode.

Definition at line 114 of file nsParserNode.cpp.

{
  mTokenAllocator = aTokenAllocator;
  mToken = aToken;
  IF_HOLD(mToken);
  mGenericState = PR_FALSE;
  mUseCount=0;
#ifdef HEAP_ALLOCATED_NODES
  mNodeAllocator = aNodeAllocator;
#endif
  return NS_OK;
}

Here is the caller graph for this function:

static void nsCParserNode::operator delete ( void ,
size_t   
) [inline, static, protected]

Hide operator delete; clients should use Destroy() instead.

Definition at line 97 of file nsParserNode.h.

{}
static void* nsCParserNode::operator new ( size_t  ) [inline, static, protected]

Hide operator new; clients should use Create() instead.

Definition at line 92 of file nsParserNode.h.

{ return 0; }

This method pop the attribute token from the given index harishd 03/25/99.

This method pop the attribute token harishd 03/25/99.

Returns:
token at anIndex

Reimplemented in nsCParserStartNode.

Definition at line 263 of file nsParserNode.cpp.

                                 {
  return 0;
}

Here is the caller graph for this function:

Like PopAttributeToken, but pops off the front of the attribute list.

Reimplemented in nsCParserStartNode.

Definition at line 268 of file nsParserNode.cpp.

                                      {
  return 0;
}

Here is the caller graph for this function:

void nsCParserNode::Release ( nsFixedSizeAllocator &  aPool) [inline]

Definition at line 80 of file nsParserNode.h.

    {
      if (--mRefCnt == 0)
        Destroy(this, aPool);
    }

Here is the call graph for this function:

Release all the objects you're holding harishd 08/02/00.

Release all the objects you're holding to.

Returns:
void

harishd 08/02/00

Returns:
void

Implements nsIParserNode.

Reimplemented in nsCParserStartNode.

Definition at line 293 of file nsParserNode.cpp.

Here is the caller graph for this function:

virtual void nsCParserNode::SetGenericState ( PRBool  aState) [inline, virtual]

Implements nsIParserNode.

Definition at line 256 of file nsParserNode.h.

{mGenericState=aState;}
PRInt32 nsCParserNode::TranslateToUnicodeStr ( nsString aString) const [virtual]

NOTE: When the node is an entity, this will translate the entity to it's unicode value, and store it in aString.

gess5/11/98

Parameters:
aStringwill contain the resulting unicode string value
Returns:
int (unicode char or unicode index from table)

Implements nsIParserNode.

Definition at line 237 of file nsParserNode.cpp.

{
  if (eToken_entity == mToken->GetTokenType()) {
    return ((CEntityToken*)mToken)->TranslateToUnicodeStr(aString);
  }
  return -1;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 264 of file nsParserNode.h.

Definition at line 71 of file nsParserNode.h.

Definition at line 266 of file nsParserNode.h.

Definition at line 268 of file nsParserNode.h.

Definition at line 265 of file nsParserNode.h.


The documentation for this class was generated from the following files: