libeuropa: Clean up and remove some unreferenced code

There's no better time than now!
This commit is contained in:
Lily Tsuru 2025-01-15 21:59:07 -05:00
parent 452a82b079
commit 18635002f2
4 changed files with 8 additions and 46 deletions

View file

@ -13,7 +13,7 @@
namespace europa::util {
/// Aligns a integral (e.g: file offset) to the provided value.
/// Aligns a integral value (e.g: file offset) by the provided alignment.
template <class T>
constexpr T AlignBy(T value, std::size_t alignment) {
return static_cast<T>(((value + (alignment - 1)) & ~(alignment - 1)));

View file

@ -14,12 +14,12 @@
namespace europa::util {
/**
* A multi-endian, compile-time FourCC generator.
* You love to see it.
*/
/// Compile-time endian-safe FourCC.
template <FixedString fccString, std::endian Endian = std::endian::little>
consteval std::uint32_t FourCC() {
// FIXME: It may be useful to *optionally* add policy support
// some FourCC clients prefer '\0' padding, some prefer ' ' (0x20) padding
// Idk. Pretty useless here though so idk
static_assert(fccString.Length() == 4, "Provided string is not a FourCC");
switch(Endian) {
@ -30,9 +30,9 @@ namespace europa::util {
return (fccString[0] << 24) | (fccString[1] << 16) | (fccString[2] << 8) | fccString[3];
}
// Just return something with all possible bits set, if the user somehow
// got around the above switch (which shouldn't happen).
return 0xffffffff;
// If the user provided an invalid case, do something which is
// constexpr-unsafe to indicate user error.
throw 0xffffffff; // You passed an invalid Endian to FourCC()?
}
} // namespace europa::util

View file

@ -1,37 +0,0 @@
//
// EuropaTools
//
// (C) 2021-2025 modeco80 <lily.modeco80@protonmail.ch>
//
// SPDX-License-Identifier: MIT
//
#ifndef EUROPA_UTIL_TUPLEELEMENT_H
#define EUROPA_UTIL_TUPLEELEMENT_H
#include <cstdint>
#include <cstddef>
#include <tuple>
namespace europa::util {
namespace detail {
template<std::size_t N>
struct TupleElementImpl {
template<typename T>
constexpr decltype(auto) operator()(T&& t) const {
using std::get;
return get<N>(std::forward<T>(t));
}
};
template<std::size_t N>
inline constexpr TupleElementImpl<N> TupleElement;
}
using detail::TupleElement;
}
#endif // EUROPA_UTIL_TUPLEELEMENT_H

View file

@ -12,7 +12,6 @@
#include <europa/structs/Pak.hpp>
#include <europa/util/AlignHelpers.hpp>
#include <europa/util/Overloaded.hpp>
#include <europa/util/TupleElement.hpp>
#include <europa/util/UsefulConstants.hpp>
#include <filesystem>
#include <fstream>