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

tdeabc

  • tdeabc
agent.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 "addressee.h"
22
23#include "agent.h"
24
25using namespace TDEABC;
26
27Agent::Agent()
28 : mAddressee( 0 ), mIntern( false )
29{
30}
31
32Agent::Agent( const TQString &url )
33 : mAddressee( 0 ),mUrl( url ), mIntern( false )
34{
35}
36
37Agent::Agent( Addressee *addressee )
38 : mAddressee( addressee ), mIntern( true )
39{
40}
41
42Agent::~Agent()
43{
44 delete mAddressee;
45 mAddressee = 0;
46}
47
48bool Agent::operator==( const Agent &a ) const
49{
50 if ( mIntern != a.mIntern )
51 return false;
52
53 if ( !mIntern ) {
54 if ( mUrl != a.mUrl )
55 return false;
56 } else {
57 if ( mAddressee && !a.mAddressee ) return false;
58 if ( !mAddressee && a.mAddressee ) return false;
59 if ( !mAddressee && !a.mAddressee ) return false;
60 if ( (*mAddressee) != (*a.mAddressee) ) return false;
61 }
62
63 return true;
64}
65
66bool Agent::operator!=( const Agent &a ) const
67{
68 return !( a == *this );
69}
70
71Agent &Agent::operator=( const Agent &addr )
72{
73 if ( this == &addr )
74 return *this;
75
76 if ( addr.mIntern && addr.mAddressee ) {
77 if ( mAddressee )
78 delete mAddressee;
79
80 mAddressee = new Addressee;
81 *mAddressee = *(addr.mAddressee);
82 }
83
84 mUrl = addr.mUrl;
85 mIntern = addr.mIntern;
86
87 return *this;
88}
89
90void Agent::setUrl( const TQString &url )
91{
92 mUrl = url;
93 mIntern = false;
94}
95
96void Agent::setAddressee( Addressee *addressee )
97{
98 mAddressee = addressee;
99 mIntern = true;
100}
101
102bool Agent::isIntern() const
103{
104 return mIntern;
105}
106
107TQString Agent::url() const
108{
109 return mUrl;
110}
111
112Addressee *Agent::addressee() const
113{
114 return mAddressee;
115}
116
117TQString Agent::asString() const
118{
119 if ( mIntern )
120 return "intern agent";
121 else
122 return mUrl;
123}
124
125TQDataStream &TDEABC::operator<<( TQDataStream &s, const Agent &agent )
126{
127 TQ_UINT32 hasAddressee = ( agent.mAddressee != 0 );
128
129 s << agent.mIntern << agent.mUrl << hasAddressee;
130 if ( hasAddressee )
131 s << (*agent.mAddressee);
132
133 return s;
134}
135
136TQDataStream &TDEABC::operator>>( TQDataStream &s, Agent &agent )
137{
138 TQ_UINT32 hasAddressee;
139
140 s >> agent.mIntern >> agent.mUrl >> hasAddressee;
141
142 if ( hasAddressee ) {
143 agent.mAddressee = new Addressee;
144 s >> (*agent.mAddressee);
145 }
146
147 return s;
148}
TDEABC::Addressee
address book entry
Definition: addressee.src.h:75
TDEABC::Agent
Important!!!
Definition: agent.h:41
TDEABC::Agent::setAddressee
void setAddressee(Addressee *addressee)
Sets the addressee of the agent.
Definition: agent.cpp:96
TDEABC::Agent::Agent
Agent()
Consturctor.
Definition: agent.cpp:27
TDEABC::Agent::setUrl
void setUrl(const TQString &url)
Sets a URL for the location of the agent file.
Definition: agent.cpp:90
TDEABC::Agent::addressee
Addressee * addressee() const
Returns the addressee object of this agent.
Definition: agent.cpp:112
TDEABC::Agent::asString
TQString asString() const
Returns string representation of the agent.
Definition: agent.cpp:117
TDEABC::Agent::url
TQString url() const
Returns the location URL of this agent.
Definition: agent.cpp:107
TDEABC::Agent::isIntern
bool isIntern() const
Returns whether the agent is described by a URL (extern) or by a addressee (intern).
Definition: agent.cpp:102
TDEABC::Agent::~Agent
~Agent()
Destructor.
Definition: agent.cpp:42
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.