aboutsummaryrefslogtreecommitdiff
path: root/src/crepe
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-20 14:01:31 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-20 14:01:31 +0100
commit02845c3d25130e9473604cb2eeee42a7a7a8eadf (patch)
tree71969b17161d13d044d033d0ee7fd47deadb6575 /src/crepe
parentd79148947bc43764b041687b7c6ad2d6c944f70b (diff)
`make format`
Diffstat (limited to 'src/crepe')
-rw-r--r--src/crepe/api/Asset.cpp15
-rw-r--r--src/crepe/api/Asset.h8
-rw-r--r--src/crepe/types.h4
-rw-r--r--src/crepe/util/OptionalRef.h13
-rw-r--r--src/crepe/util/OptionalRef.hpp3
5 files changed, 18 insertions, 25 deletions
diff --git a/src/crepe/api/Asset.cpp b/src/crepe/api/Asset.cpp
index 5271cf7..3fe3ceb 100644
--- a/src/crepe/api/Asset.cpp
+++ b/src/crepe/api/Asset.cpp
@@ -8,8 +8,8 @@
using namespace crepe;
using namespace std;
-Asset::Asset(const string & src) : src(find_asset(src)) { }
-Asset::Asset(const char * src) : src(find_asset(src)) { }
+Asset::Asset(const string & src) : src(find_asset(src)) {}
+Asset::Asset(const char * src) : src(find_asset(src)) {}
const string & Asset::get_path() const noexcept { return this->src; }
@@ -22,14 +22,12 @@ string Asset::find_asset(const string & src) const {
// absolute paths do not need to be resolved, only canonicalized
filesystem::path path = src;
- if (path.is_absolute())
- return filesystem::canonical(path);
+ if (path.is_absolute()) return filesystem::canonical(path);
// find directory matching root_pattern
filesystem::path root = this->whereami();
while (1) {
- if (filesystem::exists(root / root_pattern))
- break;
+ if (filesystem::exists(root / root_pattern)) break;
if (!root.has_parent_path())
throw runtime_error(format("Asset: Cannot find root pattern ({})", root_pattern));
root = root.parent_path();
@@ -48,11 +46,8 @@ string Asset::whereami() const noexcept {
return path;
}
-bool Asset::operator==(const Asset & other) const noexcept {
- return this->src == other.src;
-}
+bool Asset::operator==(const Asset & other) const noexcept { return this->src == other.src; }
size_t std::hash<const Asset>::operator()(const Asset & asset) const noexcept {
return std::hash<string>{}(asset.get_path());
};
-
diff --git a/src/crepe/api/Asset.h b/src/crepe/api/Asset.h
index 685dd3a..77596ac 100644
--- a/src/crepe/api/Asset.h
+++ b/src/crepe/api/Asset.h
@@ -33,7 +33,7 @@ public:
* \param other Possibly different instance of \c Asset to test equality against
* \return True if \c this and \c other are equal
*/
- bool operator == (const Asset & other) const noexcept;
+ bool operator==(const Asset & other) const noexcept;
private:
//! path to asset
@@ -52,7 +52,8 @@ private:
namespace std {
//! Hash helper struct
-template<> struct hash<const crepe::Asset> {
+template <>
+struct hash<const crepe::Asset> {
/**
* \brief Hash operator for crepe::Asset
*
@@ -64,5 +65,4 @@ template<> struct hash<const crepe::Asset> {
size_t operator()(const crepe::Asset & asset) const noexcept;
};
-}
-
+} // namespace std
diff --git a/src/crepe/types.h b/src/crepe/types.h
index 86730cc..914c76c 100644
--- a/src/crepe/types.h
+++ b/src/crepe/types.h
@@ -1,8 +1,8 @@
#pragma once
#include <cstdint>
-#include <vector>
#include <functional>
+#include <vector>
namespace crepe {
@@ -13,4 +13,4 @@ typedef uint32_t game_object_id_t;
template <typename T>
using RefVector = std::vector<std::reference_wrapper<T>>;
-}
+} // namespace crepe
diff --git a/src/crepe/util/OptionalRef.h b/src/crepe/util/OptionalRef.h
index 8417a25..0a94ae5 100644
--- a/src/crepe/util/OptionalRef.h
+++ b/src/crepe/util/OptionalRef.h
@@ -23,7 +23,7 @@ public:
*
* \return Reference to this (required for operator)
*/
- OptionalRef<T> & operator=(T & ref);
+ OptionalRef<T> & operator=(T & ref);
/**
* \brief Check if this reference is not empty
*
@@ -51,13 +51,13 @@ public:
void clear() noexcept;
//! Copy constructor
- OptionalRef(const OptionalRef<T> &);
+ OptionalRef(const OptionalRef<T> &);
//! Move constructor
- OptionalRef(OptionalRef<T> &&);
+ OptionalRef(OptionalRef<T> &&);
//! Copy assignment
- OptionalRef<T> & operator=(const OptionalRef<T> &);
+ OptionalRef<T> & operator=(const OptionalRef<T> &);
//! Move assignment
- OptionalRef<T> & operator=(OptionalRef<T> &&);
+ OptionalRef<T> & operator=(OptionalRef<T> &&);
private:
/**
@@ -68,7 +68,6 @@ private:
T * ref = nullptr;
};
-}
+} // namespace crepe
#include "OptionalRef.hpp"
-
diff --git a/src/crepe/util/OptionalRef.hpp b/src/crepe/util/OptionalRef.hpp
index 7b201b0..ee41f61 100644
--- a/src/crepe/util/OptionalRef.hpp
+++ b/src/crepe/util/OptionalRef.hpp
@@ -63,5 +63,4 @@ OptionalRef<T>::operator bool() const noexcept {
return this->ref != nullptr;
}
-}
-
+} // namespace crepe