[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - stlport/makefile.mk stlport/systemstl svx/source
Herbert Dürr
hdu at apache.org
Thu May 30 07:07:31 PDT 2013
stlport/makefile.mk | 3 +
stlport/systemstl/functional | 70 +++++++++++++++---------
stlport/systemstl/hash_map | 119 +++++++++++++++++++++++++++---------------
stlport/systemstl/hash_set | 88 ++++++++++++++++++++++++++-----
stlport/systemstl/numeric | 28 ++-------
stlport/systemstl/slist | 50 +++++++++++++++--
stlport/systemstl/vector | 36 +++++++++---
svx/source/svdraw/svdundo.cxx | 10 +++
8 files changed, 285 insertions(+), 119 deletions(-)
New commits:
commit 26b07b0562c1c47936dc10fd21a8bcb27077979f
Author: Herbert Dürr <hdu at apache.org>
Date: Thu May 30 14:01:24 2013 +0000
#i122208# update STL header wrappers
From a binary perspective the wrappers allow dropping stlport4 itself
immediately and replacing it by standard compliant system or compiler
standard template libraries.
From a source code perspective the other parts of the codebase
can remain untouched for now. They can be gradually converted
from stlport4 to the TR1 or C++11 standard at a comfortable pace
later. The header wrappers will assist this source-code conversion.
diff --git a/stlport/makefile.mk b/stlport/makefile.mk
index c58a07e..deb441e 100644
--- a/stlport/makefile.mk
+++ b/stlport/makefile.mk
@@ -46,6 +46,9 @@ $(INCCOM)$/stlport$/hash_map \
$(INCCOM)$/stlport$/hash_set \
$(INCCOM)$/stlport$/numeric \
$(INCCOM)$/stlport$/slist \
+$(INCCOM)$/stlport$/list \
+$(INCCOM)$/stlport$/map \
+$(INCCOM)$/stlport$/set \
$(INCCOM)$/stlport$/vector: systemstl$/$$(@:f)
$(MKDIRHIER) $(@:d)
$(COPY) $< $@
diff --git a/stlport/systemstl/functional b/stlport/systemstl/functional
index 5a2c395..9f7ad1b 100644
--- a/stlport/systemstl/functional
+++ b/stlport/systemstl/functional
@@ -22,35 +22,51 @@
#ifndef SYSTEM_STL_FUNCTIONAL
#define SYSTEM_STL_FUNCTIONAL
-#ifdef GCC
-# ifdef __MINGW32__
-# define _SYSTEM_STL_MAKE_HEADER(path,header) <path/header>
-# include _SYSTEM_STL_MAKE_HEADER(GXX_INCLUDE_PATH,functional)
-# else
-# include <ext/../functional>
-# endif
-# include <ext/functional>
+#if defined(HAVE_STL_INCLUDE_PATH)
+ // TODO: use computed include file name
+ #include_next <functional>
+#elif defined(_MSC_VER)
+ #include <../../VC/include/functional>
+ namespace std { using tr1::hash; }
+#if 1 // TODO: enable only when std::_Swap_adl is not available
+ // note: VS2008SP1 has known problems after a security update (KB971092,KB974479,KB974223)
+ namespace std{ template<class _T> void _Swap_adl(_T& l, _T& r) {swap(l,r);} }
+#endif
+#else // fall back to boost/tr1
+ #include <boost/tr1/tr1/functional>
+ #include <boost/functional/hash.hpp>
+#endif
+
+
+#ifndef NO_STLPORT4_EMULATION
namespace std
{
- using __gnu_cxx::project1st;
- using __gnu_cxx::project2nd;
- using __gnu_cxx::select1st;
- using __gnu_cxx::select2nd;
- using __gnu_cxx::compose1;
- using __gnu_cxx::compose2;
- using __gnu_cxx::unary_compose;
- using __gnu_cxx::binary_compose;
-# ifndef __GXX_EXPERIMENTAL_CXX0X__
- using __gnu_cxx::identity;
- using __gnu_cxx::mem_fun1;
- using __gnu_cxx::mem_fun1_ref;
-# endif
-}
-
-#else
-# error UNSUPPORTED COMPILER
-#endif
+// emulate SGI extensions to the STL using http://www.sgi.com/tech/stl/stl_function.h as reference
+template< typename T> struct identity : unary_function<T,T> { T operator()(const T& t) const { return t;} };
+template< typename T, typename U> struct project2nd : public binary_function<T,U,U> { U operator()(const T&, const U& u) const { return u;}};
+template<typename P> struct select1st : public unary_function<P, typename P::first_type> { const typename P::first_type& operator()(const P& p) const { return p.first; }};
+template<typename P> struct select2nd : public unary_function<P, typename P::second_type> { const typename P::second_type& operator()(const P& p) const { return p.second; }};
+
+#if (defined(_MSC_VER) && (_MSC_VER >= 1600)) || defined(__GXX_EXPERIMENTAL_CXX0X__)
+template<typename T> inline T&& forward( typename identity<T>::type&& t) { return t; }
+#endif // C++11 move semantics
+
+template<typename Op1, typename Op2> class unary_compose : public unary_function<typename Op2::argument_type, typename Op1::result_type>
+{
+protected:
+ Op1 aOp1;
+ Op2 aOp2;
+public:
+ unary_compose( const Op1& rOp1, const Op2& rOp2) : aOp1(rOp1), aOp2(rOp2) {}
+ typename Op1::result_type operator()( const typename Op2::argument_type& x) const { return aOp1(aOp2(x)); }
+};
+
+template<typename Op1, typename Op2> inline unary_compose<Op1,Op2> compose1( const Op1& rOp1, const Op2& rOp2) { return unary_compose<Op1,Op2>(rOp1, rOp2); }
+
+} // namespace std
+
+#endif // NO_STLPORT4_EMULATION
#endif
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
+
diff --git a/stlport/systemstl/hash_map b/stlport/systemstl/hash_map
index 61122aa..72b2700 100644
--- a/stlport/systemstl/hash_map
+++ b/stlport/systemstl/hash_map
@@ -22,54 +22,91 @@
#ifndef SYSTEM_STL_HASHMAP
#define SYSTEM_STL_HASHMAP
-#ifdef GCC
+#ifdef HAVE_STL_INCLUDE_PATH
+ // TODO: use computed include file name
+ #include_next <unordered_map>
+#elif defined(_MSC_VER)
+ #include <../../VC/include/unordered_map>
+ #define STLP4_EMUBASE_NS ::std::tr1
+#else // fall back to boost/tr1
+ #include <boost/tr1/tr1/unordered_map>
+ #define STLP4_EMUBASE_NS ::boost
+#endif
-# include <functional>
-# define _BACKWARD_BACKWARD_WARNING_H 1
-# include <ext/hash_map>
-# undef _BACKWARD_BACKWARD_WARNING_H
+#ifndef NO_STLPORT4_EMULATION
-namespace __gnu_cxx
+namespace std
{
- template<> struct hash < std::string >
- {
- size_t operator()(const std::string & x) const
- {
- return hash< const char* >()(x.c_str());
- }
- };
-
- template<> struct hash< long long int >
- {
- size_t operator()(long long int __x) const
- {
- return __x;
- }
- };
-
- template<> struct hash< unsigned long long int >
- {
- size_t operator()(unsigned long long int __x) const
- {
- return __x;
- }
- };
-}
+#ifdef STLP4_EMUBASE_NS
+ using STLP4_EMUBASE_NS::hash;
+ using STLP4_EMUBASE_NS::unordered_map;
+ using STLP4_EMUBASE_NS::unordered_multimap;
+ #undef STLP4_EMUBASE_NS
+#endif
-namespace std
+
+template<
+ typename __K,
+ typename __T,
+ typename __H = hash<__K>,
+ typename __E = equal_to<__K>,
+ typename __A = allocator<pair<__K,__T> > >
+class hash_map
+: public unordered_map<__K,__T,__H,__E,__A>
+{
+public:
+ typedef unordered_map<__K,__T,__H,__E,__A> _super;
+ typedef __T data_type;
+
+ hash_map( void) {}
+ hash_map( size_t n) : _super( n) {}
+
+#ifdef BOOST_TR1_UNORDERED_MAP_INCLUDED // workaround pre-BOOST_UNORDERED_USE_MOVE problem
+ // in derived classes the copy assignment operator can only be declared implicitly if
+ // its base class's assignment operator has the canonical signature.
+ // boost's assignment operators don't have this canonical signature when move-semantics are enabled
+ hash_map& operator=( const hash_map& r) { hash_map c(r); this->swap(c); return *this; }
+#endif
+
+ void resize( size_t n) { _super::rehash(n); }
+private:
+ // setting the hasher dynamically is not supported in the emulation!
+ hash_map( size_t, const __H&, const __E& rE=__E(), const __A& rA=__A()); // not implemented
+};
+
+template<
+ typename __K,
+ typename __T,
+ typename __H = hash<__K>,
+ typename __E = equal_to<__K>,
+ typename __A = allocator<pair<__K,__T> > >
+class hash_multimap
+: public unordered_multimap<__K,__T,__H,__E,__A>
{
-# ifndef __GXX_EXPERIMENTAL_CXX0X__
- using __gnu_cxx::hash;
-# endif
- using __gnu_cxx::hash_map;
- using __gnu_cxx::hash_multimap;
-}
-
-#else
-# error UNSUPPORTED COMPILER
+public:
+ typedef unordered_multimap<__K,__T,__H,__E,__A> _super;
+ typedef __T data_type;
+
+ hash_multimap( void) {}
+ hash_multimap( size_t n) : _super( n) {}
+
+#ifdef BOOST_TR1_UNORDERED_MAP_INCLUDED // workaround pre-BOOST_UNORDERED_USE_MOVE problem
+ // in derived classes the copy assignment operator can only be declared implicitly if
+ // its base class's assignment operator has the canonical signature.
+ // boost's assignment operators don't have this canonical signature when move-semantics are enabled
+ hash_multimap& operator=( const hash_multimap& r) { hash_multimap c(r); this->swap(c); return *this; }
#endif
+ void resize( size_t n) { _super::rehash(n); }
+private:
+ // setting the hasher dynamically is not supported in the emulation!
+ hash_multimap( size_t, const __H&, const __E& rE=__E(), const __A& rA=__A()); // not implemented
+};
+
+} // namespace std
+
+#endif // NO_STLPORT4_EMULATION
#endif
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
+
diff --git a/stlport/systemstl/hash_set b/stlport/systemstl/hash_set
index c4c0a89..7cbf797 100644
--- a/stlport/systemstl/hash_set
+++ b/stlport/systemstl/hash_set
@@ -22,25 +22,85 @@
#ifndef SYSTEM_STL_HASHSET
#define SYSTEM_STL_HASHSET
-#ifdef GCC
+#ifdef HAVE_STL_INCLUDE_PATH
+ // TODO: use computed include file name
+ #include_next <unordered_set>
+#elif defined(_MSC_VER)
+ #include <../../VC/include/unordered_set>
+ #define STLP4_EMUBASE_NS ::std::tr1
+#else // fall back to boost/tr1
+ #include <boost/tr1/tr1/unordered_set>
+ #define STLP4_EMUBASE_NS ::boost
+#endif
-# include <functional>
-# define _BACKWARD_BACKWARD_WARNING_H 1
-# include <ext/hash_set>
-# undef _BACKWARD_BACKWARD_WARNING_H
+#ifndef NO_STLPORT4_EMULATION
namespace std
{
-# ifndef __GXX_EXPERIMENTAL_CXX0X__
- using __gnu_cxx::hash;
-# endif
- using __gnu_cxx::hash_set;
- using __gnu_cxx::hash_multiset;
-}
-#else
-# error UNSUPPORTED COMPILER
+#ifdef STLP4_EMUBASE_NS
+ using STLP4_EMUBASE_NS::hash;
+ using STLP4_EMUBASE_NS::unordered_set;
+ using STLP4_EMUBASE_NS::unordered_multiset;
+ #undef STLP4_EMUBASE_NS
#endif
+
+template<
+ typename __K,
+ typename __H = hash<__K>,
+ typename __E = equal_to<__K>,
+ typename __A = allocator<__K> >
+class hash_set
+: public unordered_set<__K,__H,__E,__A>
+{
+ typedef unordered_set<__K,__H,__E,__A> _super;
+public:
+ hash_set( void) {}
+ hash_set( size_t n) : _super(n) {}
+ void resize( size_t n) { _super::rehash( n); }
+
+#ifdef BOOST_TR1_UNORDERED_SET_INCLUDED // workaround pre-BOOST_UNORDERED_USE_MOVE problem
+ // in derived classes the copy assignment operator can only be declared implicitly if
+ // its base class's assignment operator has the canonical signature.
+ // boost's assignment operators don't have this canonical signature when move-semantics are enabled
+ hash_set& operator=( const hash_set& r) { hash_set c(r); this->swap(c); return *this; }
#endif
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
+
+private:
+ // setting the hasher dynamically is not supported in the emulation!
+ hash_set( size_t, const __H&, const __E& rE=__E(), const __A& rA=__A()); // not implemented
+};
+
+template<
+ typename __K,
+ typename __H = hash<__K>,
+ typename __E = equal_to<__K>,
+ typename __A = allocator<__K> >
+class hash_multiset
+: public unordered_multiset<__K,__H,__E,__A>
+{
+ typedef unordered_multiset<__K,__H,__E,__A> _super;
+public:
+ hash_multiset( void) {}
+ hash_multiset( size_t n) : _super( n) {}
+ void resize( size_t n) { _super::rehash( n); }
+
+#ifdef BOOST_TR1_UNORDERED_SET_INCLUDED // workaround pre-BOOST_UNORDERED_USE_MOVE problem
+ // in derived classes the copy assignment operator can only be declared implicitly if
+ // its base class's assignment operator has the canonical signature.
+ // boost's assignment operators don't have this canonical signature when move-semantics are enabled
+ hash_multiset& operator=( const hash_multiset& r) { hash_multiset c(r); this->swap(c); return *this; }
+#endif
+
+private:
+ // setting the hasher dynamically is not supported in the emulation!
+ hash_multiset( size_t, const __H&, const __E& rE=__E(), const __A& rA=__A()); // not implemented
+};
+
+} // namespace std
+
+#endif // NO_STLPORT4_EMULATION
+
+#endif
+
diff --git a/stlport/systemstl/numeric b/stlport/systemstl/numeric
index 3e253f4..975612b 100644
--- a/stlport/systemstl/numeric
+++ b/stlport/systemstl/numeric
@@ -22,26 +22,14 @@
#ifndef SYSTEM_STL_NUMERIC
#define SYSTEM_STL_NUMERIC
-#ifdef GCC
-# include <functional>
-# ifdef __MINGW32__
-# define _SYSTEM_STL_MAKE_HEADER(path,header) <path/header>
-# include _SYSTEM_STL_MAKE_HEADER(GXX_INCLUDE_PATH,numeric)
-# else
-# include <ext/../numeric>
-# endif
-# include <ext/numeric>
-
-# ifndef __GXX_EXPERIMENTAL_CXX0X__
-namespace std
-{
- using __gnu_cxx::iota;
-}
-# endif
-
-#else
-# error UNSUPPORTED COMPILER
+#ifdef HAVE_STL_INCLUDE_PATH
+ // TODO: use computed include file name
+ #include_next <numeric>
+#elif defined(_MSC_VER)
+ #include <../../VC/include/numeric>
+#else // fall back to boost/tr1
+ #include <boost/tr1/tr1/numeric>
#endif
#endif
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
+
diff --git a/stlport/systemstl/slist b/stlport/systemstl/slist
index e345468..260983d 100644
--- a/stlport/systemstl/slist
+++ b/stlport/systemstl/slist
@@ -22,18 +22,54 @@
#ifndef SYSTEM_STL_SLIST
#define SYSTEM_STL_SLIST
-#ifdef GCC
+#ifdef HAVE_STL_INCLUDE_PATH
+ // TODO: use computed include file name
+ #include_next <forward_list>
+#elif defined(_MSC_VER)
+ #include <../../VC/include/list>
+ #define STLP4_SLIST_WITH_LIST
+ // MSVC's list would cause a lot of expression-result-unused warnings
+ // unless it is compiled in iterator-debugging mode. Silence this noise
+ #pragma warning(disable:4555)
+#else // fall back to boost/tr1 (forward_list or plain list)
+ #include <boost/config.hpp>
+ #ifndef BOOST_NO_0X_HDR_FORWARD_LIST
+ #include <boost/tr1/tr1/forward_list>
+ #else // fall back to the classic list
+ #include <boost/tr1/tr1/list>
+ #define STLP4_SLIST_WITH_LIST
+ #endif
+#endif
+
+
+#ifndef NO_STLPORT4_EMULATION
-#include <ext/slist>
+#ifndef STLP4_SLIST_WITH_LIST
+ #define STLP4_SLIST_EMUBASE std::forward_list
+#else
+ #define STLP4_SLIST_EMUBASE std::list
+#endif
namespace std
{
- using __gnu_cxx::slist;
-}
-#else
-#error UNSUPPORTED COMPILER
+using STLP4_SLIST_EMUBASE;
+
+// lame emulation of the pre-C++11 slist using the std::forward_list (or std::list)
+template< typename T, class A=allocator<T> >
+class slist : public STLP4_SLIST_EMUBASE<T,A>
+{
+public:
+ typedef typename STLP4_SLIST_EMUBASE<T,A> _super;
+ typedef typename _super::iterator slist_mit;
+ typedef typename _super::const_iterator slist_cit;
+#ifndef STLP4_SLIST_WITH_LIST
+ slist_mit insert( slist_cit aI, const T& rT) { return _super::insert_after( aI, rT); }
#endif
+};
+}
+
+#endif // NO_STLPORT4_EMULATION
#endif
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
+
diff --git a/stlport/systemstl/vector b/stlport/systemstl/vector
index 7f372d0..8b4e86f 100644
--- a/stlport/systemstl/vector
+++ b/stlport/systemstl/vector
@@ -22,22 +22,38 @@
#ifndef SYSTEM_STL_VECTOR
#define SYSTEM_STL_VECTOR
-#ifdef GCC
-
-#ifdef __MINGW32__
-# define _SYSTEM_STL_MAKE_HEADER(path,header) <path/header>
-# include _SYSTEM_STL_MAKE_HEADER(GXX_INCLUDE_PATH,vector)
-#else
-# include <ext/../vector>
+#ifdef HAVE_STL_INCLUDE_PATH
+ // TODO: use computed include file name
+ #include_next <vector>
+#elif defined(_MSC_VER)
+ #include <../../VC/include/vector>
+#else // fall back to boost/tr1
+ #include <boost/tr1/tr1/vector>
#endif
+
+#ifndef NO_STLPORT4_EMULATION
+
namespace std
{
- typedef vector<bool, std::allocator<bool> > bit_vector;
+ typedef vector<bool> bit_vector;
}
+// workaround some STL implementations having problems with their vector<bool>::count() specialization
+inline int std_bitset_count( std::bit_vector::const_iterator it, std::bit_vector::const_iterator itEnd, bool bValue)
+{
+#if 0 && defined(_LIBCPP___BIT_REFERENCE) // TODO: reenable for libc++ >= r156543/r156546/etc.
+ int nCount = std::count( it, itEnd, bValue);
#else
-#error UNSUPPORTED COMPILER
+ int nCount = 0;
+ for(; it != itEnd; ++it)
+ if( *it == bValue)
+ ++nCount;
#endif
+ return nCount;
+}
+
+#endif // NO_STLPORT4_EMULATION
+
#endif
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
+
commit d2c3483aa1c4fcce2678f9602d4204c908b4f874
Author: Armin Le Grand <alg at apache.org>
Date: Thu May 30 13:09:07 2013 +0000
i122410 extended Udo/Redo for text to broadcast
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index 5c40dda..2d8adb4 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -1168,6 +1168,11 @@ void SdrUndoObjSetText::Undo()
pObj->SetEmptyPresObj( bEmptyPresObj );
pObj->ActionChanged();
+
+ // #122410# SetOutlinerParaObject at SdrText does not trigger a
+ // BroadcastObjectChange, but it is needed to make evtl. SlideSorters
+ // update their preview.
+ pObj->BroadcastObjectChange();
}
void SdrUndoObjSetText::Redo()
@@ -1184,6 +1189,11 @@ void SdrUndoObjSetText::Redo()
pObj->ActionChanged();
+ // #122410# NbcSetOutlinerParaObjectForText at SdrTextObj does not trigger a
+ // BroadcastObjectChange, but it is needed to make evtl. SlideSorters
+ // update their preview.
+ pObj->BroadcastObjectChange();
+
// #94278# Trigger PageChangeCall
ImpShowPageOfThisObject();
}
More information about the Libreoffice-commits
mailing list