Programming Reference


ODNameSpaceManager

     

Class Definition File

NmSpcMg.idl

Class C++ Binding

NmSpcMg.xh

Class Hierarchy

SOMObject
   SOMClass
      ODObject
         ODBaseNameSpaceManager
            ODNameSpaceManager

Description

An object of the ODNameSpaceManager class manages the creation and deletion of name spaces among OpenDoc and any associated parts.

When a document is opened, the session object creates a single name-space-manager object. All parts of that document share the name-space manager; you can obtain a reference to it by calling the session object's GetNameSpaceManager method.

A part creates a name space by calling the name-space manager's CreateNameSpace method. Name spaces can be arranged hierarchically to facilitate searches among multiple name spaces. To obtained a reference to an existing name spaces, a part calls the name-space manager's HasNameSpace method.

For additional information related to name spaces, see the descriptions of the classes ODNameSpace, ODObjectNameSpace, and ODValueNameSpace.

Methods

The methods defined by the ODNameSpaceManager class include:

Overridden Methods

There are no methods overridden by the ODNameSpaceManager class.

   

CreateNameSpace

This method creates a new name space.

Signature
ODNameSpace *CreateNameSpace (ODISOStr spaceName,
                              ODNameSpace *inheritsFrom,
                              ODULong numExpectedEntries,
                              ODNSTypeSpec type)

Parameters

spaceName  (ODISOStr)  -  input 

The unique name for the new name space.

inheritsFrom  (ODNameSpace *)  -  input 

A reference to the parent of the new name space or kODNULL if this name space has no parent.

numExpectedEntries  (ODULong)  -  input 

The expected number of entries to be stored in the new name space.

type  (ODNSTypeSpec)  -  input 

The type of the new name space. This parameter can be set to one of the following values:
kODNSDataTypeODObject An object name space.
kODNSDataTypeODValue An value name space.

Returns

rv  (ODNameSpace *)  -  returns 

A reference to the newly created name space or kODNULL if a name space already exists with the specified name.

Remarks

This method creates a new object name space or a new value name space, as specified by the type parameter. The spaceName parameter should specify a unique name for the new name space.

If the inheritsFrom parameter is not null, it should specify a parent name space of the same type as the one being created.

Because the current implementation of name spaces uses a hash table, the value you specify in the numExpectedEntries parameter should be a prime number to make a hashing algorithm much more efficient. Choose a prime number close to the expected number of entries. The name space can accommodate more entries than you specify (at the expense of performance), but it cannot grow in size.

Related Methods

   

DeleteNameSpace

This method deletes the specified name space.

Signature
void DeleteNameSpace (ODNameSpace *theNameSpace)

Parameters

theNameSpace  (ODNameSpace *)  -  input 

A reference to the name space to be deleted.

Returns

None.

Remarks

This method deletes the specified name space by removing it from the name-space manager's internal tables and deallocating the memory associated with the object.

If the specified name space was a parent to any other name spaces, those name spaces no longer have a parent name space.

Related Methods

   

HasNameSpace

This method checks whether a specified name space exists and, if so, returns a reference to it.

Signature
ODNameSpace *HasNameSpace (ODISOStr spaceName)

Parameters

spaceName  (ODISOStr)  -  input 

The name of the name space to be found.

Returns

rv  (ODNameSpace *)  -  returns 

A reference to the name space or kODNULL if the name space does not exist.

Remarks

You can call this method to check whether a name space with the specified name exists or to obtain a reference to a specific name space.

When you create a name space, you specify its name in the spaceName parameter of the name-space manager's CreateNameSpace method.

Related Methods


[ Top | Previous | Next | Contents | Index | Documentation Homepage ]