Commit c4e7ed8c authored by Kamal Marhubi's avatar Kamal Marhubi

Remove indirection through parseJsonValue

parent b6477c2e
...@@ -45,12 +45,6 @@ struct FieldHash { ...@@ -45,12 +45,6 @@ struct FieldHash {
} // namespace } // namespace
namespace _ { // private
void parseJsonValue(kj::ArrayPtr<const char> input, JsonValue::Builder output);
} // namespace _ (private)
struct JsonCodec::Impl { struct JsonCodec::Impl {
bool prettyPrint = false; bool prettyPrint = false;
...@@ -221,10 +215,6 @@ kj::String JsonCodec::encodeRaw(JsonValue::Reader value) const { ...@@ -221,10 +215,6 @@ kj::String JsonCodec::encodeRaw(JsonValue::Reader value) const {
return impl->encodeRaw(value, 0, multiline, false).flatten(); return impl->encodeRaw(value, 0, multiline, false).flatten();
} }
void JsonCodec::decodeRaw(kj::ArrayPtr<const char> input, JsonValue::Builder output) const {
_::parseJsonValue(input, output);
}
void JsonCodec::encode(DynamicValue::Reader input, Type type, JsonValue::Builder output) const { void JsonCodec::encode(DynamicValue::Reader input, Type type, JsonValue::Builder output) const {
// TODO(soon): For interfaces, check for handlers on superclasses, per documentation... // TODO(soon): For interfaces, check for handlers on superclasses, per documentation...
// TODO(soon): For branded types, should we check for handlers on the generic? // TODO(soon): For branded types, should we check for handlers on the generic?
...@@ -382,7 +372,7 @@ Orphan<DynamicValue> JsonCodec::decode( ...@@ -382,7 +372,7 @@ Orphan<DynamicValue> JsonCodec::decode(
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
namespace _ { // private namespace {
class Parser { class Parser {
public: public:
...@@ -616,15 +606,15 @@ const kj::ArrayPtr<const char> Parser::NULL_ = kj::ArrayPtr<const char>({'n','u' ...@@ -616,15 +606,15 @@ const kj::ArrayPtr<const char> Parser::NULL_ = kj::ArrayPtr<const char>({'n','u'
const kj::ArrayPtr<const char> Parser::FALSE = kj::ArrayPtr<const char>({'f','a','l','s','e'}); const kj::ArrayPtr<const char> Parser::FALSE = kj::ArrayPtr<const char>({'f','a','l','s','e'});
const kj::ArrayPtr<const char> Parser::TRUE = kj::ArrayPtr<const char>({'t','r','u','e'}); const kj::ArrayPtr<const char> Parser::TRUE = kj::ArrayPtr<const char>({'t','r','u','e'});
} // namespace
void parseJsonValue(kj::ArrayPtr<const char> input, JsonValue::Builder output) { void JsonCodec::decodeRaw(kj::ArrayPtr<const char> input, JsonValue::Builder output) const {
// TODO(security): should we check there are no non-whitespace characters left in input? // TODO(security): should we check there are no non-whitespace characters left in input?
Parser parser(input); Parser parser(input);
parser.parseValue(output); parser.parseValue(output);
} }
} // namespace _ (private)
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
Orphan<DynamicValue> JsonCodec::HandlerBase::decodeBase( Orphan<DynamicValue> JsonCodec::HandlerBase::decodeBase(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment