TOP --> CcDoc

class CCcDocParserNode
    extends CJdlVector < ulong > as public

C++ parse tree node. It is a list of string rep ids.

Author:
Joe Linoff

Version:
$Id: ccdocparsernode.h,v 1.4 1999/06/12 18:10:33 jdl Exp $

Source:
../../ccdoc/src/ccdocparsernode.h:29

Constructors Index

CCcDocParserNode
[public] Construct a root node with no tokens.
CCcDocParserNode
[public] Construct a root node with a single token.
CCcDocParserNode
[public] Construct a root node with a list of tokens.
CCcDocParserNode
[public] Construct a node from the CTF file. This assumes that the node has already been compiled.
CCcDocParserNode
[public] Insert before copy constructor.
~CCcDocParserNode
[public] Destructor.


Enums Index

DATA_TYPE
[public] The node type.
SCOPE_TYPE
[public] The node scope.
STMT_TYPE
[public] The node statement type.


Methods Index

Append
[public] Append a new handle to the token list.
Append
[public] Append a new string to the token list. The string is converted to a handle inside the append.
Compile
[public] Compile a node tree. This should only be called for the root node.
Copy
[public] Copy a token list. Each token is converted to its associated handle.
Copy
[public] Copy a token handle list.
Dump
[public] Dump the contents of the node tree to a specified file.
GetChild
[public] Get the i-th child node.
GetChildIdx
[public] Get the child offset from the parent.
GetDataString
[public] Get the token string of the i-th token.
GetDataType
[public] Get the string data type. This is useful for determining whether this string is a candidate for cross referencing.
GetDataType
[public] Get the string data type of the i-th token. This is useful for determining whether this string is a candidate for cross referencing.
GetFileName
[public] Get the source file name.
GetFirst
[public] Get the first child node.
GetLevel
[public] Get the nesting level.
GetLineno
[public] Get the line number in the source file.
GetLongScopeName
[public] Get the long scope name, suitable for displaying in the package index.
GetLongScopeName
[public] Get the long scope name, suitable for displaying in the package index.
GetLongTypeName
[public] Get the long type name, suitable for displaying in the package index.
GetLongTypeName
[public] Get the long type name, suitable for displaying in the package index.
GetName
[public] Get the node name as a string.
GetNameId
[public] Get the name handle.
GetNext
[public] Get the next child node.
GetNumChildren
[public] Get the number of child nodes.
GetOffset
[public] Get the offset in the parent's child list.
GetParent
[public] Get the nodes parent. The root of the tree will have a NULL parent.
GetRecId
[public] Get the record id.
GetScope
[public] Get the node scope.
GetScope
[public] Get the node scope by name.
GetScopeName
[public] Get the 3 character internal scope name suitable for parsing from the ctf file.
GetScopeName
[public] Get the 3 character internal scope name suitable for parsing from the ctf file.
GetString
[public] Get the i-th token string. Use GetNumItems() to determine the total number of tokens.
GetType
[public] Get the node type.
GetType
[public] Get the node type by name.
GetTypeName
[public] Get the 3 character internal type name suitable for parsing from the ctf file.
GetTypeName
[public] Get the 3 character internal type name suitable for parsing from the ctf file.
Set
[public] Set the i-th token to the specified string.
Set
[public] Set the i-th token to the specified string handle.
SetChildIdx
[public] Set the child index. This is normally set in the constructor. It only needs to be changed when records are inserted into the parent child list.
SetRecId
[public] Set the unique record id. This should only be called by the CTF processing.
Walk
[public] Walk the tree recursively and call the specified function with the current node.


Constructors

CCcDocParserNode

public CCcDocParserNode ( STMT_TYPE type ,
                          CCcDocParserNode * parent ,
                          long lineno ) ;

Construct a root node with no tokens.

Parameters:
type The node type.
parent The parent node.
lineno The current line number.

CCcDocParserNode

public CCcDocParserNode ( STMT_TYPE type ,
                          CCcDocParserNode * parent ,
                          long lineno ,
                          const char * token ) ;

Construct a root node with a single token.

Parameters:
type The node type.
parent The parent node.
lineno The current line number.
token The token.

CCcDocParserNode

public CCcDocParserNode ( STMT_TYPE type ,
                          CCcDocParserNode * parent ,
                          long lineno ,
                          CJdlStringList & tokens ) ;

Construct a root node with a list of tokens.

Parameters:
type The node type.
parent The parent node.
lineno The current line number.
tokens The list of tokens.

CCcDocParserNode

public CCcDocParserNode ( CCcDocParserNode * parent ,
                          SCOPE_TYPE scope ,
                          STMT_TYPE type ,
                          ulong lineno ,
                          ulong level ,
                          ulong offset ,
                          ulong nameid ,
                          ulong recid ) ;

Construct a node from the CTF file. This assumes that the node has already been compiled.

Parameters:
parent The parent node.
scope The node scope.
type The node type.
lineno The file lineno.
level The node nesting level.
offset The node offset from the parent list.
nameid The node name reference.
recid The node record id.

CCcDocParserNode

public CCcDocParserNode ( CCcDocParserNode * parent ,
                          uint idx ,
                          const CCcDocParserNode * obj ) ;

Insert before copy constructor.

See Also:
CJdlVector

Parameters:
parent The parent node.
idx The index to insert before.
obj The object to copy from.

CCcDocParserNode

public ~ CCcDocParserNode ( ) ;

Destructor.


Enums

STMT_TYPE

public enum STMT_TYPE { STMT_ASM ,
                        STMT_CLASS ,
                        STMT_CLASS_CONSTRUCTOR ,
                        STMT_CLASS_DESTRUCTOR ,
                        STMT_CLASS_FORWARD ,
                        STMT_COMMENT_BRIEF ,
                        STMT_COMMENT_FULL ,
                        STMT_COMMENT_DIRECTIVE ,
                        STMT_COMMENT_DIRECTIVE_PKG ,
                        STMT_COMMENT_DIRECTIVE_PKGDOC ,
                        STMT_ENUM ,
                        STMT_FILE ,
                        STMT_FRIEND_CLASS ,
                        STMT_FRIEND_FUNCTION ,
                        STMT_FUNCTION ,
                        STMT_INCLUDE ,
                        STMT_MACRO ,
                        STMT_MACRO_INST ,
                        STMT_NAMESPACE ,
                        STMT_NAMESPACE_ALIAS ,
                        STMT_PRAGMA ,
                        STMT_SCOPE_PRIVATE ,
                        STMT_SCOPE_PROTECTED ,
                        STMT_SCOPE_PUBLIC ,
                        STMT_SCOPED_FUNCTION ,
                        STMT_SCOPED_TEMPLATE_FUNCTION ,
                        STMT_STRUCT ,
                        STMT_STRUCT_FORWARD ,
                        STMT_TEMPLATE_CLASS ,
                        STMT_TEMPLATE_FORWARD ,
                        STMT_TEMPLATE_FUNCTION ,
                        STMT_TYPEDEF ,
                        STMT_UNION ,
                        STMT_USING ,
                        STMT_VARIABLE ,
                        STMT_UNKNOWN } ;

The node statement type.

SCOPE_TYPE

public enum SCOPE_TYPE { SCOPE_GLOBAL ,
                         SCOPE_LOCAL ,
                         SCOPE_PUBLIC ,
                         SCOPE_PRIVATE ,
                         SCOPE_PROTECTED ,
                         SCOPE_UNKNOWN } ;

The node scope.

DATA_TYPE

public enum DATA_TYPE { DATA_ID ,
                        DATA_KEYWORD ,
                        DATA_RESERVED ,
                        DATA_UNKNOWN } ;

The node type.


Methods

GetFirst

public CCcDocParserNode * GetFirst ( ) ;

Get the first child node.

Return:
The first child node.

GetNext

public CCcDocParserNode * GetNext ( ) ;

Get the next child node.

Return:
The next child node, or NULL if it is at the end of the list.

GetChild

public CCcDocParserNode * GetChild ( ulong i ) const ;

Get the i-th child node.

Parameters:
i The node index.

Return:
The i-th child node.

GetNumChildren

public ulong GetNumChildren ( ) const ;

Get the number of child nodes.

Return:
The number of child nodes.

GetType

public STMT_TYPE GetType ( ) const ;

Get the node type.

Return:
The node type.

GetType

public static STMT_TYPE GetType ( const char * ) ;

Get the node type by name.

Parameters:
The short (3 char) type name.

Return:
The node type.

GetTypeName

public const char * GetTypeName ( ) const ;

Get the 3 character internal type name suitable for parsing from the ctf file.

Return:
The short type name.

GetTypeName

public static const char * GetTypeName ( STMT_TYPE type ) ;

Get the 3 character internal type name suitable for parsing from the ctf file.

Return:
The short type name.

GetLongTypeName

public const char * GetLongTypeName ( ) const ;

Get the long type name, suitable for displaying in the package index.

Return:
The long type name.

GetLongTypeName

public static const char * GetLongTypeName ( STMT_TYPE type ) ;

Get the long type name, suitable for displaying in the package index.

Parameters:
type The type.

Return:
The long type name.

GetScope

public SCOPE_TYPE GetScope ( ) const ;

Get the node scope.

Return:
The node scope.

GetScope

public static SCOPE_TYPE GetScope ( const char * name ) ;

Get the node scope by name.

Parameters:
The short (3 char) scope name.

Return:
The node scope.

GetScopeName

public const char * GetScopeName ( ) const ;

Get the 3 character internal scope name suitable for parsing from the ctf file.

Return:
The short scope name.

GetScopeName

public static const char * GetScopeName ( SCOPE_TYPE scope ) ;

Get the 3 character internal scope name suitable for parsing from the ctf file.

Return:
The short scope name.

GetLongScopeName

public const char * GetLongScopeName ( ) const ;

Get the long scope name, suitable for displaying in the package index.

Return:
The long scope name.

GetLongScopeName

public static const char * GetLongScopeName ( SCOPE_TYPE scope ) ;

Get the long scope name, suitable for displaying in the package index.

Parameters:
scope The scope.

Return:
The long scope name.

GetDataType

public static DATA_TYPE GetDataType ( const char * name ) ;

Get the string data type. This is useful for determining whether this string is a candidate for cross referencing.

Parameters:
name The string.

Return:
The node data type.

GetDataType

public DATA_TYPE GetDataType ( ulong idx ) const ;

Get the string data type of the i-th token. This is useful for determining whether this string is a candidate for cross referencing.

Parameters:
idx The index of the i-th token. The maximum number of tokens is GetNumItems().

Return:
The node data type.

GetDataString

public const char * GetDataString ( ulong idx ) const ;

Get the token string of the i-th token.

Parameters:
idx The index of the i-th token. The maximum number of tokens is GetNumItems().

Return:
The string.

Compile

public void Compile ( uint level = 0 ,
                      uint offset = 0 ,
                      SCOPE_TYPE scope = SCOPE_UNKNOWN ) ;

Compile a node tree. This should only be called for the root node.

Parameters:
level The current level.
offset The current offset in the parent list.
scope The default scope state.

Dump

public void Dump ( FILE * fp = stdout ,
                   const char * prefix = 0 ,
                   bool recurseFlag = true ) ;

Dump the contents of the node tree to a specified file.

Parameters:
fp The output file.
prefix The desired prefix.
recurseFlag If true, recurse otherwise only print this node and it's children.

Walk

public void Walk ( void ( * fct ) ( CCcDocParserNode * node , void * arg ) ,
                   void * arg ) ;

Walk the tree recursively and call the specified function with the current node.

Parameters:
fct The callback function.
arg A user supplied argument.

GetChildIdx

public ulong GetChildIdx ( ) const ;

Get the child offset from the parent.

Return:
The child offset from the parent.

GetRecId

public ulong GetRecId ( ) const ;

Get the record id.

Return:
The record id.

GetLevel

public ulong GetLevel ( ) const ;

Get the nesting level.

Return:
The nesting level.

GetOffset

public ulong GetOffset ( ) const ;

Get the offset in the parent's child list.

Return:
The offset.

GetLineno

public ulong GetLineno ( ) const ;

Get the line number in the source file.

Return:
The line number.

GetFileName

public const char * GetFileName ( ) const ;

Get the source file name.

Return:
The source file name.

GetNameId

public ulong GetNameId ( ) const ;

Get the name handle.

Return:
The handle to the node name.

GetName

public const char * GetName ( ) const ;

Get the node name as a string.

Return:
The node name.

GetParent

public CCcDocParserNode * GetParent ( ) const ;

Get the nodes parent. The root of the tree will have a NULL parent.

Return:
The parent node.

GetString

public const char * GetString ( ulong i ) const ;

Get the i-th token string. Use GetNumItems() to determine the total number of tokens.

Token strings are stored in a non-duplicated form using CCcDocStringRep which means that handles are required to convert them to strings. This was done to save memory.

Parameters:
i The i-th token.

Return:
The token string.

Append

public void Append ( ulong idx ) ;

Append a new handle to the token list.

Parameters:
idx The token handle.

Append

public void Append ( const char * str ) ;

Append a new string to the token list. The string is converted to a handle inside the append.

Parameters:
str The token.

Set

public void Set ( ulong idx ,
                  const char * str ) ;

Set the i-th token to the specified string.

Parameters:
idx The index.
str The new string.

Set

public void Set ( ulong idx ,
                  ulong id ) ;

Set the i-th token to the specified string handle.

Parameters:
idx The index.
str The new string handle.

Copy

public void Copy ( const CJdlStringList & list ) ;

Copy a token list. Each token is converted to its associated handle.

Parameters:
list The new token list.

Copy

public void Copy ( const CJdlVector < ulong > & list ) ;

Copy a token handle list.

Parameters:
list The new token list.

SetRecId

public void SetRecId ( ulong i ) ;

Set the unique record id. This should only be called by the CTF processing.

Parameters:
i The new id.

SetChildIdx

public void SetChildIdx ( ulong i ) ;

Set the child index. This is normally set in the constructor. It only needs to be changed when records are inserted into the parent child list.

Parameters:
i The new idx.

This documentation was generated automatically by the ccdoc tool (version 0.7a).
Click here to submit a bug report or feature request.

Click here to return to the top of the page.