mirror of
https://github.com/matrix-construct/construct
synced 2025-02-27 06:00:16 +01:00
ircd::json: Stub a canonize() function which isn't complete yet.
This commit is contained in:
parent
14f348f900
commit
d354991c68
2 changed files with 26 additions and 0 deletions
|
@ -78,6 +78,10 @@ namespace ircd::json
|
||||||
// Validate JSON - checks if canonical value.
|
// Validate JSON - checks if canonical value.
|
||||||
bool valid(const string_view &, std::nothrow_t) noexcept;
|
bool valid(const string_view &, std::nothrow_t) noexcept;
|
||||||
void valid(const string_view &);
|
void valid(const string_view &);
|
||||||
|
|
||||||
|
// Convert to canonical JSON
|
||||||
|
string_view canonize(const mutable_buffer &out, const string_view &in);
|
||||||
|
std::string canonize(const string_view &in);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Strong type representing quoted strings in JSON (which may be unquoted
|
/// Strong type representing quoted strings in JSON (which may be unquoted
|
||||||
|
|
22
ircd/json.cc
22
ircd/json.cc
|
@ -1486,6 +1486,28 @@ ircd::json::operator==(const value &a, const value &b)
|
||||||
// json.h
|
// json.h
|
||||||
//
|
//
|
||||||
|
|
||||||
|
std::string
|
||||||
|
ircd::json::canonize(const string_view &in)
|
||||||
|
{
|
||||||
|
std::string ret(size(in), char{});
|
||||||
|
ret.resize(size(canonize(mutable_buffer{ret}, in)));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
ircd::string_view
|
||||||
|
ircd::json::canonize(const mutable_buffer &out,
|
||||||
|
const string_view &in)
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//TODO: XXX
|
||||||
|
assert(0);
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
catch(const qi::expectation_failure<const char *> &e)
|
||||||
|
{
|
||||||
|
throw expectation_failure(begin(in), e);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ircd::json::valid(const string_view &s,
|
ircd::json::valid(const string_view &s,
|
||||||
std::nothrow_t)
|
std::nothrow_t)
|
||||||
|
|
Loading…
Add table
Reference in a new issue