mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Fixup Val.h/Val.cc: Actually move ValFromJSON into zeek::detail
Lost during merge..
This commit is contained in:
parent
264284150b
commit
1facc34e09
4 changed files with 9 additions and 2 deletions
4
CHANGES
4
CHANGES
|
@ -1,3 +1,7 @@
|
||||||
|
6.0.0-dev.519 | 2023-05-09 11:03:32 +0200
|
||||||
|
|
||||||
|
* Fixup Val.h/Val.cc: Actually move ValFromJSON into zeek::detail (Arne Welzel, Corelight)
|
||||||
|
|
||||||
6.0.0-dev.518 | 2023-05-09 10:19:46 +0200
|
6.0.0-dev.518 | 2023-05-09 10:19:46 +0200
|
||||||
|
|
||||||
* Implement from_json bif (Fupeng Zhao)
|
* Implement from_json bif (Fupeng Zhao)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
6.0.0-dev.518
|
6.0.0-dev.519
|
||||||
|
|
|
@ -1379,7 +1379,7 @@ static std::variant<ValPtr, std::string> BuildVal(const rapidjson::Value& j, con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::variant<ValPtr, std::string> ValFromJSON(std::string_view json_str, const TypePtr& t)
|
std::variant<ValPtr, std::string> detail::ValFromJSON(std::string_view json_str, const TypePtr& t)
|
||||||
{
|
{
|
||||||
rapidjson::Document doc;
|
rapidjson::Document doc;
|
||||||
rapidjson::ParseResult ok = doc.Parse(json_str.data(), json_str.length());
|
rapidjson::ParseResult ok = doc.Parse(json_str.data(), json_str.length());
|
||||||
|
|
|
@ -1795,9 +1795,12 @@ extern bool can_cast_value_to_type(const Val* v, Type* t);
|
||||||
// specific instance later.
|
// specific instance later.
|
||||||
extern bool can_cast_value_to_type(const Type* s, Type* t);
|
extern bool can_cast_value_to_type(const Type* s, Type* t);
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
// Parses a JSON string into arbitrary Zeek data using std::variant to simulate functional exception
|
// Parses a JSON string into arbitrary Zeek data using std::variant to simulate functional exception
|
||||||
// handling. Returns a ValPtr if parsing was successful, or a std::string containing an error
|
// handling. Returns a ValPtr if parsing was successful, or a std::string containing an error
|
||||||
// message if an error occurred.
|
// message if an error occurred.
|
||||||
extern std::variant<ValPtr, std::string> ValFromJSON(std::string_view json_str, const TypePtr& t);
|
extern std::variant<ValPtr, std::string> ValFromJSON(std::string_view json_str, const TypePtr& t);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace zeek
|
} // namespace zeek
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue