mirror of
https://github.com/matrix-construct/construct
synced 2024-10-31 19:08:59 +01:00
ircd::versions: Declare list specialization; noexcept ctors; minor cleanup.
This commit is contained in:
parent
2d68d69b36
commit
3068466175
2 changed files with 18 additions and 5 deletions
|
@ -59,13 +59,13 @@ struct ircd::versions
|
|||
const enum type &type = type::API,
|
||||
const long &monotonic = 0,
|
||||
const std::array<long, 3> &semantic = {0L},
|
||||
const string_view &string = {});
|
||||
const string_view &string = {}) noexcept;
|
||||
|
||||
versions(const string_view &name,
|
||||
const enum type &type,
|
||||
const long &monotonic,
|
||||
const std::array<long, 3> &semantic,
|
||||
const std::function<void (versions &, const mutable_buffer &)> &generator);
|
||||
const std::function<void (versions &, const mutable_buffer &)> &generator) noexcept;
|
||||
|
||||
versions() = default;
|
||||
versions(versions &&) = delete;
|
||||
|
@ -73,6 +73,17 @@ struct ircd::versions
|
|||
~versions() noexcept;
|
||||
};
|
||||
|
||||
namespace ircd
|
||||
{
|
||||
template<>
|
||||
decltype(versions::allocator)
|
||||
instance_list<versions>::allocator;
|
||||
|
||||
template<>
|
||||
decltype(versions::list)
|
||||
instance_list<versions>::list;
|
||||
}
|
||||
|
||||
inline ircd::versions::operator
|
||||
const long &()
|
||||
const
|
||||
|
|
|
@ -21,7 +21,7 @@ template<>
|
|||
decltype(ircd::util::instance_list<ircd::versions>::list)
|
||||
ircd::util::instance_list<ircd::versions>::list
|
||||
{
|
||||
allocator
|
||||
allocator
|
||||
};
|
||||
|
||||
/// Straightforward construction of versions members; string is copied
|
||||
|
@ -31,10 +31,11 @@ ircd::versions::versions(const string_view &name,
|
|||
const long &monotonic,
|
||||
const std::array<long, 3> &semantic,
|
||||
const string_view &string)
|
||||
noexcept
|
||||
:versions
|
||||
{
|
||||
name, type, monotonic, semantic, [&string]
|
||||
(auto &that, const mutable_buffer &buf)
|
||||
(auto &that, const mutable_buffer &buf) noexcept
|
||||
{
|
||||
strlcpy(buf, string);
|
||||
}
|
||||
|
@ -49,6 +50,7 @@ ircd::versions::versions(const string_view &name,
|
|||
const long &monotonic,
|
||||
const std::array<long, 3> &semantic,
|
||||
const std::function<void (versions &, const mutable_buffer &)> &closure)
|
||||
noexcept
|
||||
:name{name}
|
||||
,type{type}
|
||||
,monotonic{monotonic}
|
||||
|
@ -61,7 +63,7 @@ ircd::versions::versions(const string_view &name,
|
|||
}
|
||||
catch(const std::exception &e)
|
||||
{
|
||||
log::error
|
||||
log::critical
|
||||
{
|
||||
"Querying %s version of '%s' :%s",
|
||||
type == type::ABI? "ABI"_sv : "API"_sv,
|
||||
|
|
Loading…
Reference in a new issue