mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Move ID to the zeek::detail namespace
This commit is contained in:
parent
9992ec5c11
commit
0d623d003c
30 changed files with 221 additions and 182 deletions
41
src/Scope.h
41
src/Scope.h
|
@ -13,31 +13,32 @@
|
|||
#include "TraverseTypes.h"
|
||||
|
||||
template <class T> class IntrusivePtr;
|
||||
class ID;
|
||||
class BroType;
|
||||
class ListVal;
|
||||
|
||||
FORWARD_DECLARE_NAMESPACED(ID, zeek::detail);
|
||||
|
||||
class Scope : public BroObj {
|
||||
public:
|
||||
explicit Scope(IntrusivePtr<ID> id,
|
||||
explicit Scope(IntrusivePtr<zeek::detail::ID> id,
|
||||
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> al);
|
||||
|
||||
const IntrusivePtr<ID>& Find(std::string_view name) const;
|
||||
const IntrusivePtr<zeek::detail::ID>& Find(std::string_view name) const;
|
||||
|
||||
template<typename N>
|
||||
[[deprecated("Remove in v4.1. Use Find().")]]
|
||||
ID* Lookup(N&& name) const
|
||||
zeek::detail::ID* Lookup(N&& name) const
|
||||
{ return Find(name).get(); }
|
||||
|
||||
template<typename N, typename I>
|
||||
void Insert(N&& name, I&& id) { local[std::forward<N>(name)] = std::forward<I>(id); }
|
||||
|
||||
IntrusivePtr<ID> Remove(std::string_view name);
|
||||
IntrusivePtr<zeek::detail::ID> Remove(std::string_view name);
|
||||
|
||||
[[deprecated("Remove in v4.1. Use GetID().")]]
|
||||
ID* ScopeID() const { return scope_id.get(); }
|
||||
zeek::detail::ID* ScopeID() const { return scope_id.get(); }
|
||||
|
||||
const IntrusivePtr<ID>& GetID() const
|
||||
const IntrusivePtr<zeek::detail::ID>& GetID() const
|
||||
{ return scope_id; }
|
||||
|
||||
const std::unique_ptr<std::vector<IntrusivePtr<Attr>>>& Attrs() const
|
||||
|
@ -52,14 +53,14 @@ public:
|
|||
size_t Length() const { return local.size(); }
|
||||
const auto& Vars() { return local; }
|
||||
|
||||
IntrusivePtr<ID> GenerateTemporary(const char* name);
|
||||
IntrusivePtr<zeek::detail::ID> GenerateTemporary(const char* name);
|
||||
|
||||
// Returns the list of variables needing initialization, and
|
||||
// removes it from this Scope.
|
||||
std::vector<IntrusivePtr<ID>> GetInits();
|
||||
std::vector<IntrusivePtr<zeek::detail::ID>> GetInits();
|
||||
|
||||
// Adds a variable to the list.
|
||||
void AddInit(IntrusivePtr<ID> id)
|
||||
void AddInit(IntrusivePtr<zeek::detail::ID> id)
|
||||
{ inits.emplace_back(std::move(id)); }
|
||||
|
||||
void Describe(ODesc* d) const override;
|
||||
|
@ -67,26 +68,26 @@ public:
|
|||
TraversalCode Traverse(TraversalCallback* cb) const;
|
||||
|
||||
protected:
|
||||
IntrusivePtr<ID> scope_id;
|
||||
IntrusivePtr<zeek::detail::ID> scope_id;
|
||||
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attrs;
|
||||
IntrusivePtr<BroType> return_type;
|
||||
std::map<std::string, IntrusivePtr<ID>, std::less<>> local;
|
||||
std::vector<IntrusivePtr<ID>> inits;
|
||||
std::map<std::string, IntrusivePtr<zeek::detail::ID>, std::less<>> local;
|
||||
std::vector<IntrusivePtr<zeek::detail::ID>> inits;
|
||||
};
|
||||
|
||||
|
||||
extern bool in_debug;
|
||||
|
||||
// If no_global is true, don't search in the default "global" namespace.
|
||||
extern const IntrusivePtr<ID>& lookup_ID(const char* name, const char* module,
|
||||
bool no_global = false,
|
||||
bool same_module_only = false,
|
||||
bool check_export = true);
|
||||
extern const IntrusivePtr<zeek::detail::ID>& lookup_ID(const char* name, const char* module,
|
||||
bool no_global = false,
|
||||
bool same_module_only = false,
|
||||
bool check_export = true);
|
||||
|
||||
extern IntrusivePtr<ID> install_ID(const char* name, const char* module_name,
|
||||
bool is_global, bool is_export);
|
||||
extern IntrusivePtr<zeek::detail::ID> install_ID(const char* name, const char* module_name,
|
||||
bool is_global, bool is_export);
|
||||
|
||||
extern void push_scope(IntrusivePtr<ID> id,
|
||||
extern void push_scope(IntrusivePtr<zeek::detail::ID> id,
|
||||
std::unique_ptr<std::vector<IntrusivePtr<Attr>>> attrs);
|
||||
extern void push_existing_scope(Scope* scope);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue