Seafire-Server/seafire/server/parameters.hxx
2025-03-07 22:15:36 +01:00

63 lines
999 B
C++

#ifndef seafire__server__parameters_hxx_
#define seafire__server__parameters_hxx_
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <optional>
#include <string>
namespace seafire::server
{
template<std::size_t N>
struct parameter_name_t
{
constexpr parameter_name_t(const char (&str)[N])
{
std::copy_n(str, N, name);
}
operator std::string const() const
{
return name;
}
char name[N];
};
struct string_parameter_t
{
using value_type = std::string;
static
std::optional<value_type>
try_parse(std::optional<std::string> const&);
};
struct int_parameter_t
{
using value_type = std::int64_t;
static
std::optional<value_type>
try_parse(std::optional<std::string> const&);
};
struct uint_parameter_t
{
using value_type = std::uint64_t;
static
std::optional<value_type>
try_parse(std::optional<std::string> const&);
};
} // namespace seafire::server
#endif