mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 11:38:20 +00:00
made RecordVal::AppendField protected: it's low-level & requires knowledge of internals
This commit is contained in:
parent
80f0b099b5
commit
d1334b7bca
3 changed files with 22 additions and 17 deletions
33
src/Val.h
33
src/Val.h
|
@ -1182,22 +1182,6 @@ public:
|
|||
Assign(idx, std::forward<T>(val));
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a value to the record's fields. The caller is responsible
|
||||
* for ensuring that fields are appended in the correct order and
|
||||
* with the correct type. The type needs to be passed in because
|
||||
* it's unsafe to take it from v when the field's type is "any" while
|
||||
* v is a concrete type.
|
||||
* @param v The value to append.
|
||||
*/
|
||||
void AppendField(ValPtr v, const TypePtr& t)
|
||||
{
|
||||
if ( v )
|
||||
record_val->emplace_back(ZVal(v, t));
|
||||
else
|
||||
record_val->emplace_back(std::nullopt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of fields in the record.
|
||||
* @return The number of fields in the record.
|
||||
|
@ -1422,6 +1406,23 @@ public:
|
|||
protected:
|
||||
friend class zeek::detail::ZBody;
|
||||
|
||||
/**
|
||||
* Appends a value to the record's fields. The caller is responsible
|
||||
* for ensuring that fields are appended in the correct order and
|
||||
* with the correct type. The type needs to be passed in because
|
||||
* it's unsafe to take it from v when the field's type is "any" while
|
||||
* v is a concrete type.
|
||||
* @param v The value to append.
|
||||
* @param t The type associated with the field.
|
||||
*/
|
||||
void AppendField(ValPtr v, const TypePtr& t)
|
||||
{
|
||||
if ( v )
|
||||
record_val->emplace_back(ZVal(v, t));
|
||||
else
|
||||
record_val->emplace_back(std::nullopt);
|
||||
}
|
||||
|
||||
// For use by low-level ZAM instructions. Caller assumes
|
||||
// responsibility for memory management. The first version
|
||||
// allows manipulation of whether the field is present at all.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue