summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorPhilipp Hofer <philipp.hofer@protonmail.com>2020-11-12 12:51:27 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2020-11-13 15:11:37 +0100
commitd66683f86a719b9961a076237aba07d6b4fea359 (patch)
tree06de2df8181b0ff8602c6753860b2f2697f3168b /comphelper
parent79368f81028a05f1d3685f0052806d3f93cd2da8 (diff)
tdf#123936 Formatting files in module comphelper with clang-format
Change-Id: I01cf258f8fedb4d98f64d2a18735764463f1b2af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105653 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/qa/unit/base64_test.cxx15
-rw-r--r--comphelper/qa/weakbag/test_weakbag.cxx19
-rw-r--r--comphelper/source/misc/fileurl.cxx4
-rw-r--r--comphelper/source/misc/random.cxx20
-rw-r--r--comphelper/source/misc/simplefileaccessinteraction.cxx25
-rw-r--r--comphelper/source/misc/types.cxx37
6 files changed, 52 insertions, 68 deletions
diff --git a/comphelper/qa/unit/base64_test.cxx b/comphelper/qa/unit/base64_test.cxx
index 97f7b78aae7a..dd89951e6430 100644
--- a/comphelper/qa/unit/base64_test.cxx
+++ b/comphelper/qa/unit/base64_test.cxx
@@ -30,12 +30,11 @@
using namespace css;
-namespace {
-
+namespace
+{
class Base64Test : public CppUnit::TestFixture
{
public:
-
void testBase64Encode();
void testBase64Decode();
void testBase64EncodeForOStringBuffer();
@@ -73,15 +72,18 @@ void Base64Test::testBase64Decode()
uno::Sequence<sal_Int8> expectedSequence = { 0, 0, 0, 0, 0, 1, 2, 3 };
comphelper::Base64::decode(decodedSequence, "AAAAAAABAgM=");
- CPPUNIT_ASSERT(std::equal(expectedSequence.begin(), expectedSequence.end(), decodedSequence.begin()));
+ CPPUNIT_ASSERT(
+ std::equal(expectedSequence.begin(), expectedSequence.end(), decodedSequence.begin()));
expectedSequence = { 5, 2, 3, 0, 0, 1, 2, 3 };
comphelper::Base64::decode(decodedSequence, "BQIDAAABAgM=");
- CPPUNIT_ASSERT(std::equal(expectedSequence.begin(), expectedSequence.end(), decodedSequence.begin()));
+ CPPUNIT_ASSERT(
+ std::equal(expectedSequence.begin(), expectedSequence.end(), decodedSequence.begin()));
expectedSequence = { sal_Int8(sal_uInt8(200)), 31, 77, 111, 0, 1, 2, 3 };
comphelper::Base64::decode(decodedSequence, "yB9NbwABAgM=");
- CPPUNIT_ASSERT(std::equal(expectedSequence.begin(), expectedSequence.end(), decodedSequence.begin()));
+ CPPUNIT_ASSERT(
+ std::equal(expectedSequence.begin(), expectedSequence.end(), decodedSequence.begin()));
}
void Base64Test::testBase64EncodeForOStringBuffer()
@@ -105,7 +107,6 @@ void Base64Test::testBase64EncodeForOStringBuffer()
}
CPPUNIT_TEST_SUITE_REGISTRATION(Base64Test);
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/comphelper/qa/weakbag/test_weakbag.cxx b/comphelper/qa/weakbag/test_weakbag.cxx
index d58c12501633..b646ca7aef42 100644
--- a/comphelper/qa/weakbag/test_weakbag.cxx
+++ b/comphelper/qa/weakbag/test_weakbag.cxx
@@ -26,15 +26,17 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/plugin/TestPlugIn.h>
-namespace {
-
-class Test: public CppUnit::TestFixture {
+namespace
+{
+class Test : public CppUnit::TestFixture
+{
public:
- void test() {
- css::uno::Reference< css::uno::XInterface > ref1(new cppu::OWeakObject);
- css::uno::Reference< css::uno::XInterface > ref2(new cppu::OWeakObject);
- css::uno::Reference< css::uno::XInterface > ref3(new cppu::OWeakObject);
- comphelper::WeakBag< css::uno::XInterface > bag;
+ void test()
+ {
+ css::uno::Reference<css::uno::XInterface> ref1(new cppu::OWeakObject);
+ css::uno::Reference<css::uno::XInterface> ref2(new cppu::OWeakObject);
+ css::uno::Reference<css::uno::XInterface> ref3(new cppu::OWeakObject);
+ comphelper::WeakBag<css::uno::XInterface> bag;
bag.add(ref1);
bag.add(ref1);
bag.add(ref2);
@@ -54,7 +56,6 @@ public:
};
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/comphelper/source/misc/fileurl.cxx b/comphelper/source/misc/fileurl.cxx
index 9abf1a97f62d..4f361ab4ba7a 100644
--- a/comphelper/source/misc/fileurl.cxx
+++ b/comphelper/source/misc/fileurl.cxx
@@ -22,8 +22,6 @@
#include <comphelper/fileurl.hxx>
#include <rtl/ustring.hxx>
-bool comphelper::isFileUrl(OUString const & url) {
- return url.startsWithIgnoreAsciiCase("file:");
-}
+bool comphelper::isFileUrl(OUString const& url) { return url.startsWithIgnoreAsciiCase("file:"); }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/comphelper/source/misc/random.cxx b/comphelper/source/misc/random.cxx
index 260db3a544ca..ea9e7273756b 100644
--- a/comphelper/source/misc/random.cxx
+++ b/comphelper/source/misc/random.cxx
@@ -27,17 +27,16 @@
namespace comphelper::rng
{
-
// underlying random number generator
// std::mt19937 implements the Mersenne twister algorithm which
// is fast and has good statistical properties, it produces integers
// in the range of [0, 2^32-1] internally
// memory requirement: 625*sizeof(uint32_t)
// http://en.wikipedia.org/wiki/Mersenne_twister
-#define STD_RNG_ALGO std::mt19937
-
-namespace {
+#define STD_RNG_ALGO std::mt19937
+namespace
+{
struct RandomNumberGenerator
{
std::mutex mutex;
@@ -75,15 +74,16 @@ struct RandomNumberGenerator
}
};
-class theRandomNumberGenerator : public rtl::Static<RandomNumberGenerator, theRandomNumberGenerator> {};
-
+class theRandomNumberGenerator : public rtl::Static<RandomNumberGenerator, theRandomNumberGenerator>
+{
+};
}
// uniform ints [a,b] distribution
int uniform_int_distribution(int a, int b)
{
std::uniform_int_distribution<int> dist(a, b);
- auto & gen = theRandomNumberGenerator::get();
+ auto& gen = theRandomNumberGenerator::get();
std::scoped_lock<std::mutex> g(gen.mutex);
return dist(gen.global_rng);
}
@@ -92,7 +92,7 @@ int uniform_int_distribution(int a, int b)
unsigned int uniform_uint_distribution(unsigned int a, unsigned int b)
{
std::uniform_int_distribution<unsigned int> dist(a, b);
- auto & gen = theRandomNumberGenerator::get();
+ auto& gen = theRandomNumberGenerator::get();
std::scoped_lock<std::mutex> g(gen.mutex);
return dist(gen.global_rng);
}
@@ -101,7 +101,7 @@ unsigned int uniform_uint_distribution(unsigned int a, unsigned int b)
size_t uniform_size_distribution(size_t a, size_t b)
{
std::uniform_int_distribution<size_t> dist(a, b);
- auto & gen = theRandomNumberGenerator::get();
+ auto& gen = theRandomNumberGenerator::get();
std::scoped_lock<std::mutex> g(gen.mutex);
return dist(gen.global_rng);
}
@@ -111,7 +111,7 @@ double uniform_real_distribution(double a, double b)
{
assert(a < b);
std::uniform_real_distribution<double> dist(a, b);
- auto & gen = theRandomNumberGenerator::get();
+ auto& gen = theRandomNumberGenerator::get();
std::scoped_lock<std::mutex> g(gen.mutex);
return dist(gen.global_rng);
}
diff --git a/comphelper/source/misc/simplefileaccessinteraction.cxx b/comphelper/source/misc/simplefileaccessinteraction.cxx
index aaf9d280e7b7..2840e3dad0e7 100644
--- a/comphelper/source/misc/simplefileaccessinteraction.cxx
+++ b/comphelper/source/misc/simplefileaccessinteraction.cxx
@@ -16,8 +16,8 @@
#include <com/sun/star/ucb/InteractiveNetworkException.hpp>
#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
-namespace comphelper {
-
+namespace comphelper
+{
/// Will handle com::sun::star::ucb::InteractiveIOException and derived classes
const sal_Int32 HANDLE_INTERACTIVEIOEXCEPTION = 0;
/// Will handle com::sun::star::ucb::UnsupportedDataSinkException
@@ -30,10 +30,10 @@ const sal_Int32 HANDLE_CERTIFICATEREQUEST = 3;
const sal_Int32 HANDLE_AUTHENTICATIONREQUEST = 4;
SimpleFileAccessInteraction::SimpleFileAccessInteraction(
- const css::uno::Reference< css::task::XInteractionHandler >& xHandler )
+ const css::uno::Reference<css::task::XInteractionHandler>& xHandler)
{
- std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest > lInterceptions;
- ::ucbhelper::InterceptedInteraction::InterceptedRequest aInterceptedRequest;
+ std::vector<::ucbhelper::InterceptedInteraction::InterceptedRequest> lInterceptions;
+ ::ucbhelper::InterceptedInteraction::InterceptedRequest aInterceptedRequest;
//intercept standard IO error exception (local file and WebDAV)
aInterceptedRequest.Handle = HANDLE_INTERACTIVEIOEXCEPTION;
@@ -69,16 +69,14 @@ SimpleFileAccessInteraction::SimpleFileAccessInteraction(
setInterceptions(lInterceptions);
}
-SimpleFileAccessInteraction::~SimpleFileAccessInteraction()
-{
-}
+SimpleFileAccessInteraction::~SimpleFileAccessInteraction() {}
ucbhelper::InterceptedInteraction::EInterceptionState SimpleFileAccessInteraction::intercepted(
const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest,
- const css::uno::Reference< css::task::XInteractionRequest >& xRequest)
+ const css::uno::Reference<css::task::XInteractionRequest>& xRequest)
{
bool bAbort = false;
- switch(aRequest.Handle)
+ switch (aRequest.Handle)
{
case HANDLE_UNSUPPORTEDDATASINKEXCEPTION:
case HANDLE_INTERACTIVENETWORKEXCEPTION:
@@ -119,10 +117,9 @@ ucbhelper::InterceptedInteraction::EInterceptionState SimpleFileAccessInteractio
// any selection...
if (bAbort)
{
- css::uno::Reference< css::task::XInteractionContinuation > xAbort =
- ::ucbhelper::InterceptedInteraction::extractContinuation(
- xRequest->getContinuations(),
- cppu::UnoType<css::task::XInteractionAbort>::get() );
+ css::uno::Reference<css::task::XInteractionContinuation> xAbort
+ = ::ucbhelper::InterceptedInteraction::extractContinuation(
+ xRequest->getContinuations(), cppu::UnoType<css::task::XInteractionAbort>::get());
if (!xAbort.is())
return ::ucbhelper::InterceptedInteraction::E_NO_CONTINUATION_FOUND;
return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED;
diff --git a/comphelper/source/misc/types.cxx b/comphelper/source/misc/types.cxx
index 0818dcc54bdd..30981f3bd6c8 100644
--- a/comphelper/source/misc/types.cxx
+++ b/comphelper/source/misc/types.cxx
@@ -27,11 +27,8 @@
#include <typelib/typedescription.hxx>
#include <sal/log.hxx>
-
namespace comphelper
{
-
-
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::lang;
@@ -39,57 +36,51 @@ using namespace ::com::sun::star::lang;
sal_Int64 getINT64(const Any& _rAny)
{
sal_Int64 nReturn = 0;
- if(!(_rAny >>= nReturn))
+ if (!(_rAny >>= nReturn))
SAL_WARN("comphelper", "conversion from Any to sal_Int64 failed");
return nReturn;
}
-
sal_Int32 getINT32(const Any& _rAny)
{
sal_Int32 nReturn = 0;
- if(!(_rAny >>= nReturn))
+ if (!(_rAny >>= nReturn))
SAL_WARN("comphelper", "conversion from Any to sal_Int32 failed");
return nReturn;
}
-
sal_Int16 getINT16(const Any& _rAny)
{
sal_Int16 nReturn = 0;
- if(!(_rAny >>= nReturn))
+ if (!(_rAny >>= nReturn))
SAL_WARN("comphelper", "conversion from Any to sal_Int16 failed");
return nReturn;
}
-
double getDouble(const Any& _rAny)
{
double nReturn = 0.0;
- if(!(_rAny >>= nReturn))
+ if (!(_rAny >>= nReturn))
SAL_WARN("comphelper", "conversion from Any to double failed");
return nReturn;
}
-
float getFloat(const Any& _rAny)
{
float nReturn = 0.0;
- if(!(_rAny >>= nReturn))
+ if (!(_rAny >>= nReturn))
SAL_WARN("comphelper", "conversion from Any to float failed");
return nReturn;
}
-
OUString getString(const Any& _rAny)
{
OUString nReturn;
- if(!(_rAny >>= nReturn))
+ if (!(_rAny >>= nReturn))
SAL_WARN("comphelper", "conversion from Any to OUString failed");
return nReturn;
}
-
bool getBOOL(const Any& _rAny)
{
bool bReturn = false;
@@ -100,17 +91,15 @@ bool getBOOL(const Any& _rAny)
return bReturn;
}
-
sal_Int32 getEnumAsINT32(const Any& _rAny)
{
sal_Int32 nReturn = 0;
- if (! ::cppu::enum2int(nReturn,_rAny) )
+ if (!::cppu::enum2int(nReturn, _rAny))
throw IllegalArgumentException();
return nReturn;
}
-
-FontDescriptor getDefaultFont()
+FontDescriptor getDefaultFont()
{
FontDescriptor aReturn;
aReturn.Slant = FontSlant_DONTKNOW;
@@ -119,7 +108,6 @@ FontDescriptor getDefaultFont()
return aReturn;
}
-
bool isAssignableFrom(const Type& _rAssignable, const Type& _rFrom)
{
// get the type lib descriptions
@@ -136,14 +124,14 @@ bool isAssignableFrom(const Type& _rAssignable, const Type& _rFrom)
Type getSequenceElementType(const Type& _rSequenceType)
{
OSL_ENSURE(_rSequenceType.getTypeClass() == TypeClass_SEQUENCE,
- "getSequenceElementType: must be called with a sequence type!");
+ "getSequenceElementType: must be called with a sequence type!");
if (_rSequenceType.getTypeClass() != TypeClass_SEQUENCE)
return Type();
TypeDescription aTD(_rSequenceType);
- typelib_IndirectTypeDescription* pSequenceTD =
- reinterpret_cast< typelib_IndirectTypeDescription* >(aTD.get());
+ typelib_IndirectTypeDescription* pSequenceTD
+ = reinterpret_cast<typelib_IndirectTypeDescription*>(aTD.get());
OSL_ASSERT(pSequenceTD && pSequenceTD->pType);
if (pSequenceTD && pSequenceTD->pType)
@@ -152,7 +140,6 @@ Type getSequenceElementType(const Type& _rSequenceType)
return Type();
}
-} // namespace comphelper
-
+} // namespace comphelper
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */