diff options
Diffstat (limited to 'o3tl')
-rw-r--r-- | o3tl/inc/o3tl/compat_functional.hxx | 151 | ||||
-rw-r--r-- | o3tl/inc/o3tl/cow_wrapper.hxx | 3 | ||||
-rw-r--r-- | o3tl/inc/o3tl/heap_ptr.hxx | 3 | ||||
-rw-r--r-- | o3tl/inc/o3tl/lazy_update.hxx | 3 | ||||
-rw-r--r-- | o3tl/inc/o3tl/range.hxx | 3 | ||||
-rw-r--r-- | o3tl/inc/o3tl/vector_pool.hxx | 6 | ||||
-rw-r--r-- | o3tl/prj/d.lst | 4 | ||||
-rw-r--r-- | o3tl/qa/cow_wrapper_clients.cxx | 3 | ||||
-rw-r--r-- | o3tl/qa/cow_wrapper_clients.hxx | 3 | ||||
-rw-r--r-- | o3tl/qa/makefile.mk | 8 | ||||
-rw-r--r-- | o3tl/qa/test-cow_wrapper.cxx | 5 | ||||
-rw-r--r-- | o3tl/qa/test-heap_ptr.cxx | 5 | ||||
-rw-r--r-- | o3tl/qa/test-range.cxx | 5 | ||||
-rw-r--r-- | o3tl/qa/test-vector_pool.cxx | 5 |
14 files changed, 189 insertions, 18 deletions
diff --git a/o3tl/inc/o3tl/compat_functional.hxx b/o3tl/inc/o3tl/compat_functional.hxx new file mode 100644 index 000000000000..00ae33cb23bb --- /dev/null +++ b/o3tl/inc/o3tl/compat_functional.hxx @@ -0,0 +1,151 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* + * Lifted and paraphrased from STLport - with additions from Fridrich + * Strba and Thorsten Behrens + */ + +#ifndef INCLUDED_O3TL_COMPAT_FUNCTIONAL_HXX +#define INCLUDED_O3TL_COMPAT_FUNCTIONAL_HXX + +#include <functional> + +namespace o3tl +{ + +/// Identity functor - return the input value +template<class T> +struct identity : public std::unary_function<T, T> +{ + T operator()(const T& y) const + { + return (y); + } +}; + +/// Functor, given two parameters, return the first +template<class T1,class T2> +struct project1st : public std::binary_function<T1, T2, T1> +{ + T1 operator()(const T1& y, const T2&) const + { + return (y); + } +}; + +/// Functor, given two parameters, return the second +template<class T1,class T2> +struct project2nd : public std::binary_function<T1, T2, T2> +{ + T2 operator()(const T1&, const T2& x) const + { + return (x); + } +}; + +/// Select first value of a pair +template<class P> +struct select1st : public std::unary_function<P, typename P::first_type> +{ + const typename P::first_type& operator()(const P& y) const + { + return (y.first); + } +}; + +/// Select second value of a pair +template<class P> +struct select2nd : public std::unary_function<P, typename P::second_type> +{ + const typename P::second_type& operator()(const P& y) const + { + return (y.second); + } +}; + +/// Call F1 with the result of F2 applied to the one input parameter +template<class F1, class F2> +class unary_compose : public std::unary_function<typename F2::argument_type, typename F1::result_type> +{ + public: + unary_compose(const F1& fnction1, const F2& fnction2) : ftor1(fnction1), ftor2(fnction2) {} + + typename F1::result_type operator()(const typename F2::argument_type& y) const + { + return (ftor1(ftor2(y))); + } + + protected: + F1 ftor1; + F2 ftor2; +}; + +/// Create functor that calls F1 with the result of F2 applied to the one input parameter +template<class F1, class F2> +inline unary_compose<F1, F2> compose1(const F1& fnction1, const F2& fnction2) +{ + return (unary_compose<F1, F2>(fnction1, fnction2)); +} + +/// Calls F2 and F3 for the two args of F1, respectively +template<class F1, class F2, class F3> +class binary_compose : public std::unary_function<typename F2::argument_type,typename F1::result_type> +{ + public: + binary_compose(const F1& fnction1, const F2& fnction2, const F3& fnction3) : ftor1(fnction1), ftor2(fnction2), ftor3(fnction3) {} + + typename F1::result_type operator()(const typename F2::argument_type& y) const + { + return (ftor1(ftor2(y), ftor3(y))); + } + + protected: + F1 ftor1; + F2 ftor2; + F3 ftor3; +}; + +/// Creates functor that calls F2 and F3 for the two args of F1, respectively +template<class F1, class F2, class F3> +inline binary_compose<F1, F2, F3> compose2(const F1& fnction1, const F2& fnction2, const F3& fnction3) +{ + return (binary_compose<F1, F2, F3>(fnction1, fnction2, fnction3)); +} + +/// Algo that assigns val, val+1, ... to the given range +template<typename FwdIter, typename ValueType> +inline void iota(FwdIter first, FwdIter last, ValueType val) +{ + while(first != last) + *first++ = val++; +} + +} // namespace o3tl + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/o3tl/inc/o3tl/cow_wrapper.hxx b/o3tl/inc/o3tl/cow_wrapper.hxx index 9f9248922917..143905a1ab89 100644 --- a/o3tl/inc/o3tl/cow_wrapper.hxx +++ b/o3tl/inc/o3tl/cow_wrapper.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -326,3 +327,5 @@ void cow_wrapper_client::queryUnmodified() const } #endif /* INCLUDED_O3TL_COW_WRAPPER_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/o3tl/inc/o3tl/heap_ptr.hxx b/o3tl/inc/o3tl/heap_ptr.hxx index 581a2062fa5a..3fe1e1c6e541 100644 --- a/o3tl/inc/o3tl/heap_ptr.hxx +++ b/o3tl/inc/o3tl/heap_ptr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -309,3 +310,5 @@ heap_ptr<T>::get() } // namespace o3tl #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/o3tl/inc/o3tl/lazy_update.hxx b/o3tl/inc/o3tl/lazy_update.hxx index 92c434772afb..08c7b12375c1 100644 --- a/o3tl/inc/o3tl/lazy_update.hxx +++ b/o3tl/inc/o3tl/lazy_update.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -269,3 +270,5 @@ output( myValue.getOutValue() ); } #endif /* INCLUDED_O3TL_LAZY_UPDATE_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/o3tl/inc/o3tl/range.hxx b/o3tl/inc/o3tl/range.hxx index a4519b881fa8..633415ca4b47 100644 --- a/o3tl/inc/o3tl/range.hxx +++ b/o3tl/inc/o3tl/range.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -187,3 +188,5 @@ range<T>::distance_to(const self & i_other) const } // namespace o3tl #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/o3tl/inc/o3tl/vector_pool.hxx b/o3tl/inc/o3tl/vector_pool.hxx index 19fc3d6d74c4..28be1e199202 100644 --- a/o3tl/inc/o3tl/vector_pool.hxx +++ b/o3tl/inc/o3tl/vector_pool.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: lazy_update.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -130,3 +128,5 @@ myPool.free(nIdx); } #endif /* INCLUDED_O3TL_VECTOR_POOL_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/o3tl/prj/d.lst b/o3tl/prj/d.lst index c15d38d1ca02..f0090a5d0ee7 100644 --- a/o3tl/prj/d.lst +++ b/o3tl/prj/d.lst @@ -1,2 +1,2 @@ -mkdir: %_DEST%\inc%_EXT%\o3tl -..\inc\o3tl\*.hxx %_DEST%\inc%_EXT%\o3tl\*.hxx +mkdir: %_DEST%\inc\o3tl +..\inc\o3tl\*.hxx %_DEST%\inc\o3tl\*.hxx diff --git a/o3tl/qa/cow_wrapper_clients.cxx b/o3tl/qa/cow_wrapper_clients.cxx index 8c8c3eac04e1..dd71e326d7fc 100644 --- a/o3tl/qa/cow_wrapper_clients.cxx +++ b/o3tl/qa/cow_wrapper_clients.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -178,3 +179,5 @@ bool cow_wrapper_client3::operator<( const cow_wrapper_client3& rRHS ) const } } // namespace o3tltests + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/o3tl/qa/cow_wrapper_clients.hxx b/o3tl/qa/cow_wrapper_clients.hxx index 26e5d1adf2e3..88ea03cb9a65 100644 --- a/o3tl/qa/cow_wrapper_clients.hxx +++ b/o3tl/qa/cow_wrapper_clients.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -126,3 +127,5 @@ private: } // namespace o3tltests #endif /* INCLUDED_COW_WRAPPER_CLIENTS_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/o3tl/qa/makefile.mk b/o3tl/qa/makefile.mk index 0c6ecd88e56b..14dbe622a30f 100644 --- a/o3tl/qa/makefile.mk +++ b/o3tl/qa/makefile.mk @@ -36,11 +36,9 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk -#building with stlport, but cppunit was not built with stlport -.IF "$(USE_SYSTEM_STL)"!="YES" -.IF "$(SYSTEM_CPPUNIT)"=="YES" -CFLAGSCXX+=-DADAPT_EXT_STL -.ENDIF +.IF "$(CROSS_COMPILING)"=="YES" +all: + @echo Nothing done when cross-compiling .ENDIF CFLAGSCXX += $(CPPUNIT_CFLAGS) diff --git a/o3tl/qa/test-cow_wrapper.cxx b/o3tl/qa/test-cow_wrapper.cxx index cd69ab1c5e3d..06881b333802 100644 --- a/o3tl/qa/test-cow_wrapper.cxx +++ b/o3tl/qa/test-cow_wrapper.cxx @@ -1,11 +1,10 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ // autogenerated file with codegen.pl -#include "preextstl.h" #include "cppunit/TestAssert.h" #include "cppunit/TestFixture.h" #include "cppunit/extensions/HelperMacros.h" #include "cppunit/plugin/TestPlugIn.h" -#include "postextstl.h" #include "cow_wrapper_clients.hxx" @@ -127,3 +126,5 @@ public: CPPUNIT_TEST_SUITE_REGISTRATION(cow_wrapper_test); CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/o3tl/qa/test-heap_ptr.cxx b/o3tl/qa/test-heap_ptr.cxx index 63ec692efe5c..381b8a31d541 100644 --- a/o3tl/qa/test-heap_ptr.cxx +++ b/o3tl/qa/test-heap_ptr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,11 +26,9 @@ * ************************************************************************/ -#include "preextstl.h" #include "cppunit/TestAssert.h" #include "cppunit/TestFixture.h" #include "cppunit/extensions/HelperMacros.h" -#include "postextstl.h" #include <o3tl/heap_ptr.hxx> @@ -165,3 +164,5 @@ class heap_ptr_test : public CppUnit::TestFixture // ----------------------------------------------------------------------------- CPPUNIT_TEST_SUITE_REGISTRATION(heap_ptr_test); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/o3tl/qa/test-range.cxx b/o3tl/qa/test-range.cxx index 634b04de9122..ee45744c1338 100644 --- a/o3tl/qa/test-range.cxx +++ b/o3tl/qa/test-range.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,11 +26,9 @@ * ************************************************************************/ -#include "preextstl.h" #include "cppunit/TestAssert.h" #include "cppunit/TestFixture.h" #include "cppunit/extensions/HelperMacros.h" -#include "postextstl.h" #include <o3tl/range.hxx> #include <vector> @@ -234,3 +233,5 @@ public: // ----------------------------------------------------------------------------- CPPUNIT_TEST_SUITE_REGISTRATION(range_test); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/o3tl/qa/test-vector_pool.cxx b/o3tl/qa/test-vector_pool.cxx index ab301752532e..1e3ec7a98175 100644 --- a/o3tl/qa/test-vector_pool.cxx +++ b/o3tl/qa/test-vector_pool.cxx @@ -1,10 +1,9 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ // autogenerated file with codegen.pl -#include "preextstl.h" #include "cppunit/TestAssert.h" #include "cppunit/TestFixture.h" #include "cppunit/extensions/HelperMacros.h" -#include "postextstl.h" #include <o3tl/vector_pool.hxx> @@ -69,3 +68,5 @@ public: // ----------------------------------------------------------------------------- CPPUNIT_TEST_SUITE_REGISTRATION(vector_pool_test); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |