Skip to content

Commit

Permalink
[共通] rename UUID -> UUIDValue (fix #644)
Browse files Browse the repository at this point in the history
  • Loading branch information
Reputeless committed Sep 20, 2021
1 parent 4adb42a commit 495d4fd
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 97 deletions.
2 changes: 1 addition & 1 deletion Linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ add_library(Siv3D STATIC
../Siv3D/src/Siv3D/UnicodeConverter/SivUnicodeConverter.cpp
../Siv3D/src/Siv3D/UserAction/CUserAction.cpp
../Siv3D/src/Siv3D/UserAction/UserActionFactory.cpp
../Siv3D/src/Siv3D/UUID/SivUUID.cpp
../Siv3D/src/Siv3D/UUIDValue/SivUUIDValue.cpp
../Siv3D/src/Siv3D/Vector2D/SivVector2D.cpp
../Siv3D/src/Siv3D/Vector3D/SivVector3D.cpp
../Siv3D/src/Siv3D/Vector4D/SivVector4D.cpp
Expand Down
2 changes: 1 addition & 1 deletion Siv3D/include/Siv3D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@
# include <Siv3D/Sample.hpp>

// UUID | UUID
# include <Siv3D/UUID.hpp>
# include <Siv3D/UUIDValue.hpp>

//////////////////////////////////////////////////
//
Expand Down
56 changes: 28 additions & 28 deletions Siv3D/include/Siv3D/UUID.hpp → Siv3D/include/Siv3D/UUIDValue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace s3d
{
class UUID
class UUIDValue
{
public:

Expand All @@ -42,17 +42,17 @@ namespace s3d
using value_type = uint8;

SIV3D_NODISCARD_CXX20
UUID() = default;
UUIDValue() = default;

SIV3D_NODISCARD_CXX20
explicit UUID(const value_type(&uuid)[16]) noexcept;
explicit UUIDValue(const value_type(&uuid)[16]) noexcept;

SIV3D_NODISCARD_CXX20
explicit constexpr UUID(const std::array<value_type, 16>& uuid) noexcept;
explicit constexpr UUIDValue(const std::array<value_type, 16>& uuid) noexcept;

template <class Iterator>
SIV3D_NODISCARD_CXX20
explicit UUID(Iterator first, Iterator last);
explicit UUIDValue(Iterator first, Iterator last);

[[nodiscard]]
constexpr bool isNil() const noexcept;
Expand All @@ -72,55 +72,55 @@ namespace s3d
[[nodiscard]]
constexpr const std::array<value_type, 16>& getData() const noexcept;

void swap(UUID& other);
void swap(UUIDValue& other);

[[nodiscard]]
size_t hash() const noexcept;

[[nodiscard]]
friend bool operator ==(const UUID& lhs, const UUID& rhs) noexcept
friend bool operator ==(const UUIDValue& lhs, const UUIDValue& rhs) noexcept
{
return (lhs.m_data == rhs.m_data);
}

[[nodiscard]]
friend bool operator !=(const UUID& lhs, const UUID& rhs) noexcept
friend bool operator !=(const UUIDValue& lhs, const UUIDValue& rhs) noexcept
{
return (lhs.m_data != rhs.m_data);
}

[[nodiscard]]
friend bool operator <(const UUID& lhs, const UUID& rhs) noexcept
friend bool operator <(const UUIDValue& lhs, const UUIDValue& rhs) noexcept
{
return (lhs.m_data < rhs.m_data);
}

[[nodiscard]]
static UUID Generate();
static UUIDValue Generate();

[[nodiscard]]
static UUID GenerateFromRNG(DefaultRNG& rng = GetDefaultRNG());
static UUIDValue GenerateFromRNG(DefaultRNG& rng = GetDefaultRNG());

[[nodiscard]]
static UUID GenerateFromName(const UUID& namespaceUUID, const std::string& name);
static UUIDValue GenerateFromName(const UUIDValue& namespaceUUIDValue, const std::string& name);

[[nodiscard]]
static UUID GenerateFromName(const UUID& namespaceUUID, const String& name);
static UUIDValue GenerateFromName(const UUIDValue& namespaceUUIDValue, const String& name);

[[nodiscard]]
static UUID Nil();
static UUIDValue Nil();

[[nodiscard]]
static UUID NamespaceDNS() noexcept;
static UUIDValue NamespaceDNS() noexcept;

[[nodiscard]]
static UUID NamespaceURL() noexcept;
static UUIDValue NamespaceURL() noexcept;

[[nodiscard]]
static UUID NamespaceOID() noexcept;
static UUIDValue NamespaceOID() noexcept;

[[nodiscard]]
static UUID NamespaceX500() noexcept;
static UUIDValue NamespaceX500() noexcept;

[[nodiscard]]
static bool IsValid(std::string_view uuid);
Expand All @@ -129,18 +129,18 @@ namespace s3d
static bool IsValid(StringView uuid);

[[nodiscard]]
static Optional<UUID> Parse(std::string_view uuid);
static Optional<UUIDValue> Parse(std::string_view uuid);

[[nodiscard]]
static Optional<UUID> Parse(StringView uuid);
static Optional<UUIDValue> Parse(StringView uuid);

template <class CharType>
friend std::basic_ostream<CharType>& operator <<(std::basic_ostream<CharType>& output, const UUID& value)
friend std::basic_ostream<CharType>& operator <<(std::basic_ostream<CharType>& output, const UUIDValue& value)
{
return (output << value.str());
}

friend void Formatter(FormatData& formatData, const UUID& value);
friend void Formatter(FormatData& formatData, const UUIDValue& value);

private:

Expand All @@ -149,7 +149,7 @@ namespace s3d
}

template <>
struct SIV3D_HIDDEN fmt::formatter<s3d::UUID, s3d::char32>
struct SIV3D_HIDDEN fmt::formatter<s3d::UUIDValue, s3d::char32>
{
std::u32string tag;

Expand All @@ -159,7 +159,7 @@ struct SIV3D_HIDDEN fmt::formatter<s3d::UUID, s3d::char32>
}

template <class FormatContext>
auto format(const s3d::UUID& value, FormatContext& ctx)
auto format(const s3d::UUIDValue& value, FormatContext& ctx)
{
const s3d::String s = value.str();
const basic_string_view<s3d::char32> sv(s.data(), s.size());
Expand All @@ -177,16 +177,16 @@ struct SIV3D_HIDDEN fmt::formatter<s3d::UUID, s3d::char32>
};

template <>
struct std::hash<s3d::UUID>
struct std::hash<s3d::UUIDValue>
{
[[nodiscard]]
size_t operator()(const s3d::UUID& value) const noexcept
size_t operator()(const s3d::UUIDValue& value) const noexcept
{
return value.hash();
}
};

template <>
inline void std::swap(s3d::UUID& a, s3d::UUID& b) noexcept;
inline void std::swap(s3d::UUIDValue& a, s3d::UUIDValue& b) noexcept;

# include "detail/UUID.ipp"
# include "detail/UUIDValue.ipp"
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@

namespace s3d
{
inline constexpr UUID::UUID(const std::array<value_type, 16>& uuid) noexcept
inline constexpr UUIDValue::UUIDValue(const std::array<value_type, 16>& uuid) noexcept
: m_data{ uuid } {}

template <class Iterator>
inline UUID::UUID(Iterator first, Iterator last)
inline UUIDValue::UUIDValue(Iterator first, Iterator last)
{
if (std::distance(first, last) == 16)
{
std::copy(first, last, std::begin(m_data));
}
}

inline constexpr bool UUID::isNil() const noexcept
inline constexpr bool UUIDValue::isNil() const noexcept
{
for (auto& value : m_data)
{
Expand All @@ -38,24 +38,24 @@ namespace s3d
return true;
}

inline constexpr const std::array<UUID::value_type, 16>& UUID::getData() const noexcept
inline constexpr const std::array<UUIDValue::value_type, 16>& UUIDValue::getData() const noexcept
{
return m_data;
}

inline void UUID::swap(UUID& other)
inline void UUIDValue::swap(UUIDValue& other)
{
m_data.swap(other.m_data);
}

inline size_t UUID::hash() const noexcept
inline size_t UUIDValue::hash() const noexcept
{
return Hash::FNV1a(m_data);
}
}

template <>
void std::swap(s3d::UUID& a, s3d::UUID& b) noexcept
void std::swap(s3d::UUIDValue& a, s3d::UUIDValue& b) noexcept
{
a.swap(b);
}
4 changes: 2 additions & 2 deletions Siv3D/src/Siv3D/FileSystem/SivFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//-----------------------------------------------

# include <Siv3D/FileSystem.hpp>
# include <Siv3D/UUID.hpp>
# include <Siv3D/UUIDValue.hpp>

namespace s3d
{
Expand Down Expand Up @@ -172,7 +172,7 @@ namespace s3d

for (;;)
{
const FilePath path = (directoryPath + UUID::Generate().str() + U".tmp");
const FilePath path = (directoryPath + UUIDValue::Generate().str() + U".tmp");

if (not Exists(path))
{
Expand Down
8 changes: 4 additions & 4 deletions Siv3D/src/Siv3D/Script/ScriptData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# include <Siv3D/FileSystem.hpp>
# include <Siv3D/Unicode.hpp>
# include <Siv3D/UUID.hpp>
# include <Siv3D/UUIDValue.hpp>
# include <Siv3D/EngineLog.hpp>
# include <Siv3D/Common/Siv3DEngine.hpp>
# include "IScript.hpp"
Expand All @@ -29,7 +29,7 @@ namespace s3d
ScriptData::ScriptData(Code, const StringView code, AngelScript::asIScriptEngine* const engine, const ScriptCompileOption compileOption)
: m_engine{ engine }
, m_module{ std::make_shared<ScriptModule>() }
, m_moduleName{ UUID::Generate().to_string() }
, m_moduleName{ UUIDValue::Generate().to_string() }
, m_compileOption{ compileOption }
{
m_initialized = true;
Expand Down Expand Up @@ -73,7 +73,7 @@ namespace s3d
ScriptData::ScriptData(File, const FilePathView path, AngelScript::asIScriptEngine* const engine, const ScriptCompileOption compileOption)
: m_engine{ engine }
, m_module{ std::make_shared<ScriptModule>() }
, m_moduleName{ UUID::Generate().to_string() }
, m_moduleName{ UUIDValue::Generate().to_string() }
, m_compileOption{ compileOption }
, m_fullpath{ FileSystem::FullPath(path) }
{
Expand Down Expand Up @@ -112,7 +112,7 @@ namespace s3d
}

m_module->module = m_engine->GetModule(m_moduleName.c_str());
m_moduleName = UUID::Generate().to_string();
m_moduleName = UUIDValue::Generate().to_string();
m_module->context = m_engine->CreateContext();
m_module->withLineCues = withLineCues;

Expand Down
Loading

0 comments on commit 495d4fd

Please sign in to comment.