EPSCommentList Class Reference

Wraps up the EPSCommentDef structs into a list class. This will allow me to have a changeable list for different versions of the file, and as a result the whole importing of comments much less restrictive, but at the penalty of a speed hit. Looking up a token will be on O(n) operation, rather than the much quicker array look-up that currently exists. More...

#include <epsclist.h>

Inheritance diagram for EPSCommentList:

CCObject SimpleCCObject List of all members.

Public Member Functions

 EPSCommentList (void)
 Creates the class, and sets all the variables to be a default value.
 ~EPSCommentList (void)
 Destroys the class, and all of its member variables.
BOOL Add (TCHAR *pStart, TCHAR *pEnd, BOOL DoProcessComments, UINT32 NestingDepth)
 Adds a list item to the end of mpCommentList record.
const EPSCommentDefReturnElement (INT32 Index)
 Returns a reference to the nth item in the linked list, where n = Index.

Private Member Functions

 CC_DECLARE_DYNAMIC (EPSCommentList)

Private Attributes

EPSCommentDefmpCommentList
INT32 mListSize

Detailed Description

Wraps up the EPSCommentDef structs into a list class. This will allow me to have a changeable list for different versions of the file, and as a result the whole importing of comments much less restrictive, but at the penalty of a speed hit. Looking up a token will be on O(n) operation, rather than the much quicker array look-up that currently exists.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/4/00
See also:
EPSFilter

Definition at line 119 of file epsclist.h.


Constructor & Destructor Documentation

EPSCommentList::EPSCommentList void   ) 
 

Creates the class, and sets all the variables to be a default value.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/4/00
Parameters:
- [INPUTS]
Returns:
-
See also:
EPSCommentList::~EPSCommentList

Definition at line 117 of file epsclist.cpp.

00118 {
00119     // Set the comment list pointer to be NULL, so as to avoid any problems with adding
00120     // items to it.
00121     mpCommentList   = NULL;
00122     mListSize       = 0;
00123 }

EPSCommentList::~EPSCommentList void   ) 
 

Destroys the class, and all of its member variables.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/4/00
Parameters:
- [INPUTS]
Returns:
-
See also:
EPSCommentList::EPSCommentList

Definition at line 138 of file epsclist.cpp.

00139 {
00140     // Delete the list. This invokes a recursive call to remove all successive items.
00141     delete mpCommentList;
00142 }


Member Function Documentation

BOOL EPSCommentList::Add TCHAR pStart,
TCHAR pEnd,
BOOL  DoProcessComments,
UINT32  NestingDepth
 

Adds a list item to the end of mpCommentList record.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/4/00
Parameters:
pStart - Pointer to the comment starting a comment block. [INPUTS] pEnd - Pointer to the comment that ends this block. DoProcessComments - Do the comments need processing? NestingDepth - The depth to which comments can be nested.
Returns:
TRUE - Success. FALSE - The object was not created.
See also:
EPSCommentDef::EPSCommentDef

Definition at line 164 of file epsclist.cpp.

00168 {
00169     // Create a new EPSCommentDef, and assign the appropriate values.
00170     EPSCommentDef   *pNewDef    = new EPSCommentDef ( pStart, pEnd, DoProcessComments,
00171                                                       NestingDepth );
00172 
00173     // Determine whether something was created.
00174     if ( pNewDef != NULL )
00175     {
00176         // Add it to the end of the list.
00177         if ( mpCommentList == NULL )
00178         {
00179             // The pointer is NULL, so just assign the value.
00180             mpCommentList = pNewDef;
00181         }
00182         else
00183         {
00184             // There already is a list, so add this to it.
00185             mpCommentList->Add ( pNewDef );
00186         }
00187 
00188         // Maintain a count of the number of elements in the list.
00189         mListSize ++;
00190 
00191         return TRUE;
00192     }
00193     else
00194     {
00195         // Not enough memory.
00196         return FALSE;
00197     }
00198 }

EPSCommentList::CC_DECLARE_DYNAMIC EPSCommentList   )  [private]
 

const EPSCommentDef & EPSCommentList::ReturnElement INT32  Index  ) 
 

Returns a reference to the nth item in the linked list, where n = Index.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/5/00
Parameters:
Index - The number of the element to be accessed. [INPUTS]
Returns:
&pItem - A reference to an item in the list.

Definition at line 212 of file epsclist.cpp.

00213 {
00214     // Set up the local variables.
00215     EPSCommentDef   *pItem  = mpCommentList;
00216     EPSCommentDef   *pNext  = NULL;
00217     INT32               Count   = 0;
00218 
00219     // Ensure that the comment list has been initialised.
00220     ERROR1IF ( pItem == NULL, EmptyDefinition,
00221                "The comment list hasn't been initialised!" );
00222 
00223     // Catch out-of-bounds calls.
00224     if ( Index >= mListSize )
00225         return EmptyDefinition;
00226 
00227     // Loop through the list until there are no more items, or we reach the right index.
00228     while ( pNext = pItem->GetNext (), Count < Index && pNext != NULL )
00229     {
00230         pItem = pNext;
00231         Count ++;
00232     }
00233 
00234     // Return the appropriate list item.
00235     return *pItem;
00236 }


Member Data Documentation

INT32 EPSCommentList::mListSize [private]
 

Definition at line 139 of file epsclist.h.

EPSCommentDef* EPSCommentList::mpCommentList [private]
 

Definition at line 138 of file epsclist.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:53:59 2007 for Camelot by  doxygen 1.4.4