kradio4  r778
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
soundstreamid.h
Go to the documentation of this file.
1 /***************************************************************************
2  soundstreamid.h - description
3  -------------------
4  begin : Sun Aug 1 2004
5  copyright : (C) 2004 by Martin Witte
6  email : emw-kradio@nocabal.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef KRADIO_SOUNDSTREAMID_H
19 #define KRADIO_SOUNDSTREAMID_H
20 
21 #ifdef HAVE_CONFIG_H
22 #include <config.h>
23 #endif
24 
25 #include <kdemacros.h>
26 #include <QtCore/QMetaType>
27 
28 class KDE_EXPORT SoundStreamID {
29 
30  SoundStreamID(int _id, int _phys_id);
31 public:
32  SoundStreamID();
33  SoundStreamID(const SoundStreamID &org);
34 
35  SoundStreamID &operator = (const SoundStreamID &id);
36 
37  static SoundStreamID createNewID();
38  static SoundStreamID createNewID(const SoundStreamID &oldID);
39 
40  bool operator == (const SoundStreamID id) const { return m_ID == id.m_ID; }
41  bool operator != (const SoundStreamID id) const { return m_ID != id.m_ID; }
42  bool operator > (const SoundStreamID id) const { return m_ID > id.m_ID; }
43  bool operator < (const SoundStreamID id) const { return m_ID < id.m_ID; }
44  bool operator >= (const SoundStreamID id) const { return m_ID >= id.m_ID; }
45  bool operator <= (const SoundStreamID id) const { return m_ID <= id.m_ID; }
46 
47  bool HasSamePhysicalID(const SoundStreamID &x) const { return m_PhysicalID == x.m_PhysicalID; }
48 
49  bool isValid() const { return m_ID != 0; } // m_PhysicalID is not checked!
50  void invalidate();
51 
52  static const SoundStreamID InvalidID;
53 
54  int getID() const { return m_ID; }
55  int getPhysicalID() const { return m_PhysicalID; }
56 
57 protected:
58  unsigned m_ID;
59  unsigned m_PhysicalID;
60  static unsigned nextID;
61  static unsigned nextPhysicalID;
62 };
63 
64 Q_DECLARE_METATYPE(SoundStreamID)
65 
66 #endif
67 
unsigned m_PhysicalID
Definition: soundstreamid.h:59
unsigned m_ID
Definition: soundstreamid.h:58
bool isValid() const
Definition: soundstreamid.h:49
int getID() const
Definition: soundstreamid.h:54
bool HasSamePhysicalID(const SoundStreamID &x) const
Definition: soundstreamid.h:47
static unsigned nextID
Definition: soundstreamid.h:60
int getPhysicalID() const
Definition: soundstreamid.h:55
static unsigned nextPhysicalID
Definition: soundstreamid.h:61
static const SoundStreamID InvalidID
Definition: soundstreamid.h:52