Changeset View
Changeset View
Standalone View
Standalone View
src/maps.h
Show All 40 Lines | |||||
41 | class StreamRestore; | 41 | class StreamRestore; | ||
42 | class Module; | 42 | class Module; | ||
43 | 43 | | |||
44 | /** | 44 | /** | ||
45 | * @see MapBase | 45 | * @see MapBase | ||
46 | * This class is nothing more than the QObject base since moc cannot handle | 46 | * This class is nothing more than the QObject base since moc cannot handle | ||
47 | * templates. | 47 | * templates. | ||
48 | */ | 48 | */ | ||
49 | class Q_DECL_EXPORT MapBaseQObject : public QObject | 49 | class MapBaseQObject : public QObject | ||
50 | { | 50 | { | ||
51 | Q_OBJECT | 51 | Q_OBJECT | ||
52 | 52 | | |||
53 | public: | 53 | public: | ||
54 | virtual int count() const = 0; | 54 | virtual int count() const = 0; | ||
55 | virtual QObject *objectAt(int index) const = 0; | 55 | virtual QObject *objectAt(int index) const = 0; | ||
56 | virtual int indexOfObject(QObject *object) const = 0; | 56 | virtual int indexOfObject(QObject *object) const = 0; | ||
57 | 57 | | |||
58 | signals: | 58 | signals: | ||
59 | void added(int index); | 59 | void added(int index); | ||
60 | void removed(int index); | 60 | void removed(int index); | ||
61 | }; | 61 | }; | ||
62 | 62 | | |||
63 | /** | 63 | /** | ||
64 | * Maps a specific index to a specific object pointer. | 64 | * Maps a specific index to a specific object pointer. | ||
65 | * This is used to give the unique arbitrary PulseAudio index of a PulseObject a | 65 | * This is used to give the unique arbitrary PulseAudio index of a PulseObject a | ||
66 | * serialized list index. Namely it enables us to translate a discrete list | 66 | * serialized list index. Namely it enables us to translate a discrete list | ||
67 | * index to a pulse index to an object, and any permutation thereof. | 67 | * index to a pulse index to an object, and any permutation thereof. | ||
68 | */ | 68 | */ | ||
69 | template<typename Type, typename PAInfo> | 69 | template<typename Type, typename PAInfo> | ||
70 | class Q_DECL_EXPORT MapBase : public MapBaseQObject | 70 | class MapBase : public MapBaseQObject | ||
71 | { | 71 | { | ||
72 | public: | 72 | public: | ||
73 | virtual ~MapBase() {} | 73 | virtual ~MapBase() {} | ||
74 | 74 | | |||
75 | const QMap<quint32, Type *> &data() const { return m_data; } | 75 | const QMap<quint32, Type *> &data() const { return m_data; } | ||
76 | 76 | | |||
77 | int count() const Q_DECL_OVERRIDE | 77 | int count() const Q_DECL_OVERRIDE | ||
78 | { | 78 | { | ||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |