[Libreoffice-commits] core.git: basctl/source bridges/source hwpfilter/inc hwpfilter/source include/o3tl mysqlc/source o3tl/CppunitTest_o3tl_tests.mk o3tl/qa o3tl/README sc/inc sc/source tools/inc tools/source
Stephan Bergmann
sbergman at redhat.com
Wed Sep 24 05:55:25 PDT 2014
basctl/source/basicide/bastype2.cxx | 20 +-
basctl/source/basicide/bastype2.hxx | 8
basctl/source/basicide/moduldl2.cxx | 4
basctl/source/basicide/moduldlg.cxx | 8
bridges/source/jni_uno/jni_bridge.cxx | 6
bridges/source/jni_uno/jni_data.cxx | 16 -
bridges/source/jni_uno/jni_helper.h | 6
bridges/source/jni_uno/jni_uno2java.cxx | 4
hwpfilter/inc/pch/precompiled_hwp.hxx | 1
hwpfilter/source/hwpreader.cxx | 4
include/o3tl/heap_ptr.hxx | 283 ------------------------------
mysqlc/source/mysqlc_statement.cxx | 10 -
o3tl/CppunitTest_o3tl_tests.mk | 1
o3tl/README | 3
o3tl/qa/test-heap_ptr.cxx | 157 ----------------
sc/inc/pch/precompiled_scfilt.hxx | 1
sc/source/filter/oox/revisionfragment.cxx | 7
tools/inc/pch/precompiled_tl.hxx | 1
tools/source/fsys/urlobj.cxx | 6
19 files changed, 59 insertions(+), 487 deletions(-)
New commits:
commit 9703cc63cea3c47d13afe5f9b0eb22c631000958
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Sep 24 14:54:51 2014 +0200
Remove o3tl/heap_ptr.hxx, use std::unique_ptr instead
Change-Id: Iac70c9be13892a36bfb5975f62e5345b88d4f144
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index 4c9f52a..42f7b0d 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -41,6 +41,8 @@
#include <sfx2/dispatch.hxx>
#include <cassert>
+#include <memory>
+
#include <com/sun/star/script/ModuleType.hpp>
#include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
@@ -246,7 +248,7 @@ void TreeListBox::ScanEntry( const ScriptDocument& rDocument, LibraryLocation eL
OUString aRootName( GetRootEntryName( rDocument, eLocation ) );
Image aImage;
GetRootEntryBitmaps( rDocument, aImage );
- o3tl::heap_ptr<Entry> e(new DocumentEntry(rDocument, eLocation));
+ std::unique_ptr<Entry> e(new DocumentEntry(rDocument, eLocation));
AddEntry(
aRootName,
aImage,
@@ -309,7 +311,7 @@ void TreeListBox::ImpCreateLibEntries( SvTreeListEntry* pDocumentRootEntry, cons
}
else
{
- o3tl::heap_ptr<Entry> e(new Entry(OBJ_TYPE_LIBRARY));
+ std::unique_ptr<Entry> e(new Entry(OBJ_TYPE_LIBRARY));
AddEntry(
aLibName,
Image( IDEResId( nId ) ),
@@ -345,7 +347,7 @@ void TreeListBox::ImpCreateLibSubEntries( SvTreeListEntry* pLibRootEntry, const
SvTreeListEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE );
if ( !pModuleEntry )
{
- o3tl::heap_ptr<Entry> e(new Entry(OBJ_TYPE_MODULE));
+ std::unique_ptr<Entry> e(new Entry(OBJ_TYPE_MODULE));
pModuleEntry = AddEntry(
aModName,
Image( IDEResId( RID_IMG_MODULE ) ),
@@ -365,7 +367,7 @@ void TreeListBox::ImpCreateLibSubEntries( SvTreeListEntry* pLibRootEntry, const
SvTreeListEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
if ( !pEntry )
{
- o3tl::heap_ptr<Entry> e(
+ std::unique_ptr<Entry> e(
new Entry(OBJ_TYPE_METHOD));
pEntry = AddEntry(
aName,
@@ -404,7 +406,7 @@ void TreeListBox::ImpCreateLibSubEntries( SvTreeListEntry* pLibRootEntry, const
SvTreeListEntry* pDialogEntry = FindEntry( pLibRootEntry, aDlgName, OBJ_TYPE_DIALOG );
if ( !pDialogEntry )
{
- o3tl::heap_ptr<Entry> e(new Entry(OBJ_TYPE_DIALOG));
+ std::unique_ptr<Entry> e(new Entry(OBJ_TYPE_DIALOG));
pDialogEntry = AddEntry(
aDlgName,
Image( IDEResId( RID_IMG_DIALOG ) ),
@@ -443,7 +445,7 @@ void TreeListBox::ImpCreateLibSubEntriesInVBAMode( SvTreeListEntry* pLibRootEntr
}
else
{
- o3tl::heap_ptr<Entry> e(new Entry(eType));
+ std::unique_ptr<Entry> e(new Entry(eType));
AddEntry(
aEntryName,
Image( IDEResId( RID_IMG_MODLIB ) ),
@@ -505,7 +507,7 @@ void TreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvTreeListEntry* pLibSubRo
SvTreeListEntry* pModuleEntry = FindEntry( pLibSubRootEntry, aEntryName, OBJ_TYPE_MODULE );
if ( !pModuleEntry )
{
- o3tl::heap_ptr<Entry> e(new Entry(OBJ_TYPE_MODULE));
+ std::unique_ptr<Entry> e(new Entry(OBJ_TYPE_MODULE));
pModuleEntry = AddEntry(
aEntryName,
Image( IDEResId( RID_IMG_MODULE ) ),
@@ -525,7 +527,7 @@ void TreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvTreeListEntry* pLibSubRo
SvTreeListEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
if ( !pEntry )
{
- o3tl::heap_ptr<Entry> e(new Entry(OBJ_TYPE_METHOD));
+ std::unique_ptr<Entry> e(new Entry(OBJ_TYPE_METHOD));
pEntry = AddEntry(
aName,
Image( IDEResId( RID_IMG_MACRO ) ),
@@ -740,7 +742,7 @@ SvTreeListEntry* TreeListBox::AddEntry(
const Image& rImage,
SvTreeListEntry* pParent,
bool bChildrenOnDemand,
- o3tl::heap_ptr<Entry> * aUserData
+ std::unique_ptr<Entry> * aUserData
)
{
assert(aUserData != 0);
diff --git a/basctl/source/basicide/bastype2.hxx b/basctl/source/basicide/bastype2.hxx
index 0eac7b8..b9913cf 100644
--- a/basctl/source/basicide/bastype2.hxx
+++ b/basctl/source/basicide/bastype2.hxx
@@ -19,9 +19,11 @@
#ifndef INCLUDED_BASCTL_SOURCE_BASICIDE_BASTYPE2_HXX
#define INCLUDED_BASCTL_SOURCE_BASICIDE_BASTYPE2_HXX
-#include "doceventnotifier.hxx"
+#include <sal/config.h>
+
+#include <memory>
-#include <o3tl/heap_ptr.hxx>
+#include "doceventnotifier.hxx"
#include <svtools/treelistbox.hxx>
#include <svl/lstner.hxx>
@@ -232,7 +234,7 @@ public:
SvTreeListEntry* AddEntry(
const OUString& rText, const Image& rImage,
SvTreeListEntry* pParent, bool bChildrenOnDemand,
- o3tl::heap_ptr<Entry> * aUserData
+ std::unique_ptr<Entry> * aUserData
);
void RemoveEntry (SvTreeListEntry*);
void RemoveEntry (ScriptDocument const&);
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index a889ca2..0428182 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -64,6 +64,8 @@
#include <com/sun/star/script/ModuleSizeExceededRequest.hpp>
#include <cassert>
+#include <memory>
+
#include <boost/scoped_ptr.hpp>
namespace basctl
@@ -1508,7 +1510,7 @@ void createLibImpl( vcl::Window* pWin, const ScriptDocument& rDocument,
sal_uInt16 nMode = pBasicBox->GetMode();
bool bDlgMode = ( nMode & BROWSEMODE_DIALOGS ) && !( nMode & BROWSEMODE_MODULES );
sal_uInt16 nId = bDlgMode ? RID_IMG_DLGLIB : RID_IMG_MODLIB;
- o3tl::heap_ptr<Entry> e(new Entry(OBJ_TYPE_LIBRARY));
+ std::unique_ptr<Entry> e(new Entry(OBJ_TYPE_LIBRARY));
SvTreeListEntry* pNewLibEntry = pBasicBox->AddEntry(
aLibName,
Image( IDEResId( nId ) ),
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index 7f63592..9269d47 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <memory>
+
#include "baside2.hrc"
#include "basidesh.hrc"
@@ -843,7 +847,7 @@ void ObjectPage::NewDialog()
SvTreeListEntry* pEntry = m_pBasicBox->FindEntry( pLibEntry, aDlgName, OBJ_TYPE_DIALOG );
if ( !pEntry )
{
- o3tl::heap_ptr<Entry> e(new Entry(OBJ_TYPE_DIALOG));
+ std::unique_ptr<Entry> e(new Entry(OBJ_TYPE_DIALOG));
pEntry = m_pBasicBox->AddEntry(
aDlgName,
Image( IDEResId( RID_IMG_DIALOG ) ),
@@ -999,7 +1003,7 @@ SbModule* createModImpl( vcl::Window* pWin, const ScriptDocument& rDocument,
SvTreeListEntry* pEntry = rBasicBox.FindEntry( pSubRootEntry, aModName, OBJ_TYPE_MODULE );
if ( !pEntry )
{
- o3tl::heap_ptr<Entry> e(new Entry(OBJ_TYPE_MODULE));
+ std::unique_ptr<Entry> e(new Entry(OBJ_TYPE_MODULE));
pEntry = rBasicBox.AddEntry(
aModName,
Image( IDEResId( RID_IMG_MODULE ) ),
diff --git a/bridges/source/jni_uno/jni_bridge.cxx b/bridges/source/jni_uno/jni_bridge.cxx
index ed71b69..ee382e5 100644
--- a/bridges/source/jni_uno/jni_bridge.cxx
+++ b/bridges/source/jni_uno/jni_bridge.cxx
@@ -20,12 +20,12 @@
#include <sal/config.h>
#include <cassert>
+#include <memory>
#include "jni_bridge.h"
#include <boost/static_assert.hpp>
#include "jvmaccess/unovirtualmachine.hxx"
-#include "o3tl/heap_ptr.hxx"
#include "rtl/ref.hxx"
#include "rtl/strbuf.hxx"
#include "uno/lbnames.h"
@@ -310,7 +310,7 @@ void JNI_context::java_exc_occurred() const
}
jsize len = m_env->GetStringLength( (jstring) jo_descr.get() );
- o3tl::heap_ptr< rtl_mem > ustr_mem(
+ std::unique_ptr< rtl_mem > ustr_mem(
rtl_mem::allocate(
sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) ) );
rtl_uString * ustr = (rtl_uString *)ustr_mem.get();
@@ -386,7 +386,7 @@ OUString JNI_context::get_stack_trace( jobject jo_exc ) const
{
jsize len =
m_env->GetStringLength( (jstring) jo_stack_trace.get() );
- o3tl::heap_ptr< rtl_mem > ustr_mem(
+ std::unique_ptr< rtl_mem > ustr_mem(
rtl_mem::allocate(
sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) ) );
rtl_uString * ustr = (rtl_uString *)ustr_mem.get();
diff --git a/bridges/source/jni_uno/jni_data.cxx b/bridges/source/jni_uno/jni_data.cxx
index 6025484..81a1ca3 100644
--- a/bridges/source/jni_uno/jni_data.cxx
+++ b/bridges/source/jni_uno/jni_data.cxx
@@ -20,10 +20,10 @@
#include <sal/config.h>
#include <cassert>
+#include <memory>
#include "jni_bridge.h"
-#include "o3tl/heap_ptr.hxx"
#include "rtl/strbuf.hxx"
#include "uno/sequence2.h"
@@ -35,7 +35,7 @@ namespace jni_uno
inline rtl_mem * seq_allocate( sal_Int32 nElements, sal_Int32 nSize )
{
- o3tl::heap_ptr< rtl_mem > seq(
+ std::unique_ptr< rtl_mem > seq(
rtl_mem::allocate( SAL_SEQUENCE_HEADER_SIZE + (nElements * nSize) ) );
uno_Sequence * p = (uno_Sequence *)seq.get();
p->nRefCount = 1;
@@ -127,7 +127,7 @@ void createDefaultUnoValue(
case typelib_TypeClass_SEQUENCE:
{
- o3tl::heap_ptr< rtl_mem > seq(seq_allocate(0, 0));
+ std::unique_ptr< rtl_mem > seq(seq_allocate(0, 0));
if (assign) {
uno_type_destructData(uno_data, type, 0);
}
@@ -561,7 +561,7 @@ void Bridge::map_to_uno(
}
else
{
- o3tl::heap_ptr< rtl_mem > mem(
+ std::unique_ptr< rtl_mem > mem(
rtl_mem::allocate( sizeof (sal_Int64) ) );
*(jlong *) mem.get() = jni->CallLongMethodA(
java_data.l, m_jni_info->m_method_Long_longValue, 0 );
@@ -579,7 +579,7 @@ void Bridge::map_to_uno(
}
else
{
- o3tl::heap_ptr< rtl_mem > mem(
+ std::unique_ptr< rtl_mem > mem(
rtl_mem::allocate( sizeof (float) ) );
*(jfloat *) mem.get() = jni->CallFloatMethodA(
java_data.l, m_jni_info->m_method_Float_floatValue, 0 );
@@ -599,7 +599,7 @@ void Bridge::map_to_uno(
}
else
{
- o3tl::heap_ptr< rtl_mem > mem(
+ std::unique_ptr< rtl_mem > mem(
rtl_mem::allocate( sizeof (double) ) );
*(jdouble *) mem.get() =
jni->CallDoubleMethodA(
@@ -630,7 +630,7 @@ void Bridge::map_to_uno(
case typelib_TypeClass_STRUCT:
case typelib_TypeClass_EXCEPTION:
{
- o3tl::heap_ptr< rtl_mem > mem(
+ std::unique_ptr< rtl_mem > mem(
rtl_mem::allocate( value_td.get()->nSize ) );
map_to_uno(
jni, mem.get(), java_data, value_td.get()->pWeakRef, 0,
@@ -972,7 +972,7 @@ void Bridge::map_to_uno(
typelib_TypeDescriptionReference * element_type =
((typelib_IndirectTypeDescription *)td.get())->pType;
- o3tl::heap_ptr< rtl_mem > seq;
+ std::unique_ptr< rtl_mem > seq;
sal_Int32 nElements = jni->GetArrayLength( (jarray) java_data.l );
switch (element_type->eTypeClass)
diff --git a/bridges/source/jni_uno/jni_helper.h b/bridges/source/jni_uno/jni_helper.h
index ce16b6c..1c67992 100644
--- a/bridges/source/jni_uno/jni_helper.h
+++ b/bridges/source/jni_uno/jni_helper.h
@@ -20,7 +20,9 @@
#ifndef INCLUDED_BRIDGES_SOURCE_JNI_UNO_JNI_HELPER_H
#define INCLUDED_BRIDGES_SOURCE_JNI_UNO_JNI_HELPER_H
-#include <o3tl/heap_ptr.hxx>
+#include <sal/config.h>
+
+#include <memory>
#include "jni_base.h"
#include "jni_info.h"
@@ -39,7 +41,7 @@ inline void jstring_to_ustring(
else
{
jsize len = jni->GetStringLength( jstr );
- o3tl::heap_ptr< rtl_mem > mem(
+ std::unique_ptr< rtl_mem > mem(
rtl_mem::allocate(
sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) ) );
rtl_uString * ustr = (rtl_uString *)mem.get();
diff --git a/bridges/source/jni_uno/jni_uno2java.cxx b/bridges/source/jni_uno/jni_uno2java.cxx
index 6c03564..337b245 100644
--- a/bridges/source/jni_uno/jni_uno2java.cxx
+++ b/bridges/source/jni_uno/jni_uno2java.cxx
@@ -20,8 +20,8 @@
#include <sal/config.h>
#include <cassert>
+#include <memory>
-#include <o3tl/heap_ptr.hxx>
#include <sal/alloca.h>
#include "com/sun/star/uno/RuntimeException.hpp"
@@ -95,7 +95,7 @@ void Bridge::handle_java_exc(
+ jni.get_stack_trace( jo_exc.get() ) );
}
- o3tl::heap_ptr< rtl_mem > uno_data( rtl_mem::allocate( td.get()->nSize ) );
+ std::unique_ptr< rtl_mem > uno_data( rtl_mem::allocate( td.get()->nSize ) );
jvalue val;
val.l = jo_exc.get();
map_to_uno(
diff --git a/hwpfilter/inc/pch/precompiled_hwp.hxx b/hwpfilter/inc/pch/precompiled_hwp.hxx
index b495dad..f149f13 100644
--- a/hwpfilter/inc/pch/precompiled_hwp.hxx
+++ b/hwpfilter/inc/pch/precompiled_hwp.hxx
@@ -25,7 +25,6 @@
#include <list>
#include <locale.h>
#include <math.h>
-#include <o3tl/heap_ptr.hxx>
#include <osl/diagnose.h>
#include <sal/config.h>
#include <sal/macros.h>
diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx
index d79b8f5..ec305db 100644
--- a/hwpfilter/source/hwpreader.cxx
+++ b/hwpfilter/source/hwpreader.cxx
@@ -18,6 +18,7 @@
*/
#include <deque>
+#include <memory>
#include <boost/shared_ptr.hpp>
@@ -25,7 +26,6 @@
#include <math.h>
#include <comphelper/newarray.hxx>
-#include <o3tl/heap_ptr.hxx>
#include "fontmap.hxx"
#include "formula.h"
@@ -131,7 +131,7 @@ sal_Bool HwpReader::filter(const Sequence< PropertyValue >& rDescriptor) throw(R
Reference< XInputStream > xInputStream(
aDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM()], UNO_QUERY_THROW);
- o3tl::heap_ptr<HStream> stream(new HStream);
+ std::unique_ptr<HStream> stream(new HStream);
Sequence < sal_Int8 > aBuffer;
sal_Int32 nRead, nBlock = 32768, nTotal = 0;
while( true )
diff --git a/include/o3tl/heap_ptr.hxx b/include/o3tl/heap_ptr.hxx
deleted file mode 100644
index eca82a7..0000000
--- a/include/o3tl/heap_ptr.hxx
+++ /dev/null
@@ -1,283 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_O3TL_HEAP_PTR_HXX
-#define INCLUDED_O3TL_HEAP_PTR_HXX
-
-
-#include <boost/assert.hpp>
-#include <boost/checked_delete.hpp>
-#include <sal/types.h>
-
-namespace o3tl
-{
-/** heap_ptr<> owns an object on the heap, which will be automatically
- deleted, when ~heap_ptr<>() is called.
-
- Applicability
- -------------
- heap_ptr<> can be used for class members on the heap.
- - One cannot forget to delete them in the destructor.
- - Constness will be transferred from the owning instance.
-
- heap_ptr<> can also be used as smart pointer in function bodies to
- ensure exception safety.
-
- Special Characteristics
- -----------------------
- - heap_ptr<> transfers constness from the owning object to
- the pointed to object. Such it behaves like if *get() would be
- a normal member of the owning object, not a pointer member.
- This is preferable to the normal pointer behaviour, because
- if an object is owned by another one, it is normally part of
- its state.
-
- - heap_ptr<> provides a ->release() function
-
- - For reasons of simplicity and portability ->is()
- is preferred over the safe-bool idiom.
-
- Copyability
- -----------
- heap_ptr is non copyable.
- - It forbids the copyconstructor and operator=(self).
-
- - Owning classes will automatically be non copyable, if they do not
- redefine those two functions themselves.
-
- Incomplete Types
- ----------------
- heap_ptr<> also works with incomplete types. You only need to write
- class T;
- but need not include <T>.hxx.
-
- If you use heap_ptr<> with an incomplete type, the owning class
- needs to define a non-inline destructor. Else the compiler will
- complain.
-*/
-template <class T, class Deleter = boost::checked_deleter<T> >
-class SAL_WARN_UNUSED heap_ptr
-{
- public:
- typedef T element_type; /// Provided for generic programming.
- typedef heap_ptr<T, Deleter> self;
-
- typedef T * (self::* safe_bool )();
-
- /// Now, pass_heapObject is owned by this.
- explicit heap_ptr(
- T * pass_heapObject = 0 );
- ~heap_ptr();
-
-
- /** Identical to reset(), except of the return value.
- @see heap_ptr<>::reset()
- */
- self & operator=(
- T * pass_heapObject );
- const T & operator*() const;
- T & operator*();
- const T * operator->() const;
- T * operator->();
-
- operator safe_bool() const;
-
- /** This deletes any prevoiusly existing ->pHeapObject.
- Now, pass_heapObject, if != 0, is owned by this.
-
- @onerror
- Ignores self-assignment.
- Such, multiple assignment of the same pointer to the same
- instance of heap_ptr<> is possible (though not recommended).
- */
- void reset(
- T * pass_heapObject );
- /** @return An object on the heap that must be deleted by the caller,
- or 0.
-
- @postcond get() == 0;
- */
- T * release();
- void swap(
- self & io_other );
-
- /// True, if pHeapObject != 0.
- bool is() const;
- const T * get() const;
- T * get();
-
- private:
- // Forbidden functions:
- heap_ptr( const self & ); /// Prevent copies.
- self & operator=( const self & ); /// Prevent copies.
-
- /// @attention Does not set ->pHeapObject = 0.
- void internal_delete();
-
- // DATA
- /// Will be deleted, when *this is destroyed.
- T * pHeapObject;
-};
-
-
-/** Supports the semantic of std::swap(). Provided as an aid to
- generic programming.
-*/
-template<class T, class Deleter>
-inline void
-swap( heap_ptr<T, Deleter> & io_a,
- heap_ptr<T, Deleter> & io_b )
-{
- io_a.swap(io_b);
-}
-
-
-
-// IMPLEMENTATION
-
-template <class T, class Deleter>
-inline void
-heap_ptr<T, Deleter>::internal_delete()
-{
- ::boost::checked_delete(pHeapObject);
-
- // Do not set pHeapObject to 0, because
- // that is reset to a value in all code
- // where internal_delete() is used.
-}
-
-template <class T, class Deleter>
-inline
-heap_ptr<T, Deleter>::heap_ptr( T * pass_heapObject )
- : pHeapObject(pass_heapObject)
-{
-}
-
-template <class T, class Deleter>
-inline
-heap_ptr<T, Deleter>::~heap_ptr()
-{
- internal_delete();
-}
-
-template <class T, class Deleter>
-inline heap_ptr<T, Deleter> &
-heap_ptr<T, Deleter>::operator=(T * pass_heapObject)
-{
- reset(pass_heapObject);
- return *this;
-}
-
-template <class T, class Deleter>
-inline const T &
-heap_ptr<T, Deleter>::operator*() const
-{
- BOOST_ASSERT( pHeapObject != 0
- && "Accessing a heap_ptr<>(0)." );
- return *pHeapObject;
-}
-
-template <class T, class Deleter>
-inline T &
-heap_ptr<T, Deleter>::operator*()
-{
- BOOST_ASSERT( pHeapObject != 0
- && "Accessing a heap_ptr<>(0)." );
- return *pHeapObject;
-}
-
-template <class T, class Deleter>
-inline const T *
-heap_ptr<T, Deleter>::operator->() const
-{
- return pHeapObject;
-}
-
-template <class T, class Deleter>
-inline T *
-heap_ptr<T, Deleter>::operator->()
-{
- return pHeapObject;
-}
-
-template <class T, class Deleter>
-inline
-heap_ptr<T, Deleter>::operator typename heap_ptr<T, Deleter>::safe_bool() const
-{
- return is()
- ? safe_bool(&self::get)
- : safe_bool(0);
-}
-
-template <class T, class Deleter>
-void
-heap_ptr<T, Deleter>::reset(T * pass_heapObject)
-{
- if ( pHeapObject != 0
- && pHeapObject == pass_heapObject)
- return;
-
- internal_delete();
- pHeapObject = pass_heapObject;
-}
-
-template <class T, class Deleter>
-T *
-heap_ptr<T, Deleter>::release()
-{
- T * ret = pHeapObject;
- pHeapObject = 0;
- return ret;
-}
-
-template <class T, class Deleter>
-void
-heap_ptr<T, Deleter>::swap(self & io_other)
-{
- T * temp = io_other.pHeapObject;
- io_other.pHeapObject = pHeapObject;
- pHeapObject = temp;
-}
-
-template <class T, class Deleter>
-inline bool
-heap_ptr<T, Deleter>::is() const
-{
- return pHeapObject != 0;
-}
-
-template <class T, class Deleter>
-inline const T *
-heap_ptr<T, Deleter>::get() const
-{
- return pHeapObject;
-}
-
-template <class T, class Deleter>
-inline T *
-heap_ptr<T, Deleter>::get()
-{
- return pHeapObject;
-}
-
-
-} // namespace o3tl
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/mysqlc/source/mysqlc_statement.cxx b/mysqlc/source/mysqlc_statement.cxx
index 60cc7f6..87ec8c5 100644
--- a/mysqlc/source/mysqlc_statement.cxx
+++ b/mysqlc/source/mysqlc_statement.cxx
@@ -16,7 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+
+#include <sal/config.h>
+
+#include <memory>
#include <stdio.h>
+
#include "mysqlc_connection.hxx"
#include "mysqlc_propertyids.hxx"
#include "mysqlc_resultset.hxx"
@@ -32,7 +37,6 @@
#include <cppconn/exception.h>
#include <cppconn/statement.h>
#include <cppuhelper/typeprovider.hxx>
-#include <o3tl/heap_ptr.hxx>
#include <osl/diagnose.h>
#include <osl/thread.h>
@@ -180,7 +184,7 @@ Reference< XResultSet > SAL_CALL OCommonStatement::executeQuery(const OUString&
Reference< XResultSet > xResultSet;
try {
- o3tl::heap_ptr< sql::ResultSet > rset(cppStatement->executeQuery(OUStringToOString(sSqlStatement, m_pConnection->getConnectionEncoding()).getStr()));
+ std::unique_ptr< sql::ResultSet > rset(cppStatement->executeQuery(OUStringToOString(sSqlStatement, m_pConnection->getConnectionEncoding()).getStr()));
xResultSet = new OResultSet(this, rset.get(), m_pConnection->getConnectionEncoding());
rset.release();
} catch (const sql::SQLException &e) {
@@ -286,7 +290,7 @@ Reference< XResultSet > SAL_CALL OCommonStatement::getResultSet()
Reference< XResultSet > xResultSet;
try {
- o3tl::heap_ptr< sql::ResultSet > rset(cppStatement->getResultSet());
+ std::unique_ptr< sql::ResultSet > rset(cppStatement->getResultSet());
xResultSet = new OResultSet(this, rset.get(), m_pConnection->getConnectionEncoding());
rset.release();
} catch (const sql::SQLException &e) {
diff --git a/o3tl/CppunitTest_o3tl_tests.mk b/o3tl/CppunitTest_o3tl_tests.mk
index c1d8215..a4d6d71 100644
--- a/o3tl/CppunitTest_o3tl_tests.mk
+++ b/o3tl/CppunitTest_o3tl_tests.mk
@@ -29,7 +29,6 @@ $(eval $(call gb_CppunitTest_use_libraries,o3tl_tests,\
$(eval $(call gb_CppunitTest_add_exception_objects,o3tl_tests,\
o3tl/qa/cow_wrapper_clients \
o3tl/qa/test-cow_wrapper \
- o3tl/qa/test-heap_ptr \
o3tl/qa/test-range \
o3tl/qa/test-vector_pool \
o3tl/qa/test-sorted_vector \
diff --git a/o3tl/README b/o3tl/README
index 4823d60..de46c85 100644
--- a/o3tl/README
+++ b/o3tl/README
@@ -11,9 +11,6 @@ to boost, but isn't as of now)."
[git:o3tl/inc/o3tl/cow_wrapper.hxx]
A copy-on-write wrapper.
-[git:o3tl/inc/o3tl/heap_ptr.hxx]
-heap_ptr<> owns an object on the heap, which will be automatically deleted, when ~heap_ptr<>() is called.
-
[git:o3tl/inc/o3tl/lazy_update.hxx]
This template collects data in input type, and updates the output type with the given update functor,
but only if the output is requested. Useful if updating is expensive, or input changes frequently, but
diff --git a/o3tl/qa/test-heap_ptr.cxx b/o3tl/qa/test-heap_ptr.cxx
deleted file mode 100644
index 4fbfe19..0000000
--- a/o3tl/qa/test-heap_ptr.cxx
+++ /dev/null
@@ -1,157 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <sal/types.h>
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
-
-#include <o3tl/heap_ptr.hxx>
-
-using o3tl::heap_ptr;
-
-class Help
-{
- public:
- explicit Help(
- int i_n )
- : n(i_n) { ++nInstanceCount_; }
- ~Help() { --nInstanceCount_; }
- int Value() const { return n; }
- static int InstanceCount_() { return nInstanceCount_; }
-
- private:
- int n;
- static int nInstanceCount_;
-};
-int Help::nInstanceCount_ = 0;
-
-
-class heap_ptr_test : public CppUnit::TestFixture
-{
- public:
- void global()
- {
- // Construction
- heap_ptr<Help>
- t_empty;
- const heap_ptr<Help>
- t0( new Help(7000) );
- heap_ptr<Help>
- t1( new Help(10) );
- heap_ptr<Help>
- t2( new Help(20) );
-
- int nHelpCount = 3;
-
- CPPUNIT_ASSERT_MESSAGE("ctor1", ! t_empty.is());
- CPPUNIT_ASSERT_MESSAGE("ctor2", t0.is());
- CPPUNIT_ASSERT_MESSAGE("ctor3", (*t0).Value() == 7000 );
- CPPUNIT_ASSERT_MESSAGE("ctor4", t0->Value() == 7000 );
- CPPUNIT_ASSERT_MESSAGE("ctor5", t0.get() == t0.operator->() );
- CPPUNIT_ASSERT_MESSAGE("ctor6", t0.get() == &(*t0) );
-
- CPPUNIT_ASSERT_MESSAGE("ctor7", t1.is());
- CPPUNIT_ASSERT_MESSAGE("ctor8", (*t1).Value() == 10 );
- CPPUNIT_ASSERT_MESSAGE("ctor9", t1->Value() == 10 );
- CPPUNIT_ASSERT_MESSAGE("ctor10", t1.get() == t1.operator->() );
- CPPUNIT_ASSERT_MESSAGE("ctor11", t1.get() == &(*t1) );
-
- CPPUNIT_ASSERT_MESSAGE("ctor12", t2.operator*().Value() == 20);
- CPPUNIT_ASSERT_MESSAGE("ctor13", Help::InstanceCount_() == nHelpCount);
-
-
- // Operator safe_bool() / bool()
- CPPUNIT_ASSERT_MESSAGE("bool1", ! t_empty);
- CPPUNIT_ASSERT_MESSAGE("bool2", t0);
- CPPUNIT_ASSERT_MESSAGE("bool3", t1.is() == static_cast<bool>(t1));
-
-
- // Assignment, reset() and release()
- // Release
- Help * hp = t1.release();
- CPPUNIT_ASSERT_MESSAGE("release1", ! t1.is() );
- CPPUNIT_ASSERT_MESSAGE("release2", t1.get() == 0 );
- CPPUNIT_ASSERT_MESSAGE("release3", t1.operator->() == 0 );
- CPPUNIT_ASSERT_MESSAGE("release4", Help::InstanceCount_() == nHelpCount);
-
- // operator=()
- t_empty = hp;
- CPPUNIT_ASSERT_MESSAGE("assign1", t_empty.is() );
- CPPUNIT_ASSERT_MESSAGE("assign2", Help::InstanceCount_() == nHelpCount);
-
- t1 = t_empty.release();
- CPPUNIT_ASSERT_MESSAGE("assign3", t1.is() );
- CPPUNIT_ASSERT_MESSAGE("assign4", ! t_empty.is() );
- CPPUNIT_ASSERT_MESSAGE("assign5", Help::InstanceCount_() == nHelpCount);
-
- // reset()
- hp = new Help(30);
- ++nHelpCount;
-
- t_empty.reset(hp);
- CPPUNIT_ASSERT_MESSAGE("reset1", Help::InstanceCount_() == nHelpCount);
- CPPUNIT_ASSERT_MESSAGE("reset2", t_empty.is() );
- CPPUNIT_ASSERT_MESSAGE("reset3", t_empty.get() == hp );
-
- // Ignore second assignment
- t_empty = hp;
- CPPUNIT_ASSERT_MESSAGE("selfassign1", Help::InstanceCount_() == nHelpCount);
- CPPUNIT_ASSERT_MESSAGE("selfassign2", t_empty.is() );
- CPPUNIT_ASSERT_MESSAGE("selfassign3", t_empty.get() == hp );
-
- t_empty.reset(0);
- hp = 0;
- --nHelpCount;
- CPPUNIT_ASSERT_MESSAGE("reset4", ! t_empty.is() );
- CPPUNIT_ASSERT_MESSAGE("reset5", Help::InstanceCount_() == nHelpCount);
-
-
- // swap
- t1.swap(t2);
- CPPUNIT_ASSERT_MESSAGE("swap1", t1->Value() == 20 );
- CPPUNIT_ASSERT_MESSAGE("swap2", t2->Value() == 10 );
- CPPUNIT_ASSERT_MESSAGE("swap3", Help::InstanceCount_() == nHelpCount);
-
- o3tl::swap(t1,t2);
- CPPUNIT_ASSERT_MESSAGE("swap4", t1->Value() == 10 );
- CPPUNIT_ASSERT_MESSAGE("swap5", t2->Value() == 20 );
- CPPUNIT_ASSERT_MESSAGE("swap6", Help::InstanceCount_() == nHelpCount);
-
- // RAII
- {
- heap_ptr<Help>
- t_raii( new Help(55) );
- (void)t_raii;
- CPPUNIT_ASSERT_MESSAGE("raii1", Help::InstanceCount_() == nHelpCount + 1);
- }
- CPPUNIT_ASSERT_MESSAGE("raii2", Help::InstanceCount_() == nHelpCount);
- }
-
-
- // These macros are needed by auto register mechanism.
- CPPUNIT_TEST_SUITE(heap_ptr_test);
- CPPUNIT_TEST(global);
- CPPUNIT_TEST_SUITE_END();
-}; // class heap_ptr_test
-
-
-CPPUNIT_TEST_SUITE_REGISTRATION(heap_ptr_test);
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/pch/precompiled_scfilt.hxx b/sc/inc/pch/precompiled_scfilt.hxx
index cb2efd7..40a09ab 100644
--- a/sc/inc/pch/precompiled_scfilt.hxx
+++ b/sc/inc/pch/precompiled_scfilt.hxx
@@ -354,7 +354,6 @@
#include <map>
#include <math.h>
#include <memory>
-#include <o3tl/heap_ptr.hxx>
#include <officecfg/Office/Calc.hxx>
#include <officecfg/Setup.hxx>
#include <officecfg/System.hxx>
diff --git a/sc/source/filter/oox/revisionfragment.cxx b/sc/source/filter/oox/revisionfragment.cxx
index c8c1f14..cab30a3 100644
--- a/sc/source/filter/oox/revisionfragment.cxx
+++ b/sc/source/filter/oox/revisionfragment.cxx
@@ -7,11 +7,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <sal/config.h>
+
+#include <memory>
+
#include <revisionfragment.hxx>
#include <oox/core/relations.hxx>
#include <oox/core/xmlfilterbase.hxx>
#include <oox/core/fastparser.hxx>
-#include <o3tl/heap_ptr.hxx>
#include <svl/sharedstringpool.hxx>
#include <sax/tools/converter.hxx>
#include <editeng/editobj.hxx>
@@ -248,7 +251,7 @@ void RevisionHeadersFragment::onEndElement()
void RevisionHeadersFragment::finalizeImport()
{
ScDocument& rDoc = getScDocument();
- o3tl::heap_ptr<ScChangeTrack> pCT(new ScChangeTrack(&rDoc));
+ std::unique_ptr<ScChangeTrack> pCT(new ScChangeTrack(&rDoc));
OUString aSelfUser = pCT->GetUser(); // owner of this document.
pCT->SetUseFixDateTime(true);
diff --git a/tools/inc/pch/precompiled_tl.hxx b/tools/inc/pch/precompiled_tl.hxx
index 2101b0c..c74b9b8 100644
--- a/tools/inc/pch/precompiled_tl.hxx
+++ b/tools/inc/pch/precompiled_tl.hxx
@@ -49,7 +49,6 @@
#include <list>
#include <math.h>
#include <new>
-#include <o3tl/heap_ptr.hxx>
#include <osl/diagnose.h>
#include <osl/endian.h>
#include <osl/file.hxx>
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 91fffad..7e248a2 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -20,7 +20,6 @@
#include <sal/config.h>
#include <boost/checked_delete.hpp>
-#include <o3tl/heap_ptr.hxx>
#include <tools/urlobj.hxx>
#include <tools/debug.hxx>
#include <tools/inetmime.hxx>
@@ -39,6 +38,7 @@
#include <algorithm>
#include <limits>
+#include <memory>
#include <string.h>
@@ -586,10 +586,10 @@ void INetURLObject::setInvalid()
namespace {
SvMemoryStream * memoryStream(void const * data, sal_Int32 length) {
- o3tl::heap_ptr<char, boost::checked_array_deleter<char> > b(
+ std::unique_ptr<char, boost::checked_array_deleter<char> > b(
new char[length]);
memcpy(b.get(), data, length);
- o3tl::heap_ptr<SvMemoryStream> s(
+ std::unique_ptr<SvMemoryStream> s(
new SvMemoryStream(b.get(), length, STREAM_READ));
s->ObjectOwnsMemory(true);
b.release();
More information about the Libreoffice-commits
mailing list