Phonon  4.7.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Phonon::GlobalDescriptionContainer< D > Class Template Reference

Public Types

typedef int global_id_t
 
typedef int local_id_t
 
typedef QMap< global_id_t, D > GlobalDescriptorMap
 
typedef QMapIterator
< global_id_t, D > 
GlobalDescriptorMapIterator
 
typedef QMap< global_id_t,
local_id_t > 
LocalIdMap
 
typedef QMapIterator
< global_id_t, local_id_t > 
LocaIdMapIterator
 

Public Member Functions

QList< int > globalIndexes ()
 
fromIndex (global_id_t key)
 
void register_ (void *obj)
 
void unregister_ (void *obj)
 
void clearListFor (void *obj)
 
void add (void *obj, local_id_t index, const QString &name, const QString &type=QString())
 
void add (void *obj, D descriptor)
 
QList< D > listFor (const void *obj) const
 
int localIdFor (const void *obj, global_id_t key) const
 

Static Public Member Functions

static GlobalDescriptionContainerinstance ()
 

Static Public Attributes

static GlobalDescriptionContainerself = 0
 

Protected Member Functions

global_id_t nextFreeIndex ()
 

Protected Attributes

GlobalDescriptorMap m_globalDescriptors
 
QMap< const void *, LocalIdMap > m_localIds
 
global_id_t m_peak
 

Member Function Documentation

template<typename D >
void Phonon::GlobalDescriptionContainer< D >::add ( void *  obj,
local_id_t  index,
const QString &  name,
const QString &  type = QString() 
)
inline

Adds a new description object for a specific object. A description object must have a global unique id, which is ensured by using this function, which will either reuse an existing equal ObjectDescription or use the next free unique ID. Using the provided index the unique ID is then mapped to the one of the specific object.

Parameters
objThe object
indexlocal ID (i.e. within the object )
nameName of the description
typeType of the description (e.g. file)
template<typename D >
void Phonon::GlobalDescriptionContainer< D >::add ( void *  obj,
descriptor 
)
inline

Overload function. The index of the provided descriptor must be unique within the context of the container.

Parameters
objThe object
descriptorthe DescriptionObject with unique index
template<typename D >
void Phonon::GlobalDescriptionContainer< D >::clearListFor ( void *  obj)
inline

Clear the internal mapping of global to local id for a given object.

Parameters
objThe object
template<typename D >
D Phonon::GlobalDescriptionContainer< D >::fromIndex ( global_id_t  key)
inline
Parameters
keythe global ID of the ObjectDescription
Returns
ObjectDescriptions associated with a given ID
template<typename D >
QList<int> Phonon::GlobalDescriptionContainer< D >::globalIndexes ( )
inline
Returns
a list of all global unique IDs of all stored ObjectDescriptions
template<typename D >
QList<D> Phonon::GlobalDescriptionContainer< D >::listFor ( const void *  obj) const
inline

List of ObjectDescriptions for a given object, the descriptions are limied by the scope of the type (obviously), so you only get ObjectDescription from the container.

Parameters
objThe object
Returns
the list of ObjectDescriptions for a given object, the descriptions are limied by the scope of the type (obviously), so you only get subtitle descriptions from a subtitle container.
template<typename D >
int Phonon::GlobalDescriptionContainer< D >::localIdFor ( const void *  obj,
global_id_t  key 
) const
inline
Parameters
objThe object
keythe global ID (i.e. index of an ObjectDescription)
Returns
the local ID associated with the description object
template<typename D >
global_id_t Phonon::GlobalDescriptionContainer< D >::nextFreeIndex ( )
inlineprotected
Returns
next free unique index to be used as global ID for an ObjectDescription
template<typename D >
void Phonon::GlobalDescriptionContainer< D >::register_ ( void *  obj)
inline

Registers a new object within the container. This essentially creates a new empty ID map.

Parameters
objThe reference object
template<typename D >
void Phonon::GlobalDescriptionContainer< D >::unregister_ ( void *  obj)
inline

Unregisters a object from the container. This essentially clears the ID map and removes all traces of the object.

Parameters
objThe object

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