mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Desc: Add obj_desc_short()
Same as obj_desc() but use the short version and do not include the location information by default. New method instead of bool parameters for readability.
This commit is contained in:
parent
92f09f0db7
commit
c18366eacf
2 changed files with 15 additions and 1 deletions
11
src/Desc.cc
11
src/Desc.cc
|
@ -432,4 +432,15 @@ std::string obj_desc(const Obj* o)
|
||||||
return std::string(d.Description());
|
return std::string(d.Description());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string obj_desc_short(const Obj* o)
|
||||||
|
{
|
||||||
|
static ODesc d;
|
||||||
|
|
||||||
|
d.SetShort(true);
|
||||||
|
d.Clear();
|
||||||
|
o->Describe(&d);
|
||||||
|
|
||||||
|
return std::string(d.Description());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace zeek
|
} // namespace zeek
|
||||||
|
|
|
@ -230,6 +230,9 @@ protected:
|
||||||
// IntrusivePtr because the latter is harder to deal with when making
|
// 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.
|
// calls from a debugger like lldb, which is the main use of this function.
|
||||||
class Obj;
|
class Obj;
|
||||||
extern std::string obj_desc(const Obj* o);
|
std::string obj_desc(const Obj* o);
|
||||||
|
|
||||||
|
// Same as obj_desc(), but ensure it is short and don't include location info.
|
||||||
|
std::string obj_desc_short(const Obj* o);
|
||||||
|
|
||||||
} // namespace zeek
|
} // namespace zeek
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue