-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9007790
commit 9c773ef
Showing
4 changed files
with
108 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include "virtual.h" | ||
|
||
using json = nlohmann::json; | ||
|
||
struct virtual_bench_sax : public abstract_bench_sax | ||
{ | ||
bool null() override | ||
{ | ||
return true; | ||
} | ||
bool boolean(bool) override | ||
{ | ||
return true; | ||
} | ||
bool number_integer(json::number_integer_t) override | ||
{ | ||
return true; | ||
} | ||
bool number_unsigned(json::number_unsigned_t) override | ||
{ | ||
return true; | ||
} | ||
bool number_float(json::number_float_t, const json::string_t&) override | ||
{ | ||
return true; | ||
} | ||
bool string(json::string_t& val) override | ||
{ | ||
return true; | ||
} | ||
bool start_object(std::size_t elements) override | ||
{ | ||
return true; | ||
} | ||
bool key(json::string_t& val) override | ||
{ | ||
return true; | ||
} | ||
bool end_object() override | ||
{ | ||
return true; | ||
} | ||
bool start_array(std::size_t elements) override | ||
{ | ||
return true; | ||
} | ||
bool end_array() override | ||
{ | ||
return true; | ||
} | ||
// FIXME exceptions should not be in detail | ||
bool parse_error(std::size_t position, const std::string& last_token, | ||
const nlohmann::detail::exception& ex) override | ||
{ | ||
return true; | ||
} | ||
}; | ||
|
||
abstract_bench_sax* create_virtual_sax() | ||
{ | ||
return new virtual_bench_sax; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#pragma once | ||
|
||
#include <nlohmann/json.hpp> | ||
|
||
struct abstract_bench_sax | ||
{ | ||
virtual bool null() = 0; | ||
virtual bool boolean(bool) = 0; | ||
virtual bool number_integer(nlohmann::json::number_integer_t) = 0; | ||
virtual bool number_unsigned(nlohmann::json::number_unsigned_t) = 0; | ||
virtual bool number_float(nlohmann::json::number_float_t, const nlohmann::json::string_t&) = 0; | ||
virtual bool string(nlohmann::json::string_t& val) = 0; | ||
virtual bool start_object(std::size_t elements) = 0; | ||
virtual bool key(nlohmann::json::string_t& val) = 0; | ||
virtual bool end_object() = 0; | ||
virtual bool start_array(std::size_t elements) = 0; | ||
virtual bool end_array() = 0; | ||
// FIXME exceptions should not be in detail | ||
virtual bool parse_error(std::size_t position, const std::string& last_token, | ||
const nlohmann::detail::exception& ex) = 0; | ||
}; | ||
|
||
abstract_bench_sax* create_virtual_sax(); |