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:
Robin Sommer 2013-11-26 10:57:02 -08:00
parent b6c1b35bb8
commit f0fe270029
4 changed files with 39 additions and 6 deletions

View file

@ -304,6 +304,7 @@ public:
TypeList* Indices() const { return indices; }
const type_list* IndexTypes() const { return indices->Types(); }
BroType* YieldType();
const BroType* YieldType() const;
void Describe(ODesc* d) const;
void DescribeReST(ODesc* d) const;
@ -366,6 +367,7 @@ public:
RecordType* Args() const { return args; }
BroType* YieldType();
const BroType* YieldType() const;
void SetYieldType(BroType* arg_yield) { yield = arg_yield; }
function_flavor Flavor() const { return flavor; }
string FlavorString() const;
@ -522,6 +524,8 @@ protected:
class EnumType : public BroType {
public:
typedef std::list<std::pair<string, bro_int_t> > enum_name_list;
EnumType(const string& arg_name);
EnumType(EnumType* e);
~EnumType();
@ -536,11 +540,15 @@ public:
void AddName(const string& module_name, const char* name, bro_int_t val, bool is_export);
// -1 indicates not found.
bro_int_t Lookup(const string& module_name, const char* name);
const char* Lookup(bro_int_t value); // Returns 0 if not found
bro_int_t Lookup(const string& module_name, const char* name) const;
const char* Lookup(bro_int_t value) const; // Returns 0 if not found
string Name() const { return name; }
// Returns the list of defined names with their values. The names
// will be fully qualified with their module name.
enum_name_list Names() const;
void DescribeReST(ODesc* d) const;
protected:
@ -592,6 +600,7 @@ public:
VectorType(BroType* t);
virtual ~VectorType();
BroType* YieldType() { return yield_type; }
const BroType* YieldType() const { return yield_type; }
int MatchesIndex(ListExpr*& index) const;