1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Move EnumString to separate file and add enum_to_string (#15714)

This commit is contained in:
cx384 2025-01-26 19:17:14 +01:00 committed by GitHub
parent bee541f378
commit e9826f7819
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 90 additions and 75 deletions

17
src/util/enum_string.h Normal file
View file

@ -0,0 +1,17 @@
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2025 cx384
#pragma once
#include <string_view>
struct EnumString
{
int num;
const char *str;
};
bool string_to_enum(const EnumString *spec, int &result, std::string_view str);
const char *enum_to_string(const EnumString *spec, int num);