mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 00:58:19 +00:00
Document the field_escape_pattern in the to_json() BiF
This argument, and its corresponding use in Val.cc's BuildJSON(), were never explained.
This commit is contained in:
parent
c2dd3dfad0
commit
a29f862f95
3 changed files with 41 additions and 2 deletions
23
src/Val.cc
23
src/Val.cc
|
@ -329,8 +329,27 @@ TableValPtr Val::GetRecordFields() {
|
|||
return rt->GetRecordFieldsVal(rv);
|
||||
}
|
||||
|
||||
// This is a static method in this file to avoid including rapidjson's headers in Val.h because
|
||||
// they're huge.
|
||||
// A predicate to identify those types we render as a string in JSON.
|
||||
static bool IsQuotedJSONType(const TypePtr& t) {
|
||||
if ( t == nullptr )
|
||||
return false;
|
||||
|
||||
switch ( t->Tag() ) {
|
||||
case TYPE_ADDR:
|
||||
case TYPE_ENUM:
|
||||
case TYPE_FILE:
|
||||
case TYPE_FUNC:
|
||||
case TYPE_INTERVAL:
|
||||
case TYPE_PATTERN:
|
||||
case TYPE_STRING:
|
||||
case TYPE_SUBNET:
|
||||
case TYPE_OPAQUE: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
// This is a static method in this file to avoid including rapidjson's headers
|
||||
// in Val.h, because they're huge.
|
||||
static void BuildJSON(json::detail::NullDoubleWriter& writer, Val* val, bool only_loggable = false,
|
||||
RE_Matcher* re = nullptr, const string& key = "") {
|
||||
if ( ! key.empty() )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue