00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __GB_ElemList_h__
00021 #define __GB_ElemList_h__
00022
00023 #include "GB_API.h"
00024 #include <UT/UT_PtrArray.h>
00025 #include "GB_Element.h"
00026
00027 class GB_Group;
00028
00029 class GB_API GB_ElementList : public UT_PtrArray<GB_Element *>
00030 {
00031 public:
00032 GB_ElementList(unsigned size = 0) : UT_PtrArray<GB_Element *>(size) {}
00033 virtual ~GB_ElementList();
00034
00035
00036
00037
00038 void clearAndDestroy() { resize(0); }
00039
00040 #ifdef METROWERKS_BUILD
00041 GB_Element *rawEntry(unsigned n) const
00042 { return n >= entries() ? 0 : (*this)(n); }
00043
00044 GB_Element *rawHead() const { return rawEntry(0); }
00045 GB_Element *rawHead(const GB_Group &group) const;
00046
00047 GB_Element *rawNext(const GB_Element *item) const
00048 { return rawEntry((unsigned)(item->getNum()+1)); }
00049 GB_Element *rawNext(const GB_Element *item, const GB_Group &group) const;
00050
00051 GB_Element *rawTail() const { return entries() ? last() : 0; }
00052 GB_Element *rawTail(const GB_Group &group) const;
00053
00054 GB_Element *rawPrev(const GB_Element *item) const
00055 { return rawEntry((unsigned)(item->getNum()-1)); }
00056 GB_Element *rawPrev(const GB_Element *item, const GB_Group &group) const;
00057 #else
00058 const GB_Element *rawEntry(unsigned n) const
00059 { return n >= entries() ? 0 : (*this)(n); }
00060 GB_Element *rawEntry(unsigned n)
00061 { return n >= entries() ? 0 : (*this)(n); }
00062
00063 const GB_Element *rawHead() const { return rawEntry(0); }
00064 GB_Element *rawHead() { return rawEntry(0); }
00065 const GB_Element *rawHead(const GB_Group &group) const;
00066 GB_Element *rawHead(const GB_Group &group);
00067
00068 const GB_Element *rawNext(const GB_Element *item) const
00069 { return rawEntry(item->getNum()+1); }
00070 GB_Element *rawNext(GB_Element *item)
00071 { return rawEntry(item->getNum()+1); }
00072 const GB_Element *rawNext(const GB_Element *, const GB_Group &) const;
00073 GB_Element *rawNext(GB_Element *item, const GB_Group &group);
00074
00075 const GB_Element *rawTail() const { return entries() ? last() : 0; }
00076 GB_Element *rawTail() { return entries() ? last() : 0; }
00077 const GB_Element *rawTail(const GB_Group &group) const;
00078 GB_Element *rawTail(const GB_Group &group);
00079
00080 const GB_Element *rawPrev(const GB_Element *item) const
00081 { return rawEntry(item->getNum()-1); }
00082 GB_Element *rawPrev(GB_Element *item)
00083 { return rawEntry(item->getNum()-1); }
00084 const GB_Element *rawPrev(const GB_Element *, const GB_Group &) const;
00085 GB_Element *rawPrev(GB_Element *item, const GB_Group &group);
00086 #endif
00087 int rawHeadMix(const GB_Group &group,
00088 const GB_Element *&elem,
00089 const GB_Element *&sec) const;
00090
00091 int rawNextMix(const GB_Group &group,
00092 const GB_Element *&elem,
00093 const GB_Element *&sec,
00094 const GB_Element *&newelem,
00095 const GB_Element *&newsec)
00096 const;
00097
00098 int rawTailMix(const GB_Group &group,
00099 const GB_Element *&elem,
00100 const GB_Element *&sec) const;
00101
00102 int rawPrevMix(const GB_Group &group,
00103 const GB_Element *&elem,
00104 const GB_Element *&sec,
00105 const GB_Element *&newelem,
00106 const GB_Element *&newsec)
00107 const;
00108
00109 };
00110
00111 #endif