40 #ifndef _QORE_NAMESPACELIST_H 42 #define _QORE_NAMESPACELIST_H 46 #ifdef HAVE_QORE_HASH_MAP 48 #include <qore/hash_map_include.h> 49 #include "qore/intern/xxhash.h" 51 typedef HASH_MAP<std::string, QoreNamespace*> nsmap_t;
54 typedef std::map<std::string, QoreNamespace*> nsmap_t;
57 class qore_ns_private;
58 class qore_root_ns_private;
60 hashdecl GVEntryBase {
64 DLLLOCAL GVEntryBase(
const NamedScope& n, Var* v) : name(new NamedScope(n)), var(v) {
67 DLLLOCAL GVEntryBase(
const QoreProgramLocation* loc,
char* n,
const QoreTypeInfo* typeInfo, QoreParseTypeInfo* parseTypeInfo);
69 DLLLOCAL GVEntryBase(
const GVEntryBase& old) : name(old.name), var(old.var) {
72 DLLLOCAL
void clear();
74 DLLLOCAL Var* takeVar() {
81 hashdecl GVEntry :
public GVEntryBase {
84 DLLLOCAL GVEntry(qore_ns_private* n_ns,
const NamedScope& n, Var* v) : GVEntryBase(n, v), ns(n_ns) {
87 DLLLOCAL GVEntry(
const GVEntry& old) : GVEntryBase(old), ns(old.ns) {
90 DLLLOCAL GVEntry(
const GVEntryBase& old, qore_ns_private* n_ns) : GVEntryBase(old), ns(n_ns) {
95 hashdecl GVList :
public std::vector<T> {
100 DLLLOCAL
void clear() {
101 for (
typename GVList<T>::iterator i = std::vector<T>::begin(), e = std::vector<T>::end(); i != e; ++i)
103 std::vector<T>::clear();
106 DLLLOCAL
void zero() {
107 std::vector<T>::clear();
111 typedef GVList<GVEntryBase> gvblist_t;
112 typedef GVList<GVEntry> gvlist_t;
114 class QoreNamespaceList {
116 DLLLOCAL
void deleteAll();
119 DLLLOCAL QoreNamespaceList(
const QoreNamespaceList& old);
121 DLLLOCAL QoreNamespaceList& operator=(
const QoreNamespaceList& nsl);
126 DLLLOCAL QoreNamespaceList() {
129 DLLLOCAL QoreNamespaceList(
const QoreNamespaceList& old,
int64 po,
const qore_ns_private& parent);
131 DLLLOCAL ~QoreNamespaceList() {
136 nsmap_t::iterator i = nsmap.find(name);
137 return i == nsmap.end() ? 0 : i->second;
141 nsmap_t::iterator i = nsmap.find(name);
142 return i == nsmap.end() ? 0 : i->second;
144 DLLLOCAL
const QoreNamespace* find(
const std::string& name)
const {
145 nsmap_t::const_iterator i = nsmap.find(name);
146 return i == nsmap.end() ? 0 : i->second;
150 DLLLOCAL qore_ns_private* parseAdd(
QoreNamespace* ot, qore_ns_private* parent);
152 DLLLOCAL qore_ns_private* runtimeAdd(
QoreNamespace* ot, qore_ns_private* parent);
154 DLLLOCAL
void resolveCopy();
155 DLLLOCAL
void parseInitConstants();
157 DLLLOCAL
void parseInitGlobalVars();
162 DLLLOCAL
void parseResolveHierarchy();
163 DLLLOCAL
void parseResolveClassMembers();
164 DLLLOCAL
void parseInit();
165 DLLLOCAL
void parseResolveAbstract();
166 DLLLOCAL
void parseCommit();
170 DLLLOCAL
void reset();
172 DLLLOCAL
void parseAssimilate(QoreNamespaceList& n, qore_ns_private* parent);
173 DLLLOCAL
void runtimeAssimilate(QoreNamespaceList& n, qore_ns_private* parent);
175 DLLLOCAL
bool addGlobalVars(qore_root_ns_private& rns);
177 DLLLOCAL
void deleteData(
bool deref_vars,
ExceptionSink *xsink);
179 DLLLOCAL
bool empty()
const {
180 return nsmap.empty();
This is the hash or associative list container type in Qore, dynamically allocated only...
Definition: QoreHashNode.h:50
contains constants, classes, and subnamespaces in QoreProgram objects
Definition: QoreNamespace.h:64
size_t qore_size_t
used for sizes (same range as a pointer)
Definition: common.h:73
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:46
long long int64
64bit integer type, cannot use int64_t here since it breaks the API on some 64-bit systems due to equ...
Definition: common.h:260