Clarisse 5.0 SP8 SDK  5.0.5.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | List of all members
CoreNameServer Class Reference

Manages names structure and guaranties unicity, and offers name manipulation functions. More...

Inheritance diagram for CoreNameServer:
CoreBaseObject CoreBaseType

Public Member Functions

void generate_name (const CoreString &name, CoreString &gen_name) const
 Generates a unique name from the incoming name, by adding or incrementing a numeric suffix.
 
void make_unique (CoreString &name)
 Modify if necessary the incoming name to make it unique.
 
void make_unique (CoreString &name, CoreSet< CoreString > &names) const
 Modify if necessary the incoming name to make it unique and without changing the current name server.
 
void clear ()
 Removes all the names.
 
virtual size_t get_memory_size () const override
 
- Public Member Functions inherited from CoreBaseObject
bool is_kindof (const CoreBaseObject &object) const
 
CoreString get_class_info_name () const
 
const unsigned long & get_class_info_id () const
 
virtual bool is_kindof (const CoreClassInfo &cinfo) const
 
virtual const CoreClassInfoget_class_info () const
 
template<class T >
T * cast ()
 
template<class T >
const T * cast () const
 
- Public Member Functions inherited from CoreBaseType
bool is_kindof (const CoreClassInfo &cinfo) const
 

Static Public Member Functions

static void split_name (const CoreString &name, CoreString &prefix, int &suffix)
 Split a name into a prefix and a suffix number if name qualifies. Ex: name5 -> name (prefix), 5 (suffix).
 
- Static Public Member Functions inherited from CoreBaseObject
static const CoreClassInfoclass_info ()
 
template<class T >
static T * cast (CoreBaseObject *object)
 
template<class T >
static const T * cast (const CoreBaseObject *object)
 
- Static Public Member Functions inherited from CoreBaseType
static const CoreClassInfoclass_info ()
 Get the type descriptor of this instance.
 

Detailed Description

Manages names structure and guaranties unicity, and offers name manipulation functions.

Member Function Documentation

void CoreNameServer::generate_name ( const CoreString name,
CoreString gen_name 
) const

Generates a unique name from the incoming name, by adding or incrementing a numeric suffix.

Parameters
[in]nameincoming name.
[out]gen_namegenerated name.
void CoreNameServer::make_unique ( CoreString name)

Modify if necessary the incoming name to make it unique.

Parameters
in/out]name incoming name. Will be modified if necessary to become unique.
Warning
legacy function : it is not working everytime, but we still need to support it to not break scenes in Clarisse... Here an example where it's not working : add "toto", "toto_1", and "toto", the second "toto" is then changed to "toto_1" which already exists ...
void CoreNameServer::make_unique ( CoreString name,
CoreSet< CoreString > &  names 
) const

Modify if necessary the incoming name to make it unique and without changing the current name server.

Parameters
in/out]name incoming name. Will be modified if necessary to become unique.
in/out]names the set of all the names already generated
void CoreNameServer::split_name ( const CoreString name,
CoreString prefix,
int &  suffix 
)
static

Split a name into a prefix and a suffix number if name qualifies. Ex: name5 -> name (prefix), 5 (suffix).

Parameters
[in]namename to split
[out]prefixpart of the name without suffix. If name has no suffix, will be set to empty string "".
[out]suffixsuffix number of the name, or -1 if no suffix