0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 08:12:37 +01:00

ircd::conf: Add nothrow overloads to get() suite.

This commit is contained in:
Jason Volk 2023-01-19 11:04:56 -08:00
parent 377179a52f
commit 829e641a48
2 changed files with 31 additions and 0 deletions

View file

@ -64,12 +64,18 @@ namespace ircd::conf
bool exists(const string_view &key) noexcept;
bool environ(const string_view &key) noexcept;
bool persists(const string_view &key);
string_view get(std::nothrow_t, const mutable_buffer &out, const string_view &key);
std::string get(std::nothrow_t, const string_view &key);
string_view get(const mutable_buffer &out, const string_view &key);
std::string get(const string_view &key);
bool set(const string_view &key, const string_view &value);
bool set(std::nothrow_t, const string_view &key, const string_view &value);
bool fault(std::nothrow_t, const string_view &key) noexcept;
void fault(const string_view &key);
bool reset(std::nothrow_t, const string_view &key);
bool reset(const string_view &key);
size_t reset();

View file

@ -186,6 +186,31 @@ catch(const std::out_of_range &e)
};
}
std::string
ircd::conf::get(std::nothrow_t,
const string_view &key)
{
const auto it(items.find(key));
if(it == end(items))
return {};
const auto &item(*it->second);
return item.get();
}
ircd::string_view
ircd::conf::get(std::nothrow_t,
const mutable_buffer &out,
const string_view &key)
{
const auto it(items.find(key));
if(it == end(items))
return {};
const auto &item(*it->second);
return item.get(out);
}
bool
ircd::conf::persists(const string_view &key)
try