mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 08:38:20 +00:00
Minor interface changes to provide more accessor methods for class
information. In particular, adding a few const versions of methods.
This commit is contained in:
parent
b6c1b35bb8
commit
f0fe270029
4 changed files with 39 additions and 6 deletions
28
src/Type.cc
28
src/Type.cc
|
@ -430,6 +430,11 @@ BroType* IndexType::YieldType()
|
|||
return yield_type;
|
||||
}
|
||||
|
||||
const BroType* IndexType::YieldType() const
|
||||
{
|
||||
return yield_type;
|
||||
}
|
||||
|
||||
void IndexType::Describe(ODesc* d) const
|
||||
{
|
||||
BroType::Describe(d);
|
||||
|
@ -723,6 +728,11 @@ BroType* FuncType::YieldType()
|
|||
return yield;
|
||||
}
|
||||
|
||||
const BroType* FuncType::YieldType() const
|
||||
{
|
||||
return yield;
|
||||
}
|
||||
|
||||
int FuncType::MatchesIndex(ListExpr*& index) const
|
||||
{
|
||||
return check_and_promote_args(index, args) ?
|
||||
|
@ -1444,9 +1454,9 @@ void CommentedEnumType::AddNameInternal(const string& module_name, const char* n
|
|||
names[copy_string(fullname.c_str())] = val;
|
||||
}
|
||||
|
||||
bro_int_t EnumType::Lookup(const string& module_name, const char* name)
|
||||
bro_int_t EnumType::Lookup(const string& module_name, const char* name) const
|
||||
{
|
||||
NameMap::iterator pos =
|
||||
NameMap::const_iterator pos =
|
||||
names.find(make_full_var_name(module_name.c_str(), name).c_str());
|
||||
|
||||
if ( pos == names.end() )
|
||||
|
@ -1455,9 +1465,9 @@ bro_int_t EnumType::Lookup(const string& module_name, const char* name)
|
|||
return pos->second;
|
||||
}
|
||||
|
||||
const char* EnumType::Lookup(bro_int_t value)
|
||||
const char* EnumType::Lookup(bro_int_t value) const
|
||||
{
|
||||
for ( NameMap::iterator iter = names.begin();
|
||||
for ( NameMap::const_iterator iter = names.begin();
|
||||
iter != names.end(); ++iter )
|
||||
if ( iter->second == value )
|
||||
return iter->first;
|
||||
|
@ -1465,6 +1475,16 @@ const char* EnumType::Lookup(bro_int_t value)
|
|||
return 0;
|
||||
}
|
||||
|
||||
EnumType::enum_name_list EnumType::Names() const
|
||||
{
|
||||
enum_name_list n;
|
||||
for ( NameMap::const_iterator iter = names.begin();
|
||||
iter != names.end(); ++iter )
|
||||
n.push_back(std::make_pair(iter->first, iter->second));
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
void EnumType::DescribeReST(ODesc* d) const
|
||||
{
|
||||
d->Add(":bro:type:`");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue