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 * Side Effects Software Inc. 00008 * 477 Richmond Street West, Suite 1001 00009 * Toronto, Ontario 00010 * Canada M5V 3E7 00011 * 416-504-9876 00012 */ 00013 00014 #ifndef __SIM_RelationshipArray_h__ 00015 #define __SIM_RelationshipArray_h__ 00016 00017 #include "SIM_API.h" 00018 #include <UT/UT_PtrArraySorted.h> 00019 #include "SIM_Data.h" 00020 00021 class UT_String; 00022 class SIM_Relationship; 00023 00024 /// Holds pointers to a number of SIM_Relationships. 00025 class SIM_API SIM_RelationshipArray : 00026 public UT_PtrArraySorted<SIM_Relationship *> 00027 { 00028 public: 00029 SIM_RelationshipArray(); 00030 virtual ~SIM_RelationshipArray(); 00031 00032 /// Change the supplied name to make it different from any other 00033 /// relationship in this array. 00034 void forceUniqueRelationshipName(UT_String &name) const; 00035 00036 /// Find the relationship with the specified name. 00037 SIM_Relationship *findRelationshipByName(const char *name) const; 00038 00039 /// Find the position of the relationship with the specified name. 00040 int findRelationshipPosByName(const char *name) const; 00041 00042 /// Get all relationships of a particular type. Note that the filter 00043 /// is applied to the SIM_RelationshipData subdata of the 00044 /// SIM_Relationship, not to the SIM_Relationship itself. 00045 void filter(const SIM_DataFilter &filter, 00046 SIM_DataArray &rels) const; 00047 00048 /// Get const pointers to all relationships of a particular type. 00049 /// As with filter(), the SIM_DataFilter is applied to the 00050 /// SIM_RelationshipData subdata, not the SIM_Relationship itself. 00051 void filterConst(const SIM_DataFilter &filter, 00052 SIM_ConstDataArray &rels) const; 00053 00054 /// Function for sorting pointers according to the relationship name. 00055 static int compareRelationshipNames(SIM_Relationship * const*, 00056 SIM_Relationship * const*); 00057 }; 00058 00059 #endif 00060
1.5.9