kradio4
r778
|
00001 /*************************************************************************** 00002 soundstreamid.h - description 00003 ------------------- 00004 begin : Sun Aug 1 2004 00005 copyright : (C) 2004 by Martin Witte 00006 email : emw-kradio@nocabal.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef KRADIO_SOUNDSTREAMID_H 00019 #define KRADIO_SOUNDSTREAMID_H 00020 00021 #ifdef HAVE_CONFIG_H 00022 #include <config.h> 00023 #endif 00024 00025 #include <kdemacros.h> 00026 #include <QtCore/QMetaType> 00027 00028 class KDE_EXPORT SoundStreamID { 00029 00030 SoundStreamID(int _id, int _phys_id); 00031 public: 00032 SoundStreamID(); 00033 SoundStreamID(const SoundStreamID &org); 00034 00035 SoundStreamID &operator = (const SoundStreamID &id); 00036 00037 static SoundStreamID createNewID(); 00038 static SoundStreamID createNewID(const SoundStreamID &oldID); 00039 00040 bool operator == (const SoundStreamID id) const { return m_ID == id.m_ID; } 00041 bool operator != (const SoundStreamID id) const { return m_ID != id.m_ID; } 00042 bool operator > (const SoundStreamID id) const { return m_ID > id.m_ID; } 00043 bool operator < (const SoundStreamID id) const { return m_ID < id.m_ID; } 00044 bool operator >= (const SoundStreamID id) const { return m_ID >= id.m_ID; } 00045 bool operator <= (const SoundStreamID id) const { return m_ID <= id.m_ID; } 00046 00047 bool HasSamePhysicalID(const SoundStreamID &x) const { return m_PhysicalID == x.m_PhysicalID; } 00048 00049 bool isValid() const { return m_ID != 0; } // m_PhysicalID is not checked! 00050 void invalidate(); 00051 00052 static const SoundStreamID InvalidID; 00053 00054 int getID() const { return m_ID; } 00055 int getPhysicalID() const { return m_PhysicalID; } 00056 00057 protected: 00058 unsigned m_ID; 00059 unsigned m_PhysicalID; 00060 static unsigned nextID; 00061 static unsigned nextPhysicalID; 00062 }; 00063 00064 Q_DECLARE_METATYPE(SoundStreamID) 00065 00066 #endif 00067