summaryrefslogtreecommitdiffstats
path: root/include/o3tl
diff options
context:
space:
mode:
authorPhilipp Hofer <philipp.hofer@protonmail.com>2020-11-12 13:03:16 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2020-11-21 13:19:17 +0100
commit01baeab99890e5650b3dabc15f8d900490a5a133 (patch)
tree64a1b30b20a53262605312fff4d035876fc7c811 /include/o3tl
parenttdf#123936 Formatting files in module starmath with clang-format (diff)
downloadcore-01baeab99890e5650b3dabc15f8d900490a5a133.tar.gz
core-01baeab99890e5650b3dabc15f8d900490a5a133.zip
tdf#123936 Formatting files in module include with clang-format
Change-Id: I0507dd797cd5a35e0ae14f4b69ee4e172d08a71a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105681 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Jenkins
Diffstat (limited to 'include/o3tl')
-rw-r--r--include/o3tl/deleter.hxx11
-rw-r--r--include/o3tl/lru_map.hxx21
-rw-r--r--include/o3tl/make_shared.hxx10
-rw-r--r--include/o3tl/runtimetooustring.hxx17
4 files changed, 24 insertions, 35 deletions
diff --git a/include/o3tl/deleter.hxx b/include/o3tl/deleter.hxx
index a886acb03d3c..7cb9145eb2a1 100644
--- a/include/o3tl/deleter.hxx
+++ b/include/o3tl/deleter.hxx
@@ -17,15 +17,15 @@
#include <com/sun/star/uno/Exception.hpp>
#include <sal/log.hxx>
-namespace o3tl {
-
+namespace o3tl
+{
/** To markup std::unique_ptr that coverity warns might throw exceptions
which won't throw in practice, or where std::terminate is
an acceptable response if they do
*/
-template<typename T> struct default_delete
+template <typename T> struct default_delete
{
- void operator() (T* p) noexcept
+ void operator()(T* p) noexcept
{
#if defined(__COVERITY__)
try
@@ -53,7 +53,7 @@ struct free_delete
void operator()(void* p) { std::free(p); }
};
-template<typename uniqueptr> void reset_preserve_ptr_during(uniqueptr& ptr)
+template <typename uniqueptr> void reset_preserve_ptr_during(uniqueptr& ptr)
{
// HACK: for the case where the dtor of the obj held by ptr will trigger
// functions which expect ptr to still be set during the dtor.
@@ -62,7 +62,6 @@ template<typename uniqueptr> void reset_preserve_ptr_during(uniqueptr& ptr)
delete ptr.get();
(void)ptr.release();
}
-
}
#endif
diff --git a/include/o3tl/lru_map.hxx b/include/o3tl/lru_map.hxx
index e822fde0294c..c7132fd079c4 100644
--- a/include/o3tl/lru_map.hxx
+++ b/include/o3tl/lru_map.hxx
@@ -17,7 +17,6 @@
namespace o3tl
{
-
/** LRU map
*
* Similar to unordered_map (it actually uses it) with additionally functionality
@@ -31,7 +30,8 @@ namespace o3tl
* for most of the operations with a combination unordered map and linked list.
*
**/
-template<typename Key, typename Value, class KeyHash = std::hash<Key>, class KeyEqual = std::equal_to<Key>>
+template <typename Key, typename Value, class KeyHash = std::hash<Key>,
+ class KeyEqual = std::equal_to<Key>>
class lru_map final
{
public:
@@ -68,7 +68,8 @@ public:
// a size of 0 effectively disables the LRU cleanup code
lru_map(size_t nMaxSize)
: mMaxSize(nMaxSize ? nMaxSize : std::min(mLruMap.max_size(), mLruList.max_size()))
- {}
+ {
+ }
~lru_map()
{
// Some code .e.g. SalBitmap likes to remove itself from a cache during it's destructor, which means we
@@ -139,8 +140,7 @@ public:
}
// reverse-iterates the list removing all items matching the predicate
- template<class UnaryPredicate>
- void remove_if(UnaryPredicate pred)
+ template <class UnaryPredicate> void remove_if(UnaryPredicate pred)
{
auto it = mLruList.rbegin();
while (it != mLruList.rend())
@@ -155,15 +155,9 @@ public:
}
}
- list_const_iterator_t begin() const
- {
- return mLruList.cbegin();
- }
+ list_const_iterator_t begin() const { return mLruList.cbegin(); }
- list_const_iterator_t end() const
- {
- return mLruList.cend();
- }
+ list_const_iterator_t end() const { return mLruList.cend(); }
size_t size() const
{
@@ -177,7 +171,6 @@ public:
mLruList.clear();
}
};
-
}
#endif /* INCLUDED_O3TL_LRU_MAP_HXX */
diff --git a/include/o3tl/make_shared.hxx b/include/o3tl/make_shared.hxx
index 9d7998fd5a36..5d4d98e42b3a 100644
--- a/include/o3tl/make_shared.hxx
+++ b/include/o3tl/make_shared.hxx
@@ -14,14 +14,13 @@
#include <memory>
#include <type_traits>
-namespace o3tl {
-
+namespace o3tl
+{
/** Allocate an array stored in a shared_ptr, calling operator delete[].
Note that this is only allowed for arithmetic types because shared_ptr
implicitly converts to sub-types.
*/
-template<typename T>
-std::shared_ptr<T> make_shared_array(size_t const size)
+template <typename T> std::shared_ptr<T> make_shared_array(size_t const size)
{
static_assert(std::is_arithmetic<T>::value, "only arrays of arithmetic types allowed");
return std::shared_ptr<T>(new T[size], std::default_delete<T[]>());
@@ -31,8 +30,7 @@ std::shared_ptr<T> make_shared_array(size_t const size)
which won't throw in practice, or where std::terminate is
an acceptable response if they do
*/
-template<class T, class... Args>
-std::shared_ptr<T> make_shared(Args&&... args)
+template <class T, class... Args> std::shared_ptr<T> make_shared(Args&&... args)
{
#if defined(__COVERITY__)
return std::shared_ptr<T>(new T(std::forward<Args>(args)...), o3tl::default_delete<T>());
diff --git a/include/o3tl/runtimetooustring.hxx b/include/o3tl/runtimetooustring.hxx
index 7f2015805722..6d6f27ac186e 100644
--- a/include/o3tl/runtimetooustring.hxx
+++ b/include/o3tl/runtimetooustring.hxx
@@ -20,8 +20,8 @@
#include <rtl/ustring.h>
#include <rtl/ustring.hxx>
-namespace o3tl {
-
+namespace o3tl
+{
/** Convert an NTBS from the C++ runtime to an OUString.
This is used to convert an NTBS as provided by std::exception::what or
@@ -29,18 +29,17 @@ namespace o3tl {
is done using RTL_TEXTENCODING_ISO_8859_1, so each char in the input maps
to one Unicode character in the output.
*/
-inline OUString runtimeToOUString(char const * runtimeString) {
+inline OUString runtimeToOUString(char const* runtimeString)
+{
OUString s;
bool ok = rtl_convertStringToUString(
- &s.pData, runtimeString, std::strlen(runtimeString),
- RTL_TEXTENCODING_ISO_8859_1,
- (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
- | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
+ &s.pData, runtimeString, std::strlen(runtimeString), RTL_TEXTENCODING_ISO_8859_1,
+ (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
| RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR));
- assert(ok); (void) ok;
+ assert(ok);
+ (void)ok;
return s;
}
-
}
#endif