mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'amazing-pp/topic/fupeng/from_json_bif'
* amazing-pp/topic/fupeng/from_json_bif: Implement from_json bif Minor updates during merge: Moved ValFromJSON into zeek::detail for the time being, removed gotos, normalized some error messages to lower case, minimal test extension and added a raw reader input framework test reading "json lines" as a demo, adding notes about the implicit type conversions.
This commit is contained in:
commit
264284150b
34 changed files with 695 additions and 2 deletions
|
@ -6,6 +6,7 @@
|
|||
#include <array>
|
||||
#include <list>
|
||||
#include <unordered_map>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
#include "zeek/IntrusivePtr.h"
|
||||
|
@ -1794,4 +1795,9 @@ extern bool can_cast_value_to_type(const Val* v, Type* t);
|
|||
// specific instance later.
|
||||
extern bool can_cast_value_to_type(const Type* s, Type* t);
|
||||
|
||||
// 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
|
||||
// message if an error occurred.
|
||||
extern std::variant<ValPtr, std::string> ValFromJSON(std::string_view json_str, const TypePtr& t);
|
||||
|
||||
} // namespace zeek
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue