QoreNamespace Class Reference

contains constants, classes, and subnamespaces in QoreProgram objects More...

#include <QoreNamespace.h>

Inheritance diagram for QoreNamespace:
RootQoreNamespace

List of all members.

Public Member Functions

DLLEXPORT QoreNamespace (const char *n)
 creates a namespace with the given name
DLLEXPORT ~QoreNamespace ()
 destroys the object and frees all associated memory
DLLEXPORT void addConstant (const char *name, AbstractQoreNode *value)
 adds a constant definition to the namespace
DLLEXPORT void addConstant (const char *name, AbstractQoreNode *value, const QoreTypeInfo *typeInfo)
 adds a constant definition to the namespace with type information
DLLEXPORT void addSystemClass (QoreClass *oc)
 adds a class to a namespace
DLLEXPORT void addInitialNamespace (QoreNamespace *ns)
 adds a subnamespace to the namespace
DLLEXPORT QoreNamespacecopy (int po) const
 returns a deep copy of the namespace; DEPRECATED: use copy(int64) instead
DLLEXPORT QoreNamespacecopy (int64 po=PO_DEFAULT) const
 returns a deep copy of the namespace
DLLEXPORT QoreHashNodegetClassInfo () const
 gets a hash of all classes in the namespace, the hash keys are the class names and the values are lists of strings giving the method names
DLLEXPORT QoreHashNodegetConstantInfo () const
 a hash of all constants in the namespace, the hash keys are the constant names and the values are the values of the constants
DLLEXPORT QoreHashNodegetInfo () const
 returns a hash giving information about the definitions in the namespace
DLLEXPORT const char * getName () const
 returns the name of the namespace
DLLEXPORT void addNamespace (QoreNamespace *ns)
 adds a namespace to the namespace tree
DLLLOCAL void purge ()
 destroys the object and frees all associated memory (not exported)

Protected Member Functions

DLLLOCAL QoreNamespace (const QoreNamespace &)
 this function is not implemented; it is here as a private function in order to prohibit it from being used
DLLLOCAL QoreNamespaceoperator= (const QoreNamespace &)
 this function is not implemented; it is here as a private function in order to prohibit it from being used

Friends

class RootQoreNamespace

Detailed Description

contains constants, classes, and subnamespaces in QoreProgram objects


Constructor & Destructor Documentation

DLLEXPORT QoreNamespace::QoreNamespace ( const char *  n  ) 

creates a namespace with the given name

the name of a subnamespace must be unique in the parent namespace and must not have the same name as a class in the parent namespace either

Parameters:
n the name of the namespace

Member Function Documentation

DLLEXPORT void QoreNamespace::addConstant ( const char *  name,
AbstractQoreNode value,
const QoreTypeInfo *  typeInfo 
)

adds a constant definition to the namespace with type information

Parameters:
name the name of the constant to add
value the value of the constant
typeInfo the type of the constant
See also:
QoreTypeInfoHelper
DLLEXPORT void QoreNamespace::addConstant ( const char *  name,
AbstractQoreNode value 
)

adds a constant definition to the namespace

use addConstant(const char *name, AbstractQoreNode *value, const QoreTypeInfo *typeInfo) when adding constants of externally-defined base (non-class) types; all other types (and all objects) can have their type information automatically added

Parameters:
name the name of the constant to add
value the value of the constant
DLLEXPORT void QoreNamespace::addInitialNamespace ( QoreNamespace ns  ) 

adds a subnamespace to the namespace

use this function when the QoreNamespace can be added directly to the tree (does not need to be merged with another namespace of the same name and does not contain user code)

Parameters:
ns the subnamespace to add to the namespace
DLLEXPORT void QoreNamespace::addNamespace ( QoreNamespace ns  ) 

adds a namespace to the namespace tree

the namespace must be unique, must also not clash with a class name in the same parent namespace

Parameters:
ns the namespace to add, memory is now owned by parent namespace
DLLEXPORT void QoreNamespace::addSystemClass ( QoreClass oc  ) 

adds a class to a namespace

Parameters:
oc the class to add to the namespace
DLLEXPORT QoreNamespace* QoreNamespace::copy ( int64  po = PO_DEFAULT  )  const

returns a deep copy of the namespace

Parameters:
po parse options to use when copying the namespace
Returns:
a deep copy of the namespace

Reimplemented in RootQoreNamespace.

DLLEXPORT QoreNamespace* QoreNamespace::copy ( int  po  )  const

returns a deep copy of the namespace; DEPRECATED: use copy(int64) instead

Parameters:
po parse options to use when copying the namespace
Returns:
a deep copy of the namespace
DLLEXPORT QoreHashNode* QoreNamespace::getClassInfo (  )  const

gets a hash of all classes in the namespace, the hash keys are the class names and the values are lists of strings giving the method names

See also:
QoreHashNode
QoreListNode
Returns:
a hash of all classes in the namespace, the hash keys are the class names and the values are lists of strings giving the method names
DLLEXPORT QoreHashNode* QoreNamespace::getConstantInfo (  )  const

a hash of all constants in the namespace, the hash keys are the constant names and the values are the values of the constants

See also:
QoreHashNode
QoreListNode
Returns:
a hash of all constants in the namespace, the hash keys are the constant names and the values are the values of the constants
DLLEXPORT QoreHashNode* QoreNamespace::getInfo (  )  const

returns a hash giving information about the definitions in the namespace

the return value has the following keys: "constants", "classes", and "subnamespaces" having as values the result of calling QoreNamespace::getConstantInfo(), QoreNamespace::getClassInfo(), and a hash of subnamespace names having as values the result of calling this function on each, respectively.

Returns:
a hash giving information about the definitions in the namespace
DLLEXPORT const char* QoreNamespace::getName (  )  const

returns the name of the namespace

Returns:
the name of the namespace

The documentation for this class was generated from the following file:

Generated on 14 Jun 2010 for Qore Programming Language by  doxygen 1.6.1