summaryrefslogtreecommitdiff
path: root/include/com/sun
AgeCommit message (Collapse)Author
2020-04-27Make upcasting css::uno::Reference ctor require complete typesStephan Bergmann
The main reason for the "home-grown" UpCast introduced with 904b3d1fceee5827076758ed2a81f80cb73493ca "Up-cast conversion constructor for css::uno::Reference" in 2013 was probably that we could not yet rely on C++11 std::is_base_of back then. A (welcome) side effect was that the derived class could be incomplete. However, specializations of UpCast relying on whether or not T2 is incomplete are obviously an ODR violation if the type is incomplete in some TUs and complete (and derived from T1) in others. And even if UpCast had internal linkage, it would still be brittle that its behavior depends on the completeness of T2 at the point of the template's instantiation, and not necessarily at the point of use. That means we should better base that ctor on std::is_base_of (which we can do now since 39a1edd6fec902ef378acce8af42c4d7fba280d0 "Make css::uno::Reference upcast ctor LIBO_INTERNAL_ONLY"), which causes a compilation error at least on Clang and GCC if the completeness requirements are not met. This change fixes all the cases where types need to be complete now, plus any resulting loplugin:referencecasting warnings ("the source reference is already a subtype of the destination reference"). Change-Id: Ieb9e3552e90adbf2c5a5af933dcb872e20661a2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92950 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-04-23Make css::uno::Reference upcast ctor LIBO_INTERNAL_ONLYStephan Bergmann
It looks like an oversight that 904b3d1fceee5827076758ed2a81f80cb73493ca "Up- cast conversion constructor for css::uno::Reference" added it also for external code. Making it LIBO_INTERNAL_ONLY allows to remove workarounds for old MSVC, and may allow to simplify the code further in the future. (Though using std::is_base_of, as suggested in the comment, is not easily possible, as it would cause errors like > include/c++/v1/type_traits:1726:59: error: incomplete type 'com::sun::star::lang::XMultiServiceFactory' used in type trait expression > : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {}; > ^ > include/c++/v1/type_traits:1731:7: note: in instantiation of template class 'std::__1::is_base_of<com::sun::star::beans::XPropertySet, com::sun::star::lang::XMultiServiceFactory>' requested here > = is_base_of<_Bp, _Dp>::value; > ^ > include/com/sun/star/uno/Reference.h:277:18: note: in instantiation of variable template specialization 'std::__1::is_base_of_v<com::sun::star::beans::XPropertySet, com::sun::star::lang::XMultiServiceFactory>' requested here > std::is_base_of_v<interface_type, derived_type> > ^ > ucbhelper/source/provider/getcomponentcontext.cxx:34:9: note: while substituting deduced template arguments into function template 'Reference' [with derived_type = com::sun::star::lang::XMultiServiceFactory] > css::uno::Reference< css::beans::XPropertySet >( > ^ > include/ucbhelper/getcomponentcontext.hxx:29:28: note: forward declaration of 'com::sun::star::lang::XMultiServiceFactory' > namespace lang { class XMultiServiceFactory; } > ^ with incomplete types.) Change-Id: I6da3395df904797cec83c1f6ab24b386527d4cea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92802 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-06loplugin:nullptrStephan Bergmann
...in non-dependent templated code that Clang trunk now apparently processes more aggressively, presumably since <https://github.com/llvm/llvm-project/ commit/878a24ee244a24c39d1c57e9af2e88c621f7cce9> "Reapply 'Fix crash on switch conditions of non-integer types in templates'" Change-Id: Ia3e4bc6cfe7cea9f816e9282563a8b38e40f0cec Reviewed-on: https://gerrit.libreoffice.org/84649 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-03Adapt to C++20 deleted ostream << for sal_Unicode (aka char16_t)Stephan Bergmann
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1423r3.html> "char8_t backward compatibility remediation", as implemented now by <https://gcc.gnu.org/ git/?p=gcc.git;a=commit;h=0c5b35933e5b150df0ab487efb2f11ef5685f713> "libstdc++: P1423R3 char8_t remediation (2/4)" for -std=c++2a, deletes operator << overloads that would print an integer rather than a (presumably expected) character. But in these cases printing an integer is as expected, so add explicit casts. Change-Id: I7c2f1afaa2982b284aef8af183b71466c37142c2 Reviewed-on: https://gerrit.libreoffice.org/84339 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-24support O(U)String::number() for fast string concatenationLuboš Luňák
When I did the fast string concatenation, I didn't add any support for number(), which simply returned a O(U)String, and so it did the extra allocation/deallocation, although that could be avoided. In order to support this, number() now returns a special temporary return type, similarly to O(U)StringConcat, which allows delaying the concatenation the same way. Also similarly, the change of the return type in some cases requires explicit cast to the actual string type. Usage of OString::getStr() is so extensive in the codebase that I actually added it to the helper class, after that it's only relatively few cases. Change-Id: Iba6e158010e1e458089698c426803052b6f46031 Reviewed-on: https://gerrit.libreoffice.org/78873 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-08-30loplugin:noexceptmove in AnyNoel Grandin
but we needed to make moveAnyInternals noexcept, which is fine because uno_any_construct is already noexcept Change-Id: Iddbe7666d8649cde4e638099a17484193055f549 Reviewed-on: https://gerrit.libreoffice.org/78283 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-30new loplugin:noexceptmoveNoel Grandin
idea from mike kaganski look for places where we can mark move operators as noexcept, which makes some STL operations more efficient Change-Id: Id732b89d1fcadd5ceb0ea2b9d159fed06136330f Reviewed-on: https://gerrit.libreoffice.org/78251 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-26Introduce Sequence::size() instead of specialization of std::sizeMike Kaganski
Change-Id: Id0889a1b51449f3812ba875919595a241f4ec56f Reviewed-on: https://gerrit.libreoffice.org/78139 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-08-26Generalize comphelper::concatSequences to accept other container typesMike Kaganski
... as second and following arguments. Change-Id: I1c994ec234354805bc702632878fd67a54d271d6 Reviewed-on: https://gerrit.libreoffice.org/78092 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-08-25cid#1448292 coverity has difficulty with css::uno::SequenceCaolán McNamara
Change-Id: I227a88c566f981ace5e45d0e217a50abbc7f3023 Reviewed-on: https://gerrit.libreoffice.org/78072 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-06-30Fix typoAndrea Gelmini
Change-Id: I4508cc601ac3351f54b0223b15a4705d8f339d7e Reviewed-on: https://gerrit.libreoffice.org/74904 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-06-30Fix typoAndrea Gelmini
Change-Id: I1b43e186bd6e9de7332513e60f3be1bbe9d8ff82 Reviewed-on: https://gerrit.libreoffice.org/74901 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-06-30Fix typoAndrea Gelmini
Change-Id: I576da0e09f4a70361c0c5226ce80418680711f55 Reviewed-on: https://gerrit.libreoffice.org/74902 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-06-30Fix typoAndrea Gelmini
Change-Id: I99dba9443d703d56f0cbe38cb32c7d6963a669cf Reviewed-on: https://gerrit.libreoffice.org/74903 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-06-01Sequence: Fix typo in commentsMichael Weghorn
Change-Id: I8477be28693f55bea857531707286437ea13d034 Reviewed-on: https://gerrit.libreoffice.org/73296 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2019-05-13fix wrong SET/QUERY flags passed to uno::ReferenceNoel Grandin
By creating deleted methods for the wrong calls. Avoids the compiler needing to construct a temporary Change-Id: I3b8c648d6bb22d22827bf74f21ea5a2a17fc0f6a Reviewed-on: https://gerrit.libreoffice.org/72103 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-30implement std::hash for css::uno::Reference and rtl::ReferenceNoel Grandin
The declaration in BarChart.cxx is particularly suspicious, because it was using a < for the KeyEqual template parameter. Been there since: commit b2c3233e5f267b5d244d722a94424a3b224b3314 Date: Thu Dec 21 20:08:33 2017 +0900 chart2: suspend/resume setting rects dirty for 3D shapes comphelper::OInterfaceCompare is no longer necessary Change-Id: I8278c4a3d9113a18570ca237cd05d553ec8f3975 Reviewed-on: https://gerrit.libreoffice.org/71537 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-13fix Sequence ostream operator<< wrt. constMichael Stahl
Change-Id: I924f5d8505f2c2132c79304e19cf89a8ef466ae4 Reviewed-on: https://gerrit.libreoffice.org/67771 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
2019-01-08add operator* to uno::ReferenceNoel Grandin
like the other smart pointer types Change-Id: I3ac1888c84fc1411cdfc3357b005afbb3b7d8bbe Reviewed-on: https://gerrit.libreoffice.org/65926 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-12-08Use constexpr ifStephan Bergmann
Change-Id: I7c34dfb5a83b14afc740772cffe407d4773b07e5 Reviewed-on: https://gerrit.libreoffice.org/64818 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-11Use [[nodiscard]] in SAL_WARN_UNUSED_RESULT where availableStephan Bergmann
...which required some lax placements of SAL_WARN_UNUSED_RESULT to be fixed. Also, Clang unfortunately is rather picky about the relative order of SAL_WARN_UNUSED_RESULT expanding to [[nodiscard]] and uses of the DLLPUBLIC macros (expanding to __attribute__(...) resp. __declspec(..) for clang-cl). Change-Id: Iae6ca36bef97f1864873aefdb5f05c7f5e045ad3 Reviewed-on: https://gerrit.libreoffice.org/60274 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-15More loplugin:cstylecast: cppuStephan Bergmann
Change-Id: I728a40ab6ef4aa44fbe328abdf244e6b5fac9d04
2018-01-13provide uno::Sequence with ostream output operatorThorsten Behrens
Alongside Anys and other UNO data types, you can now also stream out Sequences, e.g. in SAL_INFO or SAL_DEBUG statements. Example code: uno::Sequence<sal_Int8> aBuffer... SAL_DEBUG("my buffer: " << aBuffer); Would yield: debug:<pid>: my buffer: 0xb6, 0x61, 0xa8, ... Change-Id: I03b0789372c44a4dd057625824862f43b1b8dfdc Reviewed-on: https://gerrit.libreoffice.org/47779 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-01-12More loplugin:cstylecast: cppuStephan Bergmann
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I8531b2dc474b257c63016c8ae80014c7322e5a71
2018-01-08Typo in comment ("from" vs. "to")Stephan Bergmann
...which had been like that ever since the code got introduced with 0fbe22a77289a624e1346ab457734c2f64f8e6fb "css::uno::Any move semantics (for LIBO_INTERNAL_ONLY)" Change-Id: Iacd93a4434a92f2ee8f83ba1d59b0ef0a6c38a42
2017-11-11Avoid using O[U]StringConcat lvalues containing dangling refs to temporariesStephan Bergmann
...in code accidentally using auto like > auto const aURL = uri->getUriReference() + "/" > + INetURLObject::encode( > m_sEmbeddedName, INetURLObject::PART_FPATH, > INetURLObject::EncodeMechanism::All); > > uno::Reference<uno::XInterface> xDataSource(xDatabaseContext->getByName(aURL), uno::UNO_QUERY); in <https://gerrit.libreoffice.org/#/c/44569/1> "Properly construct vnd.sun.star.pkg URL" did (causing hard to debug test failures there). So make functions taking O[U]StringConcat take those by rvalue reference. Unfortunately, that also needed adaption of various functions that just forward their arguments. And some code in sc/qa/unit/ucalc_formula.cxx used CPPUNIT_ASSERT_EQUAL on OUStringConcat arguments in cases where that happened to actually compile (because the structure of the two OUStringConcats was identical), which needed adaption too (but which would arguably better use CPPUNIT_ASSERT_EQUAL_MESSAGE, anyway). Change-Id: I8994d932aaedb2a491c7c81c167e93379d4fb6e3 Reviewed-on: https://gerrit.libreoffice.org/44608 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-10-23loplugin:includeform: UNO API include filesStephan Bergmann
Change these back to consistently use the "..." form to include other UNO API include files, for the benefit of external users of this API. Change-Id: I9c9188e895eb3495e20a71ad44abfa2f6061fa94
2017-07-13use more OUString::operator== in forms..salNoel Grandin
Change-Id: I70d7e50f8c1e019524ccad915f0cca912c5035dc Reviewed-on: https://gerrit.libreoffice.org/39899 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-06add COVERITY_NOEXCEPT_FALSECaolán McNamara
to markup dtors that coverity warns might throw exceptions which won't throw in practice, or where std::terminate is an acceptable response if they do Change-Id: I32b94814e8245372e1d1dc36be0d81e3564042f4 Reviewed-on: https://gerrit.libreoffice.org/38318 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-05-30teach redundantcast plugin about functional castsNoel Grandin
Change-Id: Iac8ccd17d9e46ebb2cb55db7adb06c469bbd4ea0 Reviewed-on: https://gerrit.libreoffice.org/37910 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-18Revert "Fix typos"Stephan Bergmann
This reverts commit 26a67002fcb9381b54de6cae1aaa37120d49066a. "Iff" is not a typo, see 2a65bf32ec270484dcea4d22d3c93552dc0c24dd "Revert 'Typo: iff->if'".
2017-05-18Fix typosAndrea Gelmini
Only replaced "iff" with "if" Change-Id: Ib9dfa5c12b05500043147fe3b65f923b1b12a581 Reviewed-on: https://gerrit.libreoffice.org/37782 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
2017-04-28LIBO_INTERNAL_ONLY: printing of css::uno::Reference/TypeStephan Bergmann
...as will be needed by some upcoming replacements of CPPUNIT_ASSERT with CPPUNIT_ASSERT_EQUAL Change-Id: Ie2b2b982b02f2bf48e2e8be7ba642198029c8698
2017-03-03Remove redundant 'inline' keywordStephan Bergmann
...from function definitions occurring within class definitions. Done with a rewriting Clang plugin (to be pushed later). Change-Id: I9c6f2818a57ccdb361548895a7743107cbacdff8 Reviewed-on: https://gerrit.libreoffice.org/34874 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-01-26add 'explicit operator bool' to our reference classesNoel Grandin
Change-Id: I91cfbe2646dcc55b98d2b809c49c9ea073f54f58 Reviewed-on: https://gerrit.libreoffice.org/33517 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-21Delete the "Any-to-Any" template specializations for LIBO_INTERNAL_ONLYStephan Bergmann
i.e., css::uno::Any function template specializations Any::has<Any>() const Any::get(Any const &) const operator >>=(Any const &, Any &) operator <<=(Any &, Any const &) that don't make much sense (the first is always true, the rest can be replaced with operator =, which additionally supports move semantics). For 3rd-party compatibility, do this only for LIBO_INTERNAL_ONLY, however. However, some generic template code did benefit from operator >>= working also for Any, so make up for that with a new (LIBO_INTERNAL_ONLY, given that operator >>= still covers if fine for !LIBO_INTERNAL_ONLY) fromAny, complementing the existing toAny. Change-Id: I8b1b5f803f0b909808159916366d53c948206a88 Reviewed-on: https://gerrit.libreoffice.org/30022 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2016-07-04use SAL_DEPRECATED in uno::ReferenceNoel Grandin
and fix a couple of usages that have crept in Change-Id: Ia3e7fcc05dac6e0d205e69c0e0372c74653e7c5e Reviewed-on: https://gerrit.libreoffice.org/26851 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-06-06css::uno::Any move semantics (for LIBO_INTERNAL_ONLY)Stephan Bergmann
Change-Id: Ib582a744321e0f209395651ac2edffe30152ffba
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-05-04Better fix for Windows-only codeStephan Bergmann
Change-Id: I8437ec66b615754d71c726f715a6beeb4a0f7dda
2016-05-04Fix Windows-only codeStephan Bergmann
Change-Id: Iaf6d668f65e31c60dba8140d789f6578ef461264
2016-05-04While at it, delete Any functions on sal_Bool*Stephan Bergmann
(at least for LIBO_INTERNAL_ONLY), to help further reduce the occurrences of sal_Bool across the code base Change-Id: I70654a0cb56655984c717b7b894f26c9ab47536e
2016-05-03Enable Any functions on sal_uInt16 for LIBO_INTERNAL_ONLYStephan Bergmann
...where sal_uInt16 no longer clashes with sal_Unicode after e16fa715c43dcdf836ce8c400b6d54eae87b627d "Handle wchar_t as native C++11 type on windows". This allows to consistently use Any ctor instead of makeAny, regardless of argument type, in LIBO_INTERNAL_ONLY code. Change-Id: I9acdcc48be71a90d17013959c8275454e8fa01a0 Reviewed-on: https://gerrit.libreoffice.org/24620 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-05-03Clean up makeAny functionsStephan Bergmann
Let the templated makeAny(v) just call Any(v), so that any special handling of argument types needs to be only done for the Any ctor, not also for makeAny (both the original makeAny implementation and the Any ctor implementation internally use cppu::getTypeFavourUnsigned to determine the UNO type, so this does not cause any difference in behavior): * The specialization of makeAny for bool can be dropped. * The overload of makeAny for OUStringConcat is replaced with an overloaded Any ctor, so that Any(s + "foo") works now, too. Curiously, only the Any ctor had been deleted for a sal_uInt16 argument (which can conflict with sal_Unicode), but not makeAny. So introduce a specialization of makeAny for sal_uInt16, so that that continues to work. (For backwards compatiblity in the non-LIBO_INTERNAL_ONLY case; and in the LIBO_INIERNAL_ONLY case we're moving away from the sal_uInt16/sal_Unicode clash anyway thanks to C++11 char16_t, so it is arguably better to allow makeAny for sal_uIn16 than to prohibit it.) Change-Id: I7803703769730024863bb4e5b1b3416b81bd8960
2016-05-03Prevent Any::setValue from reinterpreting bool* as sal_Bool*Stephan Bergmann
...which only happens ot work in environments where sizeof (bool) == 1. The simpler alternative is to use the operator <<= template without passing explicit UNO type information, anyway. The std::nullptr_t overloads are needed to disambiguate calls with a nullptr argument. (Which can at least be meaningful for VOID, but for other types what it happens to do is store a default value of the given type.) As std::nullptr_t is only C++11, this all needs to be LIBO_INTERNAL_ONLY. Change-Id: Iff06a6ba94250bd4ae4afc937c2a2bfa75f0888f
2016-05-03Prevent Any ctor from reinterpreting bool* as sal_Bool*Stephan Bergmann
...which only happens to work in environments where sizeof (bool) == 1. The simpler alternative is to use the Any ctor template without passing explicit UNO type information, anyway. The std::nullptr_t overloads are needed to disambiguate calls with a nullptr argument. (Which can at least be meaningful for VOID, but for other types what it happens to do is store a default value of the given type.) As std::nullptr_t is only C++11, this all needs to be LIBO_INTERNAL_ONLY. Change-Id: I0f72c73a088ef96e069c3ed8c78546b16d89b50a
2016-04-27Improve documentationStephan Bergmann
Change-Id: I13683f971bf56f6c5e226d749e60ccb25af559a5
2016-04-20Use cast to bool to normalize sal_Bool valuesStephan Bergmann
Change-Id: I8a886f752d2a16ec4c10656bcd0b3631647971b2
2016-02-09Remove excess newlinesChris Sherlock
A ridiculously fast way of doing this is: for i in $(pcregrep -l -M -r --include='.*[hc]xx$' \ --exclude-dir=workdir --exclude-dir=instdir '^ {3,}' .) do perl -0777 -i -pe 's/^ {3,}/ /gm' $i done Change-Id: Iebb93eccbee9e4fc5c4380474ba595858a27ac2c Reviewed-on: https://gerrit.libreoffice.org/22224 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2015-12-10More loplugin:nullptr automatic rewrite (within templates)Stephan Bergmann
Change-Id: I9bc06cfb5eeb38fd7ae7fb25f876ea9f96e4a65a