mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 17:18:20 +00:00
Desc: Add obj_desc() / obj_desc_short() overloads for IntrusivePtr
When using these helpers in code, one barely has raw pointers and the repeated `.get()` call cumbersome and noisy.
This commit is contained in:
parent
cef63e871e
commit
0c18ec5e5d
1 changed files with 4 additions and 3 deletions
|
@ -7,6 +7,7 @@
|
|||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "zeek/IntrusivePtr.h"
|
||||
#include "zeek/ZeekString.h" // for byte_vec
|
||||
#include "zeek/util.h" // for zeek_int_t
|
||||
|
||||
|
@ -211,13 +212,13 @@ protected:
|
|||
};
|
||||
|
||||
// Returns a string representation of an object's description. Used for
|
||||
// debugging and error messages. takes a bare pointer rather than an
|
||||
// IntrusivePtr because the latter is harder to deal with when making
|
||||
// calls from a debugger like lldb, which is the main use of this function.
|
||||
// debugging and error messages.
|
||||
class Obj;
|
||||
std::string obj_desc(const Obj* o);
|
||||
inline std::string obj_desc(const IntrusivePtr<Obj>& o) { return obj_desc(o.get()); }
|
||||
|
||||
// Same as obj_desc(), but ensure it is short and don't include location info.
|
||||
std::string obj_desc_short(const Obj* o);
|
||||
inline std::string obj_desc_short(const IntrusivePtr<Obj>& o) { return obj_desc_short(o.get()); }
|
||||
|
||||
} // namespace zeek
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue