diff options
author | Noel Grandin <noel@peralex.com> | 2015-10-27 09:53:18 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-10-27 11:25:34 +0200 |
commit | 834cbda1ec3f8b4fd5e64da4f8ff2f9072e35989 (patch) | |
tree | 1412a39545598b004ae8751ffc2ed2f90f538746 /idl/inc | |
parent | 67466a19752d73540e13697b91ca58429f6a64ac (diff) |
move SvRefMemberList into idl
since it's only usage is there
Change-Id: I882ddd3e08ab37cf7b3cca8121463598ea3d3bc4
Diffstat (limited to 'idl/inc')
-rw-r--r-- | idl/inc/basobj.hxx | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/idl/inc/basobj.hxx b/idl/inc/basobj.hxx index bb788d5c6853..b4b9178c557c 100644 --- a/idl/inc/basobj.hxx +++ b/idl/inc/basobj.hxx @@ -24,6 +24,8 @@ #include <bastype.hxx> #include <tools/pstm.hxx> #include <functional> +#include <vector> + class SvTokenStream; class SvMetaObject; class SvIdlDataBase; @@ -32,6 +34,54 @@ typedef SvMetaObject * (*CreateMetaObjectType)(); #define C_PREF "C_" +template<typename T> +class SvRefMemberList : private std::vector<T> +{ +private: + typedef typename std::vector<T> base_t; + +public: + using base_t::size; + using base_t::front; + using base_t::back; + using base_t::operator[]; + using base_t::begin; + using base_t::end; + using typename base_t::iterator; + using typename base_t::const_iterator; + using base_t::rbegin; + using base_t::rend; + using typename base_t::reverse_iterator; + using base_t::empty; + + inline ~SvRefMemberList() { clear(); } + inline void clear() + { + for( typename base_t::const_iterator it = base_t::begin(); it != base_t::end(); ++it ) + { + T p = *it; + if( p ) + p->ReleaseRef(); + } + base_t::clear(); + } + + inline void push_back( T p ) + { + base_t::push_back( p ); + p->AddFirstRef(); + } + + inline T pop_back() + { + T p = base_t::back(); + base_t::pop_back(); + if( p ) + p->ReleaseRef(); + return p; + } +}; + class SvMetaObjectMemberList : public SvRefMemberList<SvMetaObject *> {}; class SvMetaObject : public SvRttiBase |