phonenumber.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., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KABC_PHONENUMBER_H 00022 #define KABC_PHONENUMBER_H 00023 00024 #include <qvaluelist.h> 00025 #include <qstring.h> 00026 00027 #include <kdelibs_export.h> 00028 00029 namespace KABC { 00030 00038 class KABC_EXPORT PhoneNumber 00039 { 00040 friend KABC_EXPORT QDataStream &operator<<( QDataStream &, const PhoneNumber & ); 00041 friend KABC_EXPORT QDataStream &operator>>( QDataStream &, PhoneNumber & ); 00042 00043 public: 00044 typedef QValueList<PhoneNumber> List; 00045 typedef QValueList<int> TypeList; 00046 00063 enum Types { Home = 1, Work = 2, Msg = 4, Pref = 8, Voice = 16, Fax = 32, 00064 Cell = 64, Video = 128, Bbs = 256, Modem = 512, Car = 1024, 00065 Isdn = 2048, Pcs = 4096, Pager = 8192 }; 00066 00070 PhoneNumber(); 00071 00079 PhoneNumber( const QString &number, int type = Home ); 00080 00084 ~PhoneNumber(); 00085 00086 bool operator==( const PhoneNumber & ) const; 00087 bool operator!=( const PhoneNumber & ) const; 00088 00092 void setId( const QString &id ); 00093 00097 QString id() const; 00098 00102 void setNumber( const QString & ); 00103 00107 QString number() const; 00108 00113 void setType( int ); 00114 00118 int type() const; 00119 00123 QString typeLabel() const; 00124 00128 QString label() const; 00129 00133 static TypeList typeList(); 00134 00138 static QString typeLabel( int type ); 00139 00144 static QString label( int type ); 00145 00146 private: 00147 void init(); 00148 void validateNumber( const QString& ); 00149 00150 QString mId; 00151 00152 int mType; 00153 QString mNumber; 00154 }; 00155 00156 KABC_EXPORT QDataStream &operator<<( QDataStream &, const PhoneNumber & ); 00157 KABC_EXPORT QDataStream &operator>>( QDataStream &, PhoneNumber & ); 00158 00159 } 00160 00161 #endif