summaryrefslogtreecommitdiff
path: root/include/o3tl
AgeCommit message (Collapse)Author
2016-06-10Const correctness in o3tl/any.hxxStephan Bergmann
Change-Id: Ife6ce05430c99cd5452166c942320a3a301578ff
2016-06-06Improve o3tl/any.hxxStephan Bergmann
* Ensure tryGet<XFoo> (instead of tryGet<css::uno::Reference<XFoo>>) doesn't compile. * Add forceGet (as discussed at 0d7c5823124696f80583ac2a5f0e28f329f6f786 "New o3tl::try/doGet to obtain value from Any", to be used momentarily). Change-Id: I57eb6ef18a6ab0d52bb26df7eb4e51b485fc83ed
2016-06-02New o3tl::try/doGet to obtain value from AnyStephan Bergmann
...in an attempt to reduce usage of type-unsafe void const * css::uno::Any::getValue() These new functions are often more convenient to use than the existing ">>=" and Any::get<T>. Note how they are careful to provide a pointer directly into the given Any, instead of creating temporaries. As an example, replaced most calls of getValue across xmloff: * Cases that first check for a specific type (via getValueType etc.) and then call getValue can instead call tryGet. (But beware that tryGet supports some conversions, which a check for a specific type may have missed---either intentionally or by accident. Also beware the somewhat common idiom of checking for TypeClass_ENUM and then using getValue to obtain a sal_Int32; this cannot be replaced with a call to tryGet.) * Cases that seem confident that the Any is of the correct type when calling getValue (but apparently are confident due to some higher-layer protocol, as the surrounding code does not do any checking via getValueType or similar) can instead call doGet. It throws an exception if it turns out the confidence wasn't warranted. (Many of the existing calls that directly dereferenced the return value of getValue as sal_Bool look suspicious, in that the author might have thought the given code would also cover a VOID Any---which technically it even would have happened to do. If any RuntimeExceptions thrown from these doGet calls start to crop up, these changes need to be revisited. Some may even be rewritten as uses of ">>=". But at least "make check" did not show any such problems. Also note that casting the value obtained from getValue to any css::uno::Reference<X> with X being anything but the base css::uno::XInterface was always prone to producing a bad pointer, in case the interface actually stored in the Any derived from X via multiple inheritance.) * Should there ever be cases where an Any is known to be of the requested type, some additional forceGet could be introduced (which would assert instead of throwing an exception). Change-Id: I2d8739e86314eff73abfcafe01d806f5bc5c34db
2016-05-24Convert VclPackType to scoped enumNoel Grandin
Change-Id: I5bcc4f8686c1ce5bf7def948ce50837fa542786f Reviewed-on: https://gerrit.libreoffice.org/25394 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-13remove various crutches for boost::bind/boost::mem_fnMichael Stahl
These aren't used any more, and the C++11 std equivalents don't use get_pointer() overloads. Change-Id: Ib97a6a595863e21a1621c63709ea2b28f6550fde Reviewed-on: https://gerrit.libreoffice.org/24982 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2016-02-08loplugin:unusedmethodsNoel Grandin
using an idea from dtardon: <dtardon> noelgrandin, hi. could you try to run the unusedmethods clang plugin with "make build-nocheck"? that would catch functions that are only used in tests. e.g., i just removed the whole o3tl::range class, which has not been used in many years, but htere was a test for it... <noelgrandin> dtardon, interesting idea! Sure, I can do that. Change-Id: I5653953a426a2186a1e43017212d87ffce520387 Reviewed-on: https://gerrit.libreoffice.org/22041 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-01-29remove unused o3tl::rangeDavid Tardon
Change-Id: I080f4f2cb15d25ecf5545300da422957f24e3f9b
2016-01-29remove unneeded sal/config.hDavid Tardon
Change-Id: I7c8f06574053706f925df773aefc32407312c4dd
2016-01-26vcl: replace boost::shared_array with std::shared_ptrMichael Stahl
Add o3tl::make_shared_array() to create the shared_ptr with the right deleter. The main difference then is that shared_array has operator[], but this code didn't even use it. Change-Id: I500ffc2f92b99c2a3924c0cdcdaa101956b69add
2016-01-19Make enumarray_iterator adhere to iterator requirementsStephan Bergmann
...or else using it with GCC 6 libstdc++ std::find causes compilation failures Change-Id: I95e674922348f72fab6da8f049b2b4fcbdc74d07
2016-01-13remove unused o3tl/ptr_container.hxxMichael Stahl
Change-Id: I8132958b979add35bdd7aea52ce8788f3cdcbe51
2016-01-10Fix typosAndrea Gelmini
Change-Id: I9a5940027423ff0791fa7da0b79b617412ce6b86 Reviewed-on: https://gerrit.libreoffice.org/21209 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-06std::swap is in <utility>, not <algorithm>Stephan Bergmann
Change-Id: I8b93f053276ff273f2f79ed29d7605d976f7d866
2015-11-05BOOST_ASSERT->assertNoel Grandin
Change-Id: Ifbb80c90f8530ebf4660493447c2c076587bebd6 Reviewed-on: https://gerrit.libreoffice.org/19795 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-10-12Replace "SAL_FINAL" with "final" in LIBO_INTERNAL_ONLY codeStephan Bergmann
Change-Id: Ifa5ba21308e32df44571fa2941370f2f11179580
2015-09-30Fix typosAndrea Gelmini
Change-Id: I6dfb5fb468c1305a8f248bf5788c5760135fd835 Reviewed-on: https://gerrit.libreoffice.org/18955 Reviewed-by: Oliver Specht <oliver.specht@cib.de> Tested-by: Oliver Specht <oliver.specht@cib.de>
2015-09-30Avoid unhelpful -Wunused-variableStephan Bergmann
...at least from "g++ (GCC) 5.1.1 20150618 (Red Hat 5.1.1-4)" with --disable-debug, when a namespace-scope const variable with a "complex" initializer declared in an include file remains unused. Avoid that warning via SAL_CONSTEXPR, which in turn requires large parts of o3tl::is_typed_flags to be SAL_CONSTEXPR, which in turn requires a new HAVE_CXX14_CONSTEXPR to allow assert in constexpr functions, which in turn requires using -std=c++14 instead of -std=c++11 where available, which in turn (a) requires to /not/ use -std=c++14 if it would run into a bug between Clang and libstdc++ discussed at <https://llvm.org/bugs/show_bug.cgi?id=24115> "llvm-nm fails to build with gcc 5.1's libstdc++" (and which hits us in sfx2/source/control/thumbnailview.cxx), and (b) requires a new HAVE_CXX14_SIZED_DEALLOCATION to work around GCC 5.1 -Werror=sized-deallocation (where Clang >= 3.7 only supports C++14 sized deallocation when explictly enabled via -fsized-deallocation, btw). This effectively reverts ff6462e6307e6924dc6c8178043ae9032f4b4152 "avoid unused variable warning:" again. Change-Id: I424e3561452a3e6d8c8a9604d6c737cab49840c4 Reviewed-on: https://gerrit.libreoffice.org/18918 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2015-09-16Remove unnecessary typedef from previous attempt againStephan Bergmann
Change-Id: Ic3e5c4aef4235124069035daadfb53ff3a1368a5
2015-09-15Fix binary ops with two o3tl::type_flags<E>::Wrap paramsStephan Bergmann
(the original ones would never have been picked due to how template argument deduction works) Change-Id: I5a08c763d721d8e11b5a10af2344a6a24bb0b9b2 Reviewed-on: https://gerrit.libreoffice.org/18583 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2015-08-30loplugin:simplifyboolStephan Bergmann
Change-Id: I5bfc2a84cef68421757e9aa8f5e4bcb1d6caf7bf
2015-08-29o3tl/cow_wrapper: remove boost dependencyDaniel Robertson
Remove boost dependencies from ::o3tl::cow_wrapper, and add the necessary includes to files including checked_delete and noncopyable that do not already include the necessary files. Change-Id: Iedae4232002792724226829a5d5cf9d16ffd0686 Reviewed-on: https://gerrit.libreoffice.org/18125 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2015-08-29o3tl: add another unit test to cow_wrapperDaniel Robertson
Add unit tests to cow_wrapper for the move ctor and move assignment. Change-Id: I82a5886ca7ae110985c7202125699cf95b6466d8 Reviewed-on: https://gerrit.libreoffice.org/18108 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2015-08-26Revert "create a macro to tidy up the declaration sites of ↵Noel Grandin
o3tl::typed_flags_set" sberg did not like this macro, let's see if I can find a better solution. This reverts commit e51fa143587d018b75db08e60cf27ff932b1cf8d.
2015-08-19o3tl: cow_wrapper add move constructor/assignmentDaniel Robertson
Add a move constructor and move assignment operator for o3tl::cow_wrapper. Insubstantial gains for UnsafeRefCountingPolicy, no atomic increment needed for ThreadSafeRefCountingPolicy's move-ctor. Change-Id: Ia2de1ca78b1e0e5a0f30535e752f1dd858fdfef0 Reviewed-on: https://gerrit.libreoffice.org/17848 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2015-08-17o3tl: rename compat_functional headerThorsten Behrens
After the cleanup, the stuff there really stands on its own (and the remaining usage of select1st/2nd is more descriptive than lambdas). Change-Id: I0aba131d5dc550189f8130d167dc94167e404540 Reviewed-on: https://gerrit.libreoffice.org/17806 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2015-08-17o3tl: remove unused codeThorsten Behrens
Change-Id: Ia7bcb590ab5b535af8cacead1e8afd735c463aaf Reviewed-on: https://gerrit.libreoffice.org/17805 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2015-08-13tdf#92459 basebmp: replace project2ndDaniel Robertson
Replace the use of project2nd in basebmp with a specialized functor similar to what is seen in paletteformats.hxx and pixelformatadapters.hxx. There should be no side effects due to this change. Change-Id: I1bbd723931e41986542e92bac773bbea68cfe5bd Reviewed-on: https://gerrit.libreoffice.org/17660 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
2015-08-11tdf#92459 o3tl: remove unary_functionDaniel Robertson
Clean up o3tl/compat_functional.hxx select1st/select2nd. Remove the structs inheritance from the now deprecated unary_function. Remove project1st, as it is not used. Change-Id: I60c0f30c4b87417a331a4b38f62993cc3d1c9a51 Reviewed-on: https://gerrit.libreoffice.org/17625 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2015-07-30add assert for valid value in o3tl::typed_flags_setNoel Grandin
, fixing a couple of bugs in the process Change-Id: I40f932deecbcc99dff9aa13dd1882c7487e7fa8e Reviewed-on: https://gerrit.libreoffice.org/17411 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-07-24LRU map (cache) implementation to o3tl + testsTomaž Vajngerl
Change-Id: I6b1a39918e6c8c67712be2c8e9907266dcfefedb
2015-07-15create a macro to tidy up the declaration sites of o3tl::typed_flags_setNoel Grandin
Change-Id: Ifb8fd4fd5128188420f1dfda6b6f695160d5e77a Reviewed-on: https://gerrit.libreoffice.org/15865 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2015-07-10do not include boost/utility.hppMichael Stahl
It just includes a bunch of other boost headers; mostly we need boost/noncopyable.hpp so include that directly. This eliminates 831 MB(!) of boost/preprocessor/seq/fold_left.hpp completely, which is the 2nd biggest header after ustring.hxx. Change-Id: I3df55770adcb46e56f389af828e8ba80da2dc1f2
2015-06-26Remove workarounds for no longer supported GCC 4.6Stephan Bergmann
In bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx, the #if also covered Clang, which actually needs these declarations (for now; the right fix will probably be to #include <cxxabi.h>). Change-Id: I1eebd59e2371f3498d740ab78244927358c4f23f
2015-05-21o3tl: add make_unique template till we can't use std::make_uniqueMiklos Vajna
Change-Id: I48b26f0199e339badf7a0e2bed322ca701689d13 Reviewed-on: https://gerrit.libreoffice.org/15846 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2015-05-09Fix ICEs in gcc 4.6.3 for small-int typed_flags.Thorsten Behrens
Subtle failures in nested template instantiations there, for sal_{u}Int8 and sal_{u}Int16 - use wide-int fallback to do bitmask ops. Type is not used to store any dynamic values. This partially reverts a1ecce3ad7df6a82191c4956cec986dc50503dde Change-Id: Ifa7070c1c3830fd70d7ced082d651411ff523444
2015-05-09Revert "improve fallback behaviour of underlying_type for old gcc"Thorsten Behrens
This reverts commit 7ad4e562b462af22a1c29c955293238cdb30267b, which was causing ICEs on precisely the compiler versions it was targetted at. Change-Id: I996792d723a8bd0d7edd5f248d74217322b5ce3f
2015-05-07improve fallback behaviour of underlying_type for old gccChristoph Lutz
The fix fbd85c25b is not sufficient to build with an old GCC 4.6. The problem was, that underlying_type returned an int as default value for GCC 4.6 and int allows negative values that are forbidden in typed_flags_set. Changed it to alternative solution suggested in http://stackoverflow.com/questions/26148192/underlying-type-of-a-c-enum-in-c03 Change-Id: I20f44b8cef9c692efb583971bd251f1c34c289ab Reviewed-on: https://gerrit.libreoffice.org/15663 Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de> Tested-by: Katarina Behrens <Katarina.Behrens@cib.de>
2015-04-29enumarray_iterator should not have a deleted copy assignment opStephan Bergmann
Change-Id: I1e5f8dcfe0801eca10622eefab43b674b6b3e956
2015-04-29convert STR_EVENT constants to scoped enumNoel Grandin
- also add needed infrastructure to o3tl::enumarray so we can use std::find on it - move the Impl inside the .cxx file, no need to expose it in the header Change-Id: I7758a6175849f46723d97b1e657f846524c3b7cd
2015-04-24loplugin:simplifyboolStephan Bergmann
Change-Id: I981d5a77cfe74ef81b235963820151cbea55370c
2015-04-10Get rid of false GCC 4.7 -Werror=type-limits in template codeStephan Bergmann
Change-Id: I4b13d3b7d74690401234dfa30c8c1b6647820b6a Reviewed-on: https://gerrit.libreoffice.org/15216 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
2015-04-09loplugin:staticmethodsNoel Grandin
Change-Id: Ie348778ea666c24e95e048386547f301083a0017
2015-04-07convert SvtModuleOptions::EFactory to enum classNoel Grandin
and fix issues in iterating through o3tl::enumarray Change-Id: Ia59ef9be44d8c92c2e406fa71aa92269578e26e3
2015-04-02Change INetProtocol to scoped enumerationStephan Bergmann
...and fix o3tl::enumarray::operator [] const overload Change-Id: I749b1b9d68686b03a97074253478d9d2d9d32b0b
2015-04-02Model o3tl::enumarray after std::array to allow aggregate initializationStephan Bergmann
...though that requires switching of C++ -Wmissing-braces for Clang and for old GCC (new GCC already dropped it from C++ -Wall, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25137#c17>). Change-Id: I92acc4c529d634c4190e0ee4b65d1fbe5b1b521f
2015-04-01CosmeticsTor Lillqvist
Change-Id: I65ee75db015a402c8d93f10f03512669d6fa8e79
2015-04-01WaE: c-style castTor Lillqvist
Change-Id: Ia3d8c23e8c3b3a2c7bbbcfc9922272b62ca2fc49
2015-04-01convert BOX_LINE and BOXINFO_LINE to enum classNoel Grandin
since their usage is intertwined. Also introduce new o3tl utilities enumrange and enumarray to make working with scoped enums a little simpler. Change-Id: I2e1cc65dd7c638e59f17d96dfae504747cad6533
2015-03-19We require MSVC2013 (_MSC_VER == 1800) nowTor Lillqvist
Change-Id: Ice8504041f22e00f2e5010813d9dff1d2987c8d6
2015-03-11convert CHILD_ constants to enum classNoel Grandin
Change-Id: I1aca134fcc0384df4797cacafa9fbc1ed88d6617