Kaydet (Commit) 834cbda1 authored tarafından Noel Grandin's avatar Noel Grandin

move SvRefMemberList into idl

since it's only usage is there

Change-Id: I882ddd3e08ab37cf7b3cca8121463598ea3d3bc4
üst 67466a19
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <bastype.hxx> #include <bastype.hxx>
#include <tools/pstm.hxx> #include <tools/pstm.hxx>
#include <functional> #include <functional>
#include <vector>
class SvTokenStream; class SvTokenStream;
class SvMetaObject; class SvMetaObject;
class SvIdlDataBase; class SvIdlDataBase;
...@@ -32,6 +34,54 @@ typedef SvMetaObject * (*CreateMetaObjectType)(); ...@@ -32,6 +34,54 @@ typedef SvMetaObject * (*CreateMetaObjectType)();
#define C_PREF "C_" #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 SvMetaObjectMemberList : public SvRefMemberList<SvMetaObject *> {};
class SvMetaObject : public SvRttiBase class SvMetaObject : public SvRttiBase
......
...@@ -20,11 +20,8 @@ ...@@ -20,11 +20,8 @@
#define INCLUDED_TOOLS_REF_HXX #define INCLUDED_TOOLS_REF_HXX
#include <sal/config.h> #include <sal/config.h>
#include <cassert> #include <cassert>
#include <tools/toolsdllapi.h> #include <tools/toolsdllapi.h>
#include <vector>
/** /**
This implements similar functionality to boost::intrusive_ptr This implements similar functionality to boost::intrusive_ptr
...@@ -92,55 +89,6 @@ protected: ...@@ -92,55 +89,6 @@ protected:
} }
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;
}
};
/** Classes that want to be referenced-counted via SvRef<T>, should extend this base class */ /** Classes that want to be referenced-counted via SvRef<T>, should extend this base class */
class TOOLS_DLLPUBLIC SvRefBase class TOOLS_DLLPUBLIC SvRefBase
{ {
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <calcmacros.hxx> #include <calcmacros.hxx>
#include <svl/listener.hxx> #include <svl/listener.hxx>
#include <vector>
class ScFormulaCell; class ScFormulaCell;
class ScDocument; class ScDocument;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <svl/listener.hxx> #include <svl/listener.hxx>
#include <unordered_map> #include <unordered_map>
#include <vector>
class ScRangeList; class ScRangeList;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "scdllapi.h" #include "scdllapi.h"
#include <set> #include <set>
#include <vector>
namespace sc { namespace sc {
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <xmloff/xmlictxt.hxx> #include <xmloff/xmlictxt.hxx>
#include <xmloff/txtimp.hxx> #include <xmloff/txtimp.hxx>
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <vector>
namespace com { namespace sun { namespace star { namespace com { namespace sun { namespace star {
namespace xml { namespace sax { class XAttributeList; } } namespace xml { namespace sax { class XAttributeList; } }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment