address.h
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KABC_ADDRESS_H
#define KABC_ADDRESS_H
#include <qmap.h>
#include <qstring.h>
#include <qvaluelist.h>
#include <kdelibs_export.h>
// template tags for address formatting localization
#define KABC_FMTTAG_realname QString("%n")
#define KABC_FMTTAG_REALNAME QString("%N")
#define KABC_FMTTAG_company QString("%cm")
#define KABC_FMTTAG_COMPANY QString("%CM")
#define KABC_FMTTAG_pobox QString("%p")
#define KABC_FMTTAG_street QString("%s")
#define KABC_FMTTAG_STREET QString("%S")
#define KABC_FMTTAG_zipcode QString("%z")
#define KABC_FMTTAG_location QString("%l")
#define KABC_FMTTAG_LOCATION QString("%L")
#define KABC_FMTTAG_region QString("%r")
#define KABC_FMTTAG_REGION QString("%R")
#define KABC_FMTTAG_newline QString("\\n")
#define KABC_FMTTAG_condcomma QString("%,")
#define KABC_FMTTAG_condwhite QString("%w")
#define KABC_FMTTAG_purgeempty QString("%0")
namespace KABC {
class KABC_EXPORT Address
{
friend KABC_EXPORT QDataStream &operator<<( QDataStream &, const Address & );
friend KABC_EXPORT QDataStream &operator>>( QDataStream &, Address & );
public:
typedef QValueList<Address> List;
typedef QValueList<int> TypeList;
enum Type { Dom = 1, Intl = 2, Postal = 4, Parcel = 8, Home = 16, Work = 32,
Pref = 64 };
Address();
Address( int );
bool operator==( const Address & ) const;
bool operator!=( const Address & ) const;
bool isEmpty() const;
void clear();
void setId( const QString & );
/*
Returns the unique id.
*/
QString id() const;
void setType( int type );
int type() const;
QString typeLabel() const;
void setPostOfficeBox( const QString & );
QString postOfficeBox() const;
static QString postOfficeBoxLabel();
void setExtended( const QString & );
QString extended() const;
static QString extendedLabel();
void setStreet( const QString & );
QString street() const;
static QString streetLabel();
void setLocality( const QString & );
QString locality() const;
static QString localityLabel();
void setRegion( const QString & );
QString region() const;
static QString regionLabel();
void setPostalCode( const QString & );
QString postalCode() const;
static QString postalCodeLabel();
void setCountry( const QString & );
QString country() const;
static QString countryLabel();
void setLabel( const QString & );
QString label() const;
static QString labelLabel();
static TypeList typeList();
static QString typeLabel( int type );
void dump() const;
QString formattedAddress( const QString &realName=QString::null
, const QString &orgaName=QString::null ) const;
static QString countryToISO( const QString &cname );
static QString ISOtoCountry( const QString &ISOname );
private:
bool parseAddressTemplateSection( const QString &tsection
, QString &result
, const QString &realName
, const QString &orgaName ) const;
int findBalancedBracket( const QString &tsection, int pos ) const;
bool mEmpty;
QString mId;
int mType;
QString mPostOfficeBox;
QString mExtended;
QString mStreet;
QString mLocality;
QString mRegion;
QString mPostalCode;
QString mCountry;
QString mLabel;
static QMap<QString, QString> *mISOMap;
};
KABC_EXPORT QDataStream &operator<<( QDataStream &, const Address & );
KABC_EXPORT QDataStream &operator>>( QDataStream &, Address & );
}
#endif
KABC::Address
Postal address information.
Definition: address.h:55
KABC::Address::List
QValueList< Address > List
List of addresses.
Definition: address.h:64
operator<<
kdbgstream & operator<<(const QValueList< T > &list)
KABC::Address::Type
Type
Address types:
Definition: address.h:78

KDE Home | KDE Accessibility Home | Description of Access Keys