author | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
commit | b9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff) | |
tree | 2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /kabc/sound.h | |
download | kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2 |
Initial revision
-rw-r--r-- | kabc/sound.h | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/kabc/sound.h b/kabc/sound.h new file mode 100644 index 0000000..0ec5ec8 --- a/dev/null +++ b/kabc/sound.h | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | This file is part of libkabc. | ||
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Library General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Library General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Library General Public License | ||
16 | along with this library; see the file COPYING.LIB. If not, write to | ||
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | Enhanced Version of the file for platform independent KDE tools. | ||
23 | Copyright (c) 2004 Ulf Schenk | ||
24 | |||
25 | $Id$ | ||
26 | */ | ||
27 | |||
28 | #ifndef KABC_SOUND_H | ||
29 | #define KABC_SOUND_H | ||
30 | |||
31 | #include <qcstring.h> | ||
32 | #include <qstring.h> | ||
33 | |||
34 | namespace KABC { | ||
35 | |||
36 | class Sound | ||
37 | { | ||
38 | friend QDataStream &operator<<( QDataStream &, const Sound & ); | ||
39 | friend QDataStream &operator>>( QDataStream &, Sound & ); | ||
40 | |||
41 | public: | ||
42 | |||
43 | /** | ||
44 | * Consturctor. Creates an empty object. | ||
45 | */ | ||
46 | Sound(); | ||
47 | |||
48 | /** | ||
49 | * Consturctor. | ||
50 | * | ||
51 | * @param url A URL that describes the position of the sound file. | ||
52 | */ | ||
53 | Sound( const QString &url ); | ||
54 | |||
55 | /** | ||
56 | * Consturctor. | ||
57 | * | ||
58 | * @param data The raw data of the sound. | ||
59 | */ | ||
60 | Sound( const QByteArray &data ); | ||
61 | |||
62 | /** | ||
63 | * Destructor. | ||
64 | */ | ||
65 | ~Sound(); | ||
66 | |||
67 | |||
68 | bool operator==( const Sound & ) const; | ||
69 | bool operator!=( const Sound & ) const; | ||
70 | |||
71 | /** | ||
72 | * Sets a URL for the location of the sound file. When using this | ||
73 | * function, @ref isIntern() will return 'false' until you use | ||
74 | * @ref setData(). | ||
75 | * | ||
76 | * @param url The location URL of the sound file. | ||
77 | */ | ||
78 | void setUrl( const QString &url ); | ||
79 | |||
80 | /** | ||
81 | * Sets the raw data of the sound. When using this function, | ||
82 | * @ref isIntern() will return 'true' until you use @ref setUrl(). | ||
83 | * | ||
84 | * @param data The raw data of the sound. | ||
85 | */ | ||
86 | void setData( const QByteArray &data ); | ||
87 | |||
88 | /** | ||
89 | * Returns whether the sound is described by a URL (extern) or | ||
90 | * by the raw data (intern). | ||
91 | * When this method returns 'true' you can use @ref data() to | ||
92 | * get the raw data. Otherwise you can request the URL of this | ||
93 | * sound by @ref url() and load the raw data from that location. | ||
94 | */ | ||
95 | bool isIntern() const; | ||
96 | |||
97 | /** | ||
98 | * Returns the location URL of this sound. | ||
99 | */ | ||
100 | QString url() const; | ||
101 | |||
102 | /** | ||
103 | * Returns the raw data of this sound. | ||
104 | */ | ||
105 | QByteArray data() const; | ||
106 | |||
107 | /** | ||
108 | * Returns string representation of the sound. | ||
109 | */ | ||
110 | QString asString() const; | ||
111 | |||
112 | private: | ||
113 | QString mUrl; | ||
114 | QByteArray mData; | ||
115 | |||
116 | int mIntern; | ||
117 | }; | ||
118 | |||
119 | QDataStream &operator<<( QDataStream &, const Sound & ); | ||
120 | QDataStream &operator>>( QDataStream &, Sound & ); | ||
121 | |||
122 | } | ||
123 | #endif | ||