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,
68 QoreParseTypeInfo* parseTypeInfo, qore_var_t type);
70 DLLLOCAL GVEntryBase(
const GVEntryBase& old) : name(old.name), var(old.var) {
73 DLLLOCAL
void clear();
75 DLLLOCAL Var* takeVar() {
82 hashdecl GVEntry :
public GVEntryBase {
85 DLLLOCAL GVEntry(qore_ns_private* n_ns,
const NamedScope& n, Var* v) : GVEntryBase(n, v), ns(n_ns) {
88 DLLLOCAL GVEntry(
const GVEntry& old) : GVEntryBase(old), ns(old.ns) {
91 DLLLOCAL GVEntry(
const GVEntryBase& old, qore_ns_private* n_ns) : GVEntryBase(old), ns(n_ns) {
96 hashdecl GVList :
public std::vector<T> {
101 DLLLOCAL
void clear() {
102 for (
typename GVList<T>::iterator i = std::vector<T>::begin(), e = std::vector<T>::end(); i != e; ++i)
104 std::vector<T>::clear();
107 DLLLOCAL
void zero() {
108 std::vector<T>::clear();
112 typedef GVList<GVEntryBase> gvblist_t;
113 typedef GVList<GVEntry> gvlist_t;
115 class QoreNamespaceList {
117 DLLLOCAL
void deleteAll();
120 DLLLOCAL QoreNamespaceList(
const QoreNamespaceList& old);
122 DLLLOCAL QoreNamespaceList& operator=(
const QoreNamespaceList& nsl);
127 DLLLOCAL QoreNamespaceList() {
130 DLLLOCAL QoreNamespaceList(
const QoreNamespaceList& old,
int64 po,
const qore_ns_private& parent);
132 DLLLOCAL ~QoreNamespaceList() {
137 nsmap_t::iterator i = nsmap.find(name);
138 return i == nsmap.end() ? 0 : i->second;
142 nsmap_t::iterator i = nsmap.find(name);
143 return i == nsmap.end() ? 0 : i->second;
145 DLLLOCAL
const QoreNamespace* find(
const std::string& name)
const {
146 nsmap_t::const_iterator i = nsmap.find(name);
147 return i == nsmap.end() ? 0 : i->second;
151 DLLLOCAL qore_ns_private* parseAdd(
QoreNamespace* ot, qore_ns_private* parent);
153 DLLLOCAL qore_ns_private* runtimeAdd(
QoreNamespace* ot, qore_ns_private* parent);
155 DLLLOCAL
void resolveCopy();
156 DLLLOCAL
int parseInitConstants();
158 DLLLOCAL
int parseInitGlobalVars();
163 DLLLOCAL
void parseResolveHierarchy();
164 DLLLOCAL
void parseResolveClassMembers();
165 DLLLOCAL
int parseInit();
166 DLLLOCAL
void parseResolveAbstract();
167 DLLLOCAL
void parseCommit();
171 DLLLOCAL
void reset();
173 DLLLOCAL
void parseAssimilate(QoreNamespaceList& n, qore_ns_private* parent);
174 DLLLOCAL
void runtimeAssimilate(QoreNamespaceList& n, qore_ns_private* parent);
176 DLLLOCAL
bool addGlobalVars(qore_root_ns_private& rns);
178 DLLLOCAL
void deleteData(
bool deref_vars,
ExceptionSink *xsink);
180 DLLLOCAL
bool empty()
const {
181 return nsmap.empty();
184 DLLLOCAL
size_t size()
const {
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
This is the hash or associative list container type in Qore, dynamically allocated only,...
Definition: QoreHashNode.h:50
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
contains constants, classes, and subnamespaces in QoreProgram objects
Definition: QoreNamespace.h:65
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