summaryrefslogtreecommitdiff
path: root/include/comphelper
AgeCommit message (Collapse)Author
2022-05-03Adapt Base64::decodeSomeChars to change from OUString to std::u16string_viewStephan Bergmann
...in 9c95415de877af1430ab5b7123e11dedd0ea622c "Let comphelper::Base64::decode* take std::u16string_view" Change-Id: I42b1552fba80568b422cb60ccc99a7ab8664f2d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133711 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-30split comphelper::string::strip functions into String and view versionNoel Grandin
which is more obvious, from the perspective of the caller, and lets us avoid creating a new String if nothing needs to be stripped Change-Id: I66a980eaf4aa818251bec49bdb16c2dddb0745e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133657 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-28use more string_view in comphelperNoel Grandin
Change-Id: I1544da756d8da074787bc19a98d2740058e36479 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133520 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-22use more string_view in comphelperNoel Grandin
Change-Id: Ib186d2c9aa8458ddbdd14dd44e2d3938f0f26ad2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133269 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-20loplugin:passstuffbyrefNoel Grandin
Change-Id: I336fd329b577b6fa141265d8bc7ce67784bd7306 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133210 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-13loplugin:stringviewparam whitelist some more functionsNoel Grandin
for which we have o3tl:: equivalents Change-Id: I4670fd8b703ac47214be213f41e88d1c6ede7032 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132913 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-12Remove need for OPropertyAccessor default ctorStephan Bergmann
Change-Id: Ia5ae4e28aa880600ce80bd284cde5183c49e4b40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132929 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-10use more string_viewNoel Grandin
found by tweaking the loplugin:stringview and making it whitelist getLength Change-Id: Ic15d3703d1fb07658e99e1db1c89e2fa5bc70c19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132771 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-08move comphelper::string::toInt32 to o3tlNoel Grandin
so we can use it in places where we cannot include comphelper Change-Id: Iba0ba3e4c0dcf0f9d1f09092a77c3b2010ec4f6d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132732 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-08loplugin:stringviewparam convert methods using trimNoel Grandin
for which we add a new o3tl::trim method Change-Id: I9d37b6264eea106aa2f3502bd24b8cccf7850938 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132658 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-05add some comphelper::string::toInt* functions for string_viewsNoel Grandin
Change-Id: Icf42e00575edf8fc847bccf9c9505cd9710fc9b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132509 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-04use string_view in comphelper::string::splitNoel Grandin
Change-Id: I4afe8aee85905ee35ba195b00b454aefa0ba38af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132486 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-29Revert "removed pointless using namespace std"Stephan Bergmann
This reverts commit 5b53dd0514c25f907c80d523b078387db71f859b. The using directive was not pointless, it was necessary to correctly call the std::swap customization point. Change-Id: I642587fe2a8fc281a6079837edce3a8a6c47ea33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132184 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-03-29removed pointless using namespace stdofftkp
Change-Id: I117aa1ea74b636ef06f7eedce8f2e12f9c4226b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132213 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2022-03-14new loplugin:trivialconstructorNoel Grandin
Change-Id: Iaaf63c49ce94987ab9c4ebc68e963cc3054a3c34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131342 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-11Simplify ConfigurationWrapper singleton construction a bitStephan Bergmann
Change-Id: I8b0dd0e049ebeb3304673df3bdb9fe7c755b7750 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131335 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-03-07do not pass XComponentContext to officecfg::...::get() callsLuboš Luňák
It's used only for the ConfigurationWrapper singleton, so it's used only the first time and then ignored. It also causes calls to comphelper::getProcessComponentContext() for every single invocation despite the value not being needed, and the calls may not be cheap (it's ~5% CPU during ODS save because relatively frequent calls to officecfg::Office::Common::Save::ODF::DefaultVersion::get()). Change-Id: I02c17a1a9cb498aeef220ddd5a0bde5523cb0ffb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131056 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-02-09expand out IMPLEMENT_FORWARD_XTYPEPROVIDER3Noel Grandin
Change-Id: I31a7452bd8822f13905812e8f3fcd31a0753e0a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129711 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-02-01Slightly optimize truncateToLength and padToLengthMike Kaganski
Change-Id: I7a18ce1f1c25e9f7a3c230109c741d6642786a13 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129256 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-01-21fix opengl slide transitionNoel Grandin
regression from commit 62efb188668a3296591dcfa3658185e2f982e356 use comphelper::WeakComponentImplHelper in SlideShowVie Switch notifyEach to leave the mutex locked after being called, because that seems to compose better - because after a call it is in the same state that was when we entered the call. Change-Id: I42e80cc7be1b65ed8cab24ab7c11210e056d916d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128723 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-01-21comphelper: move JsonToPropertyValues() from desktop/Miklos Vajna
Because filter/ code will need this in a bit, and that can't depend on desktop/. Change-Id: I07f0f8ef30942a2d11388c6721c7f277e117bfba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128709 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-01-18fix locking in comphelper::OInterfaceContainerHelper4::forEachNoel Grandin
regression from commit a2eaf99e46f370ffb3b73828c2bdc53dc193b9a4 Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Fri Jan 14 10:56:50 2022 +0200 make comphelper::OInterfaceContainerHelper4 more threadsafe Change-Id: Iea42fd0bba6da99d82076b4d1b495d67fa62243c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128526 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-01-15Let loplugin:nullptr look into template instantiationsStephan Bergmann
It missed some occurrences of 0 when only looking into uninstantiated template code, as Clang doesn't model them with an ImplicitCastExpr, even if the target is known to be a (dependent) pointer type. Looking into all template instantiations of course carries the risk that a given use of 0 is meant to be interpreted as a pointer in some and as an integer in other instantiations. But the only case where that happened in the current code base is RegistryValueList::getElement (include/registry/registry.hxx), where {} is arguably a better choice anyway. (And which would presumably also hold for any future such cases.) Change-Id: I708bcfc8bedc0a49c9282d7814eb325afa29905c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128462 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-01-14make comphelper::OInterfaceContainerHelper4 more threadsafeNoel Grandin
(*) make all the methods that require an external mutex take a std::unique_lock as a parameter, so that call sites cannot forget (*) make the forEach method drop the lock when firing listener methods, to reduce the odds of deadlock Change-Id: I0a80e3b3d1c1c03b7de4a658d31fcc2847690903 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128415 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-01-14reduce default cost of OInterfaceContainerHelper3Noel Grandin
most of these are never used, so rather store a pointer to a shared empty vector Change-Id: If5b8b82235171769420615147a0e0b316c237874 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128404 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-01-09implement anyToHash() and use it for SdrCustomShapeGeometryItemLuboš Luňák
Using anyLess() still has quite some cost with bsc#1183308, this makes the cost almost unnoticeable. Since some values of Any are not handled, return empty std::optional for those cases. Change-Id: Ib45a81441e8bb456c4749f9bc53a981f09bbb1a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128109 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-12-27reduce default cost of OInterfaceContainerHelper4Noel Grandin
most of these are never used, so rather store a pointer to a shared empty vector Change-Id: I4736794a31237c598d1188ef42f4210ea6d3f871 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127599 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-27osl::Mutex->std::mutex in ResultSet_ImplNoel Grandin
Change-Id: I1c1900e94893b42a3ad4a5ef58f0cfe277305344 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127544 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-26Let comphelper::Base64::decode* take std::u16string_viewMike Kaganski
Change-Id: I5b04f7adf11c61f52b7bfb0f52c8c075f838f0f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127480 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-26fix comphelper::WeakComponentImplHelper::queryNoel Grandin
Which was not hanling queries for sub-interfaces. We need to copy the complicated query function from cppuhelper, unfortunatly. It has a signature that includes the base class, so we cant re-use it. Change-Id: I3668abb67c6cb669086ce32505b383ac11d3c3ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127511 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-25Revert "Init WeakComponentImplHelperBase::m_bDisposed"Mike Kaganski
This reverts commit c1f21a6ce6491ac82a022502c618e2758d3b3a31. Reason for revert: a better fix is implemented in commit f0c0c62c10e4ffdb9ce44202e2540d2f39a9fcb5 author Noel Grandin <noel.grandin@collabora.co.uk> date Sat Dec 25 11:43:11 2021 +0200 uninitialised field in comphelper::WeakComponentImplHelperBase That change allows to keep the ctor implicitly defined and inline. Change-Id: Icb8064ebc77d4120d279d30df5de4ebee5479b4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127474 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2021-12-25pass unique_lock as param in WeakComponentImplHelperBase::disposingNoel Grandin
so that subclasses can drop the lock while calling listeners Change-Id: I6105438110af08f10b0ed50057b28172c3442b95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127434 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-25uninitialised field in comphelper::WeakComponentImplHelperBaseNoel Grandin
Change-Id: I7ab702c0dd61231b334aac647e87233095cc69e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127450 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-25Init WeakComponentImplHelperBase::m_bDisposedJan-Marek Glogowski
From the Jenkins_Linux_Ubsan TB: /comphelper/source/misc/compbase.cxx:20:9: runtime error: load \ of value 190, which is not a valid value for type ´bool´ ... in comphelper::WeakComponentImplHelperBase::dispose() \ /comphelper/source/misc/compbase.cxx:20:9 Maybe also the problem breaking Java for the Jenkins_Linux_Dbg since the comphelper::WeakComponentImplHelperBase patches went in. Regression from commit 252dd254b5b29298457b889623783152e9bed534 ("new comphelper::WeakImplComponentHelper"). Change-Id: Idebf6dfcc051f8fcb4cde1fb66d40b38e6f9dddc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127449 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2021-12-25tdf#145090 LO Calc Crash with drop-down-menuNoel Grandin
avoid attempting to call into widgets while in the middle of dispose regression from commit 8d485ec0cd35ee1ae7684f2b6ca96c0f0c6f9dac IsDisposed->isDisposed in vcl/../window Change-Id: If346dc9dc8547f8da28d091bfa20eff39162a0b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127437 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-24new comphelper::WeakImplComponentHelperNoel Grandin
to replace the cppu:: equivalent with a lightweight version that uses std::mutex instead of osl::Mutex Change-Id: I1b7873a0c2d9cda21f529e43a4ac2fa7574c91a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127335 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-22loplugin:flatten in filter..includeNoel Grandin
Change-Id: I74c1ea8b9b490eaa9508a885758224063e39051b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127235 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-17Remove empty docpp doxygen comments around namespacesMiklos Vajna
I assume this was originally added to work around some broken doc generator, but we don't enforce comments for namespaces today, so this is no longer needed. Change-Id: Ia2311658516be84b26ae69e09362af560d793a7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126963 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-12-16comphelper : use std::mutex in numberedcollectionArnaud Versini
Change-Id: Ifd8b1668ceac69f5393a279ffb19070655149e65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124126 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-15Recheck include/[a-d]* with IWYUGabor Kelemen
See tdf#42949 for motivation Change-Id: I42475b8e75951d5dcae2fe6b0ad0bca64441e7f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126837 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-12-07loplugin:unusedmethodsNoel Grandin
Change-Id: Ic1ba90447575278d854af85312271c41766b776b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126422 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-06cid#1494595,1494597: Silence UNCAUGHT_EXCEPTStephan Bergmann
...after aa5ee0085c7d8b8713f4dbed0009b38b9fabb281 "Stop swallowing exceptions in ~ScopeGuard" had dropped the catch blocks from ~ScopeGuard to make it usable in Library_salhelper in 0c1c300ed7ce168755ae945822eb7a1c610cfa25 "Rather use ScopeGuard to prevent catch and rethrow". But using the original suppress_fun_call_w_exception, which used css::uno::Exception, would have caused the same circular-dependency issue again that aa5ee0085c7d8b8713f4dbed0009b38b9fabb281 had solved, so drop the use of css::uno::Exception (and SAL_WARN, which triggered a number of missing #include <sal/log.hxx>) also from suppress_fun_call_w_exception. After all, that was __COVERITY__-only code that wasn't meant to be actually run, so it shouldn't matter if we just catch everything and silently terminate. Change-Id: If28a214709e4636e1c23a49f2d95d87c91492f14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126404 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-12-05remove OMultiTypeInterfaceContainerHelperVar2Noel Grandin
superceded and replaced by OMultiTypeInterfaceContainerHelperVar3 Change-Id: I46ad14bcc9bfcfe1a5279414e72d9356ddb02329 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126382 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-03replace comphelper::OListenerContainer with OInterfaceContainerHelper3Noel Grandin
OInterfaceContainerHelper3 is in wide use and can do the same thing with less ceremony Change-Id: I5252738d6b7bda6245c66da46352944ead79bd52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126271 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-03improve member field nameNoel Grandin
Change-Id: Ib4e3bda523364a3f8f0d95a764833765ac8c3f82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126282 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-03Stop swallowing exceptions in ~ScopeGuardStephan Bergmann
...and rather assume that m_func() is implicitly noexcept. (Catching exceptions had been done ever since the class' introduction in 7d1c1393eecf0cfcce06f35b0b18311f1e887aee "INTEGRATION: CWS presfixes01: #i37777# new scopeguard" and looks more like a general safety measure rather than catering for m_func() that deliberately throw exceptions. This change is in part a prerequisite for using this inline-only class in salhelper, where use of css::uno::Exception would cause a circular dependency.) Change-Id: I00f885a4a6e18f3ce77e84d53e96f00c49708cdf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126202 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-12-03create OMultiTypeInterfaceContainerHelperVar3 templateNoel Grandin
to supercede OMultiTypeInterfaceContainerHelperVar2 and add (a) type-safety (b) skip the need for doing UNO_QUERY when firing events Change-Id: Iaeb2421da5d92d2d4fd4feb45ab5019ca85d0d7a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126192 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-01fix thinko in OMultiTypeInterfaceContainerHelperVar2 changeNoel Grandin
in commit d8a526eabe3a7256c1637307e8de74c54e5df4eb Author: Noel Grandin <noelgrandin@gmail.com> Date: Tue Nov 30 21:36:08 2021 +0200 improve OMultiTypeInterfaceContainerHelperVar2::disposeAndClear spotted by sberg Change-Id: I45316c29d82c5ece4c0ff9faa40f656b5aab3c0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126166 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-01improve OMultiTypeInterfaceContainerHelperVar2::disposeAndClearNoel Grandin
no need to create an array, just move/empty the map in one step Change-Id: I6480d671ca0542c4a871756df1eeee257087db5c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126154 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-29OInterfaceContainerHelper3 needs to be thread-safeNoel Grandin
Change-Id: I11b84917033073d29268e61175faf43cbd5b1168 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125986 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>