# kabc Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# address.h

    00001 /*
    00002     This file is part of libkabc.
    00003     Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
    00004
    00005     This library is free software; you can redistribute it and/or
    00006     modify it under the terms of the GNU Library General Public
    00007     License as published by the Free Software Foundation; either
    00008     version 2 of the License, or (at your option) any later version.
    00009
    00010     This library is distributed in the hope that it will be useful,
    00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013     Library General Public License for more details.
    00014
    00015     You should have received a copy of the GNU Library General Public License
    00016     along with this library; see the file COPYING.LIB.  If not, write to
    00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00018     Boston, MA 02111-1307, USA.
    00019 */
    00020
    00021 #ifndef KABC_ADDRESS_H
    00022 #define KABC_ADDRESS_H
    00023
    00024 #include <qmap.h>
    00025 #include <qstring.h>
    00026 #include <qvaluelist.h>
    00027
    00028 #include <kdelibs_export.h>
    00029
    00030 // template tags for address formatting localization
    00031 #define KABC_FMTTAG_realname   QString("%n")
    00032 #define KABC_FMTTAG_REALNAME   QString("%N")
    00033 #define KABC_FMTTAG_company    QString("%cm")
    00034 #define KABC_FMTTAG_COMPANY    QString("%CM")
    00035 #define KABC_FMTTAG_pobox      QString("%p")
    00036 #define KABC_FMTTAG_street     QString("%s")
    00037 #define KABC_FMTTAG_STREET     QString("%S")
    00038 #define KABC_FMTTAG_zipcode    QString("%z")
    00039 #define KABC_FMTTAG_location   QString("%l")
    00040 #define KABC_FMTTAG_LOCATION   QString("%L")
    00041 #define KABC_FMTTAG_region     QString("%r")
    00042 #define KABC_FMTTAG_REGION     QString("%R")
    00043 #define KABC_FMTTAG_newline    QString("\\n")
    00044 #define KABC_FMTTAG_condcomma  QString("%,")
    00045 #define KABC_FMTTAG_condwhite  QString("%w")
    00046 #define KABC_FMTTAG_purgeempty QString("%0")
    00047
    00048 namespace KABC {
    00049
    00055 class KABC_EXPORT Address
    00056 {
    00057     friend KABC_EXPORT QDataStream &operator<<( QDataStream &, const Address & );
    00058     friend KABC_EXPORT QDataStream &operator>>( QDataStream &, Address & );
    00059
    00060   public:
    00064     typedef QValueList<Address> List;
    00065     typedef QValueList<int> TypeList;
    00066
    00078     enum Type { Dom = 1, Intl = 2, Postal = 4, Parcel = 8, Home = 16, Work = 32,
    00079            Pref = 64 };
    00080
    00085     Address();
    00086
    00091     Address( int );
    00092
    00093     bool operator==( const Address & ) const;
    00094     bool operator!=( const Address & ) const;
    00095
    00099     bool isEmpty() const;
    00100
    00104     void clear();
    00105
    00109     void setId( const QString & );
    00110
    00111     /*
    00112       Returns the unique id.
    00113     */
    00114     QString id() const;
    00115
    00121     void setType( int type );
    00122
    00126     int type() const;
    00127
    00131     QString typeLabel() const;
    00132
    00136     void setPostOfficeBox( const QString & );
    00137
    00141     QString postOfficeBox() const;
    00142
    00146     static QString postOfficeBoxLabel();
    00147
    00151     void setExtended( const QString & );
    00152
    00156     QString extended() const;
    00157
    00161     static QString extendedLabel();
    00162
    00166     void setStreet( const QString & );
    00167
    00171     QString street() const;
    00172
    00176     static QString streetLabel();
    00177
    00181     void setLocality( const QString & );
    00182
    00186     QString locality() const;
    00187
    00191     static QString localityLabel();
    00192
    00196     void setRegion( const QString & );
    00197
    00201     QString region() const;
    00202
    00206     static QString regionLabel();
    00207
    00211     void setPostalCode( const QString & );
    00212
    00216     QString postalCode() const;
    00217
    00221     static QString postalCodeLabel();
    00222
    00226     void setCountry( const QString & );
    00227
    00231     QString country() const;
    00232
    00236     static QString countryLabel();
    00237
    00241     void setLabel( const QString & );
    00242
    00246     QString label() const;
    00247
    00251     static QString labelLabel();
    00252
    00256     static TypeList typeList();
    00257
    00261     static QString typeLabel( int type );
    00262
    00266     void dump() const;
    00267
    00279     QString formattedAddress( const QString &realName=QString::null
    00280                             , const QString &orgaName=QString::null ) const;
    00281
    00289     static QString countryToISO( const QString &cname );
    00290
    00298     static QString ISOtoCountry( const QString &ISOname );
    00299
    00300   private:
    00307     bool parseAddressTemplateSection( const QString &tsection
    00308                                     ,       QString &result
    00309                                     , const QString &realName
    00310                                     , const QString &orgaName ) const;
    00311
    00317     int  findBalancedBracket( const QString &tsection, int pos ) const;
    00318
    00319     bool mEmpty;
    00320
    00321     QString mId;
    00322     int mType;
    00323
    00324     QString mPostOfficeBox;
    00325     QString mExtended;
    00326     QString mStreet;
    00327     QString mLocality;
    00328     QString mRegion;
    00329     QString mPostalCode;
    00330     QString mCountry;
    00331     QString mLabel;
    00332
    00333     static QMap<QString, QString> *mISOMap;
    00334 };
    00335
    00336 KABC_EXPORT QDataStream &operator<<( QDataStream &, const Address & );
    00337 KABC_EXPORT QDataStream &operator>>( QDataStream &, Address & );
    00338
    00339 }
    00340
    00341 #endif

This file is part of the documentation for kabc Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:31:28 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003