Phonon::GlobalDescriptionContainer
#include <globaldescriptioncontainer.h>
Public Types | |
typedef int | global_id_t |
typedef QMap< global_id_t, D > | GlobalDescriptorMap |
typedef QMapIterator< global_id_t, D > | GlobalDescriptorMapIterator |
typedef QMapIterator< global_id_t, local_id_t > | LocaIdMapIterator |
typedef int | local_id_t |
typedef QMap< global_id_t, local_id_t > | LocalIdMap |
Public Member Functions | |
void | add (void *obj, D descriptor) |
void | add (void *obj, local_id_t index, const QString &name, const QString &type=QString()) |
void | clearListFor (void *obj) |
D | fromIndex (global_id_t key) |
QList< int > | globalIndexes () |
QList< D > | listFor (const void *obj) const |
int | localIdFor (const void *obj, global_id_t key) const |
void | register_ (void *obj) |
void | unregister_ (void *obj) |
Static Public Member Functions | |
static GlobalDescriptionContainer * | instance () |
Static Public Attributes | |
static GlobalDescriptionContainer * | self = 0 |
Protected Member Functions | |
global_id_t | nextFreeIndex () |
Protected Attributes | |
GlobalDescriptorMap | m_globalDescriptors |
QMap< const void *, LocalIdMap > | m_localIds |
global_id_t | m_peak |
Detailed Description
class Phonon::GlobalDescriptionContainer< D >
A container for object descriptions. The primary use of this container is to turn ObjectDescriptions with unique id scope smaller than backend into globally unique ones.
For example a MediaController enhances a MediaObject, you may have multiple MediaObjects and thus MediaControllers in one application. The interface to query all subtitles is only available on the backend class itself though, so the index/id of the descriptions handed to a Phonon API user must be unique with global scope. This is where the GlobalDescriptionContainer comes in. It allows arbitrary objects to register (using object address) with the container (which is a singleton). The object hands its locally unique ObjectDescriptions to the container, which turns it into a globally unique description and maps the global id to the local id.
That way it is possible to easily map local to global description objects.
Definition at line 60 of file globaldescriptioncontainer.h.
Member Typedef Documentation
◆ global_id_t
int Phonon::GlobalDescriptionContainer< D >::global_id_t |
Definition at line 63 of file globaldescriptioncontainer.h.
◆ GlobalDescriptorMap
QMap<global_id_t, D> Phonon::GlobalDescriptionContainer< D >::GlobalDescriptorMap |
Definition at line 66 of file globaldescriptioncontainer.h.
◆ GlobalDescriptorMapIterator
QMapIterator<global_id_t, D> Phonon::GlobalDescriptionContainer< D >::GlobalDescriptorMapIterator |
Definition at line 67 of file globaldescriptioncontainer.h.
◆ LocaIdMapIterator
QMapIterator<global_id_t, local_id_t> Phonon::GlobalDescriptionContainer< D >::LocaIdMapIterator |
Definition at line 70 of file globaldescriptioncontainer.h.
◆ local_id_t
int Phonon::GlobalDescriptionContainer< D >::local_id_t |
Definition at line 64 of file globaldescriptioncontainer.h.
◆ LocalIdMap
QMap<global_id_t, local_id_t> Phonon::GlobalDescriptionContainer< D >::LocalIdMap |
Definition at line 69 of file globaldescriptioncontainer.h.
Constructor & Destructor Documentation
◆ ~GlobalDescriptionContainer()
|
inlinevirtual |
Definition at line 82 of file globaldescriptioncontainer.h.
◆ GlobalDescriptionContainer()
|
inlineprotected |
Definition at line 262 of file globaldescriptioncontainer.h.
Member Function Documentation
◆ add() [1/2]
|
inline |
Overload function.
The index of the provided descriptor must be unique within the context of the container.
- Parameters
-
obj The object descriptor the DescriptionObject with unique index
Definition at line 207 of file globaldescriptioncontainer.h.
◆ add() [2/2]
|
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
-
obj The object index local ID (i.e. within the object @obj) name Name of the description type Type of the description (e.g. file)
Definition at line 166 of file globaldescriptioncontainer.h.
◆ clearListFor()
|
inline |
Clear the internal mapping of global to local id for a given object.
- Parameters
-
obj The object
Definition at line 144 of file globaldescriptioncontainer.h.
◆ fromIndex()
|
inline |
- Parameters
-
key the global ID of the ObjectDescription
- Returns
- ObjectDescriptions associated with a given ID
Definition at line 103 of file globaldescriptioncontainer.h.
◆ globalIndexes()
|
inline |
- Returns
- a list of all global unique IDs of all stored ObjectDescriptions
Definition at line 87 of file globaldescriptioncontainer.h.
◆ instance()
|
inlinestatic |
Definition at line 75 of file globaldescriptioncontainer.h.
◆ listFor()
|
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
-
obj The 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.
Definition at line 229 of file globaldescriptioncontainer.h.
◆ localIdFor()
|
inline |
- Parameters
-
obj The object key the global ID (i.e. index of an ObjectDescription)
- Returns
- the local ID associated with the description object
Definition at line 250 of file globaldescriptioncontainer.h.
◆ nextFreeIndex()
|
inlineprotected |
- Returns
- next free unique index to be used as global ID for an ObjectDescription
Definition at line 270 of file globaldescriptioncontainer.h.
◆ register_()
|
inline |
Registers a new object within the container.
This essentially creates a new empty ID map.
- Parameters
-
obj The reference object
Definition at line 116 of file globaldescriptioncontainer.h.
◆ unregister_()
|
inline |
Unregisters a object from the container.
This essentially clears the ID map and removes all traces of the object.
- Parameters
-
obj The object
Definition at line 130 of file globaldescriptioncontainer.h.
Member Data Documentation
◆ m_globalDescriptors
|
protected |
Definition at line 275 of file globaldescriptioncontainer.h.
◆ m_localIds
|
protected |
Definition at line 276 of file globaldescriptioncontainer.h.
◆ m_peak
|
protected |
Definition at line 278 of file globaldescriptioncontainer.h.
◆ self
|
static |
Definition at line 73 of file globaldescriptioncontainer.h.
The documentation for this class was generated from the following file:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:01:16 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.