mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
convenience function for accessing object descriptions
This commit is contained in:
parent
c30f787949
commit
63502e655f
2 changed files with 20 additions and 0 deletions
13
src/Desc.cc
13
src/Desc.cc
|
@ -427,4 +427,17 @@ bool ODesc::FindType(const Type* type)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string obj_desc(const Obj* o)
|
||||||
|
{
|
||||||
|
static ODesc d;
|
||||||
|
|
||||||
|
d.Clear();
|
||||||
|
o->Describe(&d);
|
||||||
|
d.SP();
|
||||||
|
o->GetLocationInfo()->Describe(&d);
|
||||||
|
|
||||||
|
return std::string(d.Description());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace zeek
|
} // namespace zeek
|
||||||
|
|
|
@ -210,6 +210,13 @@ protected:
|
||||||
std::set<const Type*> encountered_types;
|
std::set<const Type*> encountered_types;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
class Obj;
|
||||||
|
extern std::string obj_desc(const Obj* o);
|
||||||
|
|
||||||
} // namespace zeek
|
} // namespace zeek
|
||||||
|
|
||||||
using BroFile [[deprecated("Remove in v4.1. Use zeek::File.")]] = zeek::File;
|
using BroFile [[deprecated("Remove in v4.1. Use zeek::File.")]] = zeek::File;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue