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

kabc

  • kabc
address.h
1 /*
2  This file is part of libkabc.
3  Copyright (c) 2001 Cornelius Schumacher <schumacher@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 #ifndef KABC_ADDRESS_H
22 #define KABC_ADDRESS_H
23 
24 #include <tqmap.h>
25 #include <tqstring.h>
26 #include <tqvaluelist.h>
27 
28 #include <kdelibs_export.h>
29 
30 // template tags for address formatting localization
31 #define KABC_FMTTAG_realname TQString("%n")
32 #define KABC_FMTTAG_REALNAME TQString("%N")
33 #define KABC_FMTTAG_company TQString("%cm")
34 #define KABC_FMTTAG_COMPANY TQString("%CM")
35 #define KABC_FMTTAG_pobox TQString("%p")
36 #define KABC_FMTTAG_street TQString("%s")
37 #define KABC_FMTTAG_STREET TQString("%S")
38 #define KABC_FMTTAG_zipcode TQString("%z")
39 #define KABC_FMTTAG_location TQString("%l")
40 #define KABC_FMTTAG_LOCATION TQString("%L")
41 #define KABC_FMTTAG_region TQString("%r")
42 #define KABC_FMTTAG_REGION TQString("%R")
43 #define KABC_FMTTAG_newline TQString("\\n")
44 #define KABC_FMTTAG_condcomma TQString("%,")
45 #define KABC_FMTTAG_condwhite TQString("%w")
46 #define KABC_FMTTAG_purgeempty TQString("%0")
47 
48 namespace KABC {
49 
55 class KABC_EXPORT Address
56 {
57  friend KABC_EXPORT TQDataStream &operator<<( TQDataStream &, const Address & );
58  friend KABC_EXPORT TQDataStream &operator>>( TQDataStream &, Address & );
59 
60  public:
64  typedef TQValueList<Address> List;
65  typedef TQValueList<int> TypeList;
66 
78  enum Type { Dom = 1, Intl = 2, Postal = 4, Parcel = 8, Home = 16, Work = 32,
79  Pref = 64 };
80 
85  Address();
86 
91  Address( int );
92 
93  bool operator==( const Address & ) const;
94  bool operator!=( const Address & ) const;
95 
99  bool isEmpty() const;
100 
104  void clear();
105 
109  void setId( const TQString & );
110 
111  /*
112  Returns the unique id.
113  */
114  TQString id() const;
115 
121  void setType( int type );
122 
126  int type() const;
127 
131  TQString typeLabel() const;
132 
136  void setPostOfficeBox( const TQString & );
137 
141  TQString postOfficeBox() const;
142 
146  static TQString postOfficeBoxLabel();
147 
151  void setExtended( const TQString & );
152 
156  TQString extended() const;
157 
161  static TQString extendedLabel();
162 
166  void setStreet( const TQString & );
167 
171  TQString street() const;
172 
176  static TQString streetLabel();
177 
181  void setLocality( const TQString & );
182 
186  TQString locality() const;
187 
191  static TQString localityLabel();
192 
196  void setRegion( const TQString & );
197 
201  TQString region() const;
202 
206  static TQString regionLabel();
207 
211  void setPostalCode( const TQString & );
212 
216  TQString postalCode() const;
217 
221  static TQString postalCodeLabel();
222 
226  void setCountry( const TQString & );
227 
231  TQString country() const;
232 
236  static TQString countryLabel();
237 
241  void setLabel( const TQString & );
242 
246  TQString label() const;
247 
251  static TQString labelLabel();
252 
256  static TypeList typeList();
257 
261  static TQString typeLabel( int type );
262 
266  void dump() const;
267 
279  TQString formattedAddress( const TQString &realName=TQString::null
280  , const TQString &orgaName=TQString::null ) const;
281 
289  static TQString countryToISO( const TQString &cname );
290 
298  static TQString ISOtoCountry( const TQString &ISOname );
299 
300  private:
307  bool parseAddressTemplateSection( const TQString &tsection
308  , TQString &result
309  , const TQString &realName
310  , const TQString &orgaName ) const;
311 
317  int findBalancedBracket( const TQString &tsection, int pos ) const;
318 
319  bool mEmpty;
320 
321  TQString mId;
322  int mType;
323 
324  TQString mPostOfficeBox;
325  TQString mExtended;
326  TQString mStreet;
327  TQString mLocality;
328  TQString mRegion;
329  TQString mPostalCode;
330  TQString mCountry;
331  TQString mLabel;
332 
333  static TQMap<TQString, TQString> *mISOMap;
334 };
335 
336 KABC_EXPORT TQDataStream &operator<<( TQDataStream &, const Address & );
337 KABC_EXPORT TQDataStream &operator>>( TQDataStream &, Address & );
338 
339 }
340 
341 #endif

kabc

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

kabc

Skip menu "kabc"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kabc by doxygen 1.8.1.2
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |