Add DataFormat enum
This commit is contained in:
23
openVulkanoCpp/Scene/DataFormat.cpp
Normal file
23
openVulkanoCpp/Scene/DataFormat.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "DataFormat.hpp"
|
||||
#include <magic_enum.hpp>
|
||||
|
||||
namespace openVulkanoCpp
|
||||
{
|
||||
std::string_view DataFormat::GetName() const
|
||||
{
|
||||
return magic_enum::enum_name(m_format);
|
||||
}
|
||||
|
||||
DataFormat DataFormat::GetFromName(std::string_view name)
|
||||
{
|
||||
auto result = magic_enum::enum_cast<Format>(name);
|
||||
if (result.has_value()) return { result.value() };
|
||||
return { UNDEFINED };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user