00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Cristin Barghiel 00008 * Side Effects 00009 * 477 Richmond Street West 00010 * Toronto, Ontario 00011 * Canada M5V 3E7 00012 * 416-504-9876 00013 * 00014 * NAME: GP_NodeList.h (C++) 00015 * 00016 * COMMENTS: paste nodes stored in a linked list structure 00017 * 00018 * 00019 */ 00020 00021 #ifndef __GP_NodeList_h__ 00022 #define __GP_NodeList_h__ 00023 00024 #include "GP_API.h" 00025 #include <UT/UT_LinkList.h> 00026 00027 class GP_NodeTree; 00028 class GP_Node; 00029 class gp_Node; 00030 00031 class GP_API GP_NodeList : public UT_LinkList 00032 { 00033 public: 00034 // Class c-tor and d-tor. 00035 GP_NodeList(void) { myCrt = 0; } 00036 GP_NodeList(const GP_NodeList &list); // shallow 00037 virtual ~GP_NodeList(void); // does a clear(), not a clearAndDestroy() 00038 00039 // Insert a node into the structure at the beginning or at the end. 00040 // No duplicate checking is done. 00041 void insert(const GP_Node &d); 00042 void append(const GP_Node &d); 00043 00044 // Remove a node from the structure and return its address if found. 00045 const GP_Node *remove(void); // removes last 00046 const GP_Node *remove(int key); 00047 const GP_Node *remove(const GP_Node &d); 00048 00049 // Search for a given node and return it if found. The search is by 00050 // key, so the address might differ. 00051 const GP_Node *find(int key) const; 00052 const GP_Node *find(const GP_Node &d) const; 00053 00054 // Inquire about a given node: 00055 int contains(int key) const; 00056 int contains(const GP_Node &d) const 00057 { 00058 return (find(d) != 0); 00059 } 00060 00061 // Clear the structure, or clear and destroy its GP_Node contents too: 00062 void clear(void) { UT_LinkList::clear(); } 00063 void clearAndDestroy(void); 00064 00065 // Iterate through the list. 00066 GP_Node *iterateInit(void); 00067 GP_Node *iterateNext(void); 00068 00069 // Convert the given tree to a *stack*, meaning that tree elements 00070 // are *inserted* rather than appended. 00071 GP_NodeList &operator=(const GP_NodeTree &tree); 00072 00073 // Simple assignment operator that first clears us, then copies the 00074 // nodes from source in a shallow manner (but our structure is unique). 00075 GP_NodeList &operator=(const GP_NodeList &list); 00076 00077 private: 00078 gp_Node *myCrt; 00079 }; 00080 00081 #endif
1.5.9