git-svn-id: svn://db.shs.com.ru/pip@806 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2019-06-23 11:21:46 +00:00
parent 3e36e6af8f
commit 8a2a9e1684
2 changed files with 31 additions and 35 deletions

View File

@@ -44,10 +44,10 @@
# define ADD_NEW_TO_COLLECTION(group, class)
#else
# define ADD_TO_COLLECTION(group, object) static PICollection::CollectionAdder __##group##_##__LINE__##_##adder##__(#group, object);
# define ADD_TO_COLLECTION_WITH_NAME(group, object, name) static PICollection::CollectionAdder __##group##_##__LINE__##_##adder##__(#group, object, #name);
# define ADD_NEW_TO_COLLECTION(group, class) static PICollection::CollectionAdder __##group##_##class##_##adder##__(#group, new class());
# define ADD_NEW_TO_COLLECTION_WITH_NAME(group, class, name) static PICollection::CollectionAdder __##group##_##class##_##adder##__(#group, new class(), #name);
# define ADD_TO_COLLECTION(group, object) static PICollection::CollectionAdder __##group##_##__LINE__##_##adder##__(#group, object, false);
# define ADD_TO_COLLECTION_WITH_NAME(group, object, name) static PICollection::CollectionAdder __##group##_##__LINE__##_##adder##__(#group, object, #name, false);
# define ADD_NEW_TO_COLLECTION(group, class) static PICollection::CollectionAdder __##group##_##class##_##adder##__(#group, new class(), true);
# define ADD_NEW_TO_COLLECTION_WITH_NAME(group, class, name) static PICollection::CollectionAdder __##group##_##class##_##adder##__(#group, new class(), #name, true);
#endif
class PIP_EXPORT PICollection
@@ -62,11 +62,11 @@ public:
//! \brief Returns all elements of group "group"
static PIVector<const PIObject * > groupElements(const PIString & group);
static void addToGroup(const PIString & group, const PIObject * element);
static bool addToGroup(const PIString & group, const PIObject * element);
class CollectionAdder {
public:
CollectionAdder(const PIString & group, const PIObject * element, const PIString & name = PIString());
CollectionAdder(const PIString & group, const PIObject * element, const PIString & name = PIString(), bool own = false);
};
protected:
@@ -77,20 +77,8 @@ protected:
PIVector<const PIObject * > elements;
};
static PIVector<Group> * _groups;
static PIVector<Group> & _groups();
};
class PIP_EXPORT __PICollectionInitializer {
public:
__PICollectionInitializer() {
if (_inited_) return;
_inited_ = true;
PICollection::_groups = new PIVector<PICollection::Group>();
}
static bool _inited_;
};
static __PICollectionInitializer __picollectioninitializer;
#endif // PICOLLECTION_H