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 Software Inc. 00009 * 123 Front Street West, Suite 1401 00010 * Toronto, Ontario 00011 * Canada M5J 2M2 00012 * 416-504-9876 00013 * 00014 * NAME: Utility Library (C++) 00015 * 00016 * COMMENTS: 00017 * This is a class template that implements a resizable array of 00018 * arbitrary objects. The template parameter represents the type 00019 * of object, and is called utPtr. You can instantiate this class 00020 * with any object or pointer, such as: 00021 * UT_PtrArray<GeoPoint*> pObj; 00022 */ 00023 00024 #ifndef __UT_PtrArray_h__ 00025 #define __UT_PtrArray_h__ 00026 00027 #include "UT_ValArray.h" 00028 00029 UT_API extern int UTcomparePointers(void *const* a, void *const* b); 00030 00031 // TODO: Do not add new methods to this class. The methods implemented 00032 // here are only provided for compatibility until we sweep the baseline to 00033 // use the UT_ValArray interface exclusively. 00034 template <typename T> 00035 class UT_PtrArray : public UT_ValArray<T> { 00036 public: 00037 UT_PtrArray(const UT_PtrArray<T> &a) 00038 : UT_ValArray<T>(a) {} 00039 explicit UT_PtrArray(unsigned int sz = 0) 00040 : UT_ValArray<T>(sz) {} 00041 00042 T removeLast() 00043 { 00044 if (UT_ValArray<T>::entries()) 00045 { 00046 T val = UT_ValArray<T>::last(); 00047 UT_ValArray<T>::removeLast(); 00048 return val; 00049 } 00050 return 0; 00051 } 00052 }; 00053 00054 typedef UT_PtrArray<const char *> UT_StringList; 00055 00056 #endif
1.5.9