42 #ifndef _QORE_QORENAMESPACE_H 44 #define _QORE_QORENAMESPACE_H 51 class QoreExternalFunction;
53 class QoreExternalGlobalVar;
65 friend class QoreNamespaceList;
67 friend class qore_ns_private;
68 friend class qore_root_ns_private;
69 friend hashdecl NSOInfoBase;
124 DLLEXPORT QoreNamespace*
copy(
int po)
const;
161 DLLEXPORT
const char*
getName()
const;
212 DLLEXPORT
const QoreNamespace*
getParent()
const;
245 DLLEXPORT std::string
getPath(
bool anchored =
false)
const;
265 DLLEXPORT
bool isRoot()
const;
272 QoreNamespace& operator=(
const QoreNamespace&) =
delete;
275 class qore_ns_private* priv;
287 friend class qore_ns_private;
288 friend class qore_root_ns_private;
289 friend class StaticSystemNamespace;
303 class qore_root_ns_private* rpriv;
315 class QorePrivateNamespaceIterator;
326 DLLEXPORT
virtual ~QoreNamespaceIterator();
329 DLLEXPORT
bool next();
350 QoreNamespaceIterator(
const QoreNamespaceIterator&) =
delete;
353 QoreNamespaceIterator& operator=(
const QoreNamespaceIterator&) =
delete;
355 QorePrivateNamespaceIterator* priv;
367 DLLEXPORT
virtual ~QoreNamespaceConstIterator();
370 DLLEXPORT
bool next();
383 QoreNamespaceConstIterator(
const QoreNamespaceConstIterator&) =
delete;
386 QoreNamespaceConstIterator& operator=(
const QoreNamespaceConstIterator&) =
delete;
388 QorePrivateNamespaceIterator* priv;
400 DLLEXPORT
virtual ~QoreNamespaceNamespaceIterator();
403 DLLEXPORT
bool next();
410 QoreNamespaceNamespaceIterator(
const QoreNamespaceNamespaceIterator&) =
delete;
413 QoreNamespaceNamespaceIterator& operator=(
const QoreNamespaceNamespaceIterator&) =
delete;
415 class qore_namespace_namespace_iterator* priv;
427 DLLEXPORT
virtual ~QoreNamespaceFunctionIterator();
430 DLLEXPORT
bool next();
433 DLLEXPORT
const QoreExternalFunction&
get()
const;
437 QoreNamespaceFunctionIterator(
const QoreNamespaceFunctionIterator&) =
delete;
440 QoreNamespaceFunctionIterator& operator=(
const QoreNamespaceFunctionIterator&) =
delete;
442 class qore_namespace_function_iterator* priv;
454 DLLEXPORT
virtual ~QoreNamespaceConstantIterator();
457 DLLEXPORT
bool next();
464 QoreNamespaceConstantIterator(
const QoreNamespaceConstantIterator&) =
delete;
467 QoreNamespaceConstantIterator& operator=(
const QoreNamespaceConstantIterator&) =
delete;
469 class qore_namespace_constant_iterator* priv;
481 DLLEXPORT
virtual ~QoreNamespaceClassIterator();
484 DLLEXPORT
bool next();
491 QoreNamespaceClassIterator(
const QoreNamespaceClassIterator&) =
delete;
494 QoreNamespaceClassIterator& operator=(
const QoreNamespaceClassIterator&) =
delete;
496 class ConstClassListIterator* priv;
508 DLLEXPORT
virtual ~QoreNamespaceGlobalVarIterator();
511 DLLEXPORT
bool next();
514 DLLEXPORT
const QoreExternalGlobalVar&
get()
const;
518 QoreNamespaceGlobalVarIterator(
const QoreNamespaceGlobalVarIterator&) =
delete;
521 QoreNamespaceGlobalVarIterator& operator=(
const QoreNamespaceGlobalVarIterator&) =
delete;
523 class qore_namespace_globalvar_iterator* priv;
535 DLLEXPORT
virtual ~QoreNamespaceTypedHashIterator();
538 DLLEXPORT
bool next();
545 QoreNamespaceTypedHashIterator(
const QoreNamespaceTypedHashIterator&) =
delete;
548 QoreNamespaceTypedHashIterator& operator=(
const QoreNamespaceTypedHashIterator&) =
delete;
550 class ConstHashDeclListIterator* priv;
553 #endif // QORE_NAMESPACE_H allows functions in a namespace to be iterated
Definition: QoreNamespace.h:421
#define PO_DEFAULT
no parse options set by default
Definition: Restrictions.h:102
allows all namespaces of a namespace to be iterated (including the namespace passed in the constructo...
Definition: QoreNamespace.h:320
external wrapper class for constants
Definition: QoreReflection.h:200
This is the hash or associative list container type in Qore, dynamically allocated only...
Definition: QoreHashNode.h:50
DLLEXPORT void setClassHandler(q_ns_class_handler_t class_handler)
sets the namespace class handler
DLLEXPORT bool isRoot() const
returns true if the namespace is the root namespace
DLLEXPORT void addBuiltinVariant(const char *name, q_func_n_t f, int64 code_flags=QCF_NO_FLAGS, int64 functional_domain=QDOM_DEFAULT, const QoreTypeInfo *returnTypeInfo=0, unsigned num_params=0,...)
adds a function variant
DLLEXPORT void addNamespace(QoreNamespace *ns)
adds a namespace to the namespace tree
DLLEXPORT void clear(ExceptionSink *xsink)
clears the contents of the namespace before deleting
DLLEXPORT const TypedHashDecl * findLocalTypedHash(const char *name) const
find a typed hash (hashdecl) in the current namespace; returns nullptr if not found ...
DLLEXPORT bool isModulePublic() const
returns true if the namespace has its module public flag set
contains constants, classes, and subnamespaces in QoreProgram objects
Definition: QoreNamespace.h:64
DLLEXPORT const QoreExternalGlobalVar * findLocalGlobalVar(const char *name) const
find a global variable in the current namespace; returns nullptr if not found
DLLEXPORT QoreHashNode * getConstantInfo() const
a hash of all constants in the namespace, the hash keys are the constant names and the values are the...
DLLEXPORT QoreClass * findLocalClass(const char *cname) const
finds a class in this namespace, does not search child namespaces
allows all namespaces of a namespace to be iterated (including the namespace passed in the constructo...
Definition: QoreNamespace.h:361
DLLEXPORT const QoreNamespace * getParent() const
returns a pointer to the parent namespace or nullptr if there is no parent
allows typed hashes (hashdecls) in a namespace to be iterated
Definition: QoreNamespace.h:529
DLLEXPORT std::string getPath(bool anchored=false) const
returns the path for the namespace
the root namespace of a QoreProgram object
Definition: QoreNamespace.h:286
DLLEXPORT QoreNamespace(const char *n)
creates a namespace with the given name
defines a Qore-language class
Definition: QoreClass.h:237
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:262
DLLEXPORT void addInitialNamespace(QoreNamespace *ns)
adds a subnamespace to the namespace
DLLEXPORT QoreNamespace * findCreateNamespacePath(const char *nspath)
finds a Namespace based on the argument; creates it (or the whole path) if necessary ...
static unsigned num_params(const QoreListNode *n)
returns the number of arguments passed to the function
Definition: params.h:54
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:46
DLLEXPORT const char * getName() const
returns the name of the namespace
DLLEXPORT void addSystemHashDecl(TypedHashDecl *hashdecl)
adds a hashdecl to a namespace
DLLEXPORT bool isImported() const
returns true if the namespace was imported from another program object
allows classes in a namespace to be iterated
Definition: QoreNamespace.h:475
allows global variables in a namespace to be iterated
Definition: QoreNamespace.h:502
allows local namespaces to be iterated
Definition: QoreNamespace.h:394
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
virtual DLLEXPORT ~QoreNamespace()
destroys the object and frees memory
DLLEXPORT void addConstant(const char *name, QoreValue value)
adds a constant definition to the namespace
typed hash declaration
Definition: TypedHashDecl.h:44
DLLEXPORT QoreHashNode * getInfo() const
returns a hash giving information about the definitions in the namespace
DLLEXPORT QoreNamespace * findLocalNamespace(const char *nsname) const
finds a subnamespace in this namespace, does not search child namespaces
DLLEXPORT void deleteData(ExceptionSink *xsink)
this function must be called before the QoreNamespace object is deleted or a crash could result due i...
DLLEXPORT QoreNamespace * copy(int po) const
returns a deep copy of the namespace; DEPRECATED: use copy(int64) instead
DLLEXPORT void addSystemClass(QoreClass *oc)
adds a class to a namespace
DLLEXPORT const QoreExternalFunction * findLocalFunction(const char *name) const
find a function in the current namespace; returns nullptr if not found
DLLEXPORT QoreHashNode * getClassInfo() const
gets a hash of all classes in the namespace, the hash keys are the class names and the values are lis...
allows constants in a namespace to be iterated
Definition: QoreNamespace.h:448
QoreValue(* q_func_n_t)(const QoreListNode *args, q_rt_flags_t flags, ExceptionSink *xsink)
the type used for builtin function signatures
Definition: common.h:307
DLLEXPORT bool isBuiltin() const
returns true if the namespace is builtin
DLLEXPORT const QoreExternalConstant * findLocalConstant(const char *name) const
find a constant in the current namespace; returns nullptr if not found
#define QDOM_DEFAULT
the default domain (no domain)
Definition: Restrictions.h:152