mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Deprecate RecordVal::Lookup(int), replace with GetField(int)
This commit is contained in:
parent
377779bb2a
commit
f729247778
20 changed files with 78 additions and 60 deletions
22
src/Val.h
22
src/Val.h
|
@ -965,7 +965,27 @@ public:
|
|||
void Assign(int field, std::nullptr_t)
|
||||
{ Assign(field, IntrusivePtr<Val>{}); }
|
||||
|
||||
Val* Lookup(int field) const; // Does not Ref() value.
|
||||
[[deprecated("Remove in v4.1. Use GetField().")]]
|
||||
Val* Lookup(int field) const // Does not Ref() value.
|
||||
{ return (*AsRecord())[field].get(); }
|
||||
|
||||
/**
|
||||
* Returns the value of a given field index.
|
||||
* @param field The field index to retrieve.
|
||||
* @return The value at the given field index.
|
||||
*/
|
||||
const IntrusivePtr<Val>& GetField(int field) const
|
||||
{ return (*AsRecord())[field]; }
|
||||
|
||||
/**
|
||||
* Returns the value of a given field index as cast to type @c T.
|
||||
* @param field The field index to retrieve.
|
||||
* @return The value at the given field index cast to type @c T.
|
||||
*/
|
||||
template <class T>
|
||||
IntrusivePtr<T> GetField(int field) const
|
||||
{ return cast_intrusive<T>(GetField(field)); }
|
||||
|
||||
IntrusivePtr<Val> LookupWithDefault(int field) const;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue