• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeabc
 

tdeabc

  • tdeabc
sound.cpp
1/*
2 This file is part of libtdeabc.
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., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#include "sound.h"
22
23#include <tqdatastream.h>
24
25using namespace TDEABC;
26
27Sound::Sound()
28 : mIntern( false )
29{
30}
31
32Sound::Sound( const TQString &url )
33 : mUrl( url ), mIntern( false )
34{
35}
36
37Sound::Sound( const TQByteArray &data )
38 : mData( data ), mIntern( true )
39{
40}
41
42Sound::~Sound()
43{
44}
45
46bool Sound::operator==( const Sound &s ) const
47{
48 if ( mIntern != s.mIntern ) return false;
49
50 if ( mIntern ) {
51 if ( mData != s.mData )
52 return false;
53 } else {
54 if ( mUrl != s.mUrl )
55 return false;
56 }
57
58 return true;
59}
60
61bool Sound::operator!=( const Sound &s ) const
62{
63 return !( s == *this );
64}
65
66void Sound::setUrl( const TQString &url )
67{
68 mUrl = url;
69 mIntern = false;
70}
71
72void Sound::setData( const TQByteArray &data )
73{
74 mData = data;
75 mIntern = true;
76}
77
78bool Sound::isIntern() const
79{
80 return mIntern;
81}
82
83bool Sound::isEmpty() const
84{
85 return (!mIntern) && mUrl.isEmpty();
86
87}
88
89TQString Sound::url() const
90{
91 return mUrl;
92}
93
94TQByteArray Sound::data() const
95{
96 return mData;
97}
98
99TQString Sound::asString() const
100{
101 if ( mIntern )
102 return "intern sound";
103 else
104 return mUrl;
105}
106
107TQDataStream &TDEABC::operator<<( TQDataStream &s, const Sound &sound )
108{
109 return s << sound.mIntern << sound.mUrl;
110// return s << sound.mIntern << sound.mUrl << sound.mData;
111}
112
113TQDataStream &TDEABC::operator>>( TQDataStream &s, Sound &sound )
114{
115 s >> sound.mIntern >> sound.mUrl;
116// s >> sound.mIntern >> sound.mUrl >> sound.mData;
117 return s;
118}
TDEABC::Sound
Class that holds a Sound clip for a contact.
Definition: sound.h:60
TDEABC::Sound::~Sound
~Sound()
Destructor.
Definition: sound.cpp:42
TDEABC::Sound::url
TQString url() const
Returns the location URL of this sound.
Definition: sound.cpp:89
TDEABC::Sound::setData
void setData(const TQByteArray &data)
Sets the raw data of the sound.
Definition: sound.cpp:72
TDEABC::Sound::Sound
Sound()
Consturctor.
Definition: sound.cpp:27
TDEABC::Sound::isIntern
bool isIntern() const
Returns whether the sound is described by a URL (extern) or by the raw data (intern).
Definition: sound.cpp:78
TDEABC::Sound::setUrl
void setUrl(const TQString &url)
Sets a URL for the location of the sound file.
Definition: sound.cpp:66
TDEABC::Sound::asString
TQString asString() const
Returns string representation of the sound.
Definition: sound.cpp:99
TDEABC::Sound::data
TQByteArray data() const
Returns the raw data of this sound.
Definition: sound.cpp:94
TDEABC::Sound::isEmpty
bool isEmpty() const
Test if this sound file has been set.
Definition: sound.cpp:83
TDEABC
static data, shared by ALL addressee objects
Definition: address.h:48

tdeabc

Skip menu "tdeabc"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeabc

Skip menu "tdeabc"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeabc by doxygen 1.9.4
This website is maintained by Timothy Pearson.