AdrValue.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <VCardRToken.h>
00025 #include <VCardAdrValue.h>
00026 #include <VCardValue.h>
00027 #include <VCardDefines.h>
00028
00029 using namespace VCARD;
00030
00031 AdrValue::AdrValue()
00032 : Value()
00033 {
00034 }
00035
00036 AdrValue::AdrValue(const AdrValue & x)
00037 : Value(x),
00038 poBox_ (x.poBox_),
00039 extAddress_ (x.extAddress_),
00040 street_ (x.street_),
00041 locality_ (x.locality_),
00042 region_ (x.region_),
00043 postCode_ (x.postCode_),
00044 countryName_ (x.countryName_)
00045 {
00046 }
00047
00048 AdrValue::AdrValue(const QCString & s)
00049 : Value(s)
00050 {
00051 }
00052
00053 AdrValue &
00054 AdrValue::operator = (AdrValue & x)
00055 {
00056 if (*this == x) return *this;
00057
00058 poBox_ = x.poBox_;
00059 extAddress_ = x.extAddress_;
00060 street_ = x.street_;
00061 locality_ = x.locality_;
00062 region_ = x.region_;
00063 postCode_ = x.postCode_;
00064 countryName_ = x.countryName_;
00065
00066 Value::operator = (x);
00067 return *this;
00068 }
00069
00070 AdrValue &
00071 AdrValue::operator = (const QCString & s)
00072 {
00073 Value::operator = (s);
00074 return *this;
00075 }
00076
00077 bool
00078 AdrValue::operator == (AdrValue & x)
00079 {
00080 parse();
00081 x.parse();
00082
00083 return (
00084 poBox_ == x.poBox_ &&
00085 extAddress_ == x.extAddress_ &&
00086 street_ == x.street_ &&
00087 locality_ == x.locality_ &&
00088 region_ == x.region_ &&
00089 postCode_ == x.postCode_ &&
00090 countryName_ == x.countryName_);
00091 }
00092
00093 AdrValue::~AdrValue()
00094 {
00095 }
00096
00097 AdrValue *
00098 AdrValue::clone()
00099 {
00100 return new AdrValue( *this );
00101 }
00102
00103 void
00104 AdrValue::_parse()
00105 {
00106 vDebug("AdrValue::_parse()");
00107
00108 QStrList l;
00109 RTokenise(strRep_, ";", l);
00110
00111 for (unsigned int i = 0; i < l.count(); i++) {
00112
00113 switch (i) {
00114
00115 case 0: poBox_ = l.at(0); break;
00116 case 1: extAddress_ = l.at(1); break;
00117 case 2: street_ = l.at(2); break;
00118 case 3: locality_ = l.at(3); break;
00119 case 4: region_ = l.at(4); break;
00120 case 5: postCode_ = l.at(5); break;
00121 case 6: countryName_ = l.at(6); break;
00122 default: break;
00123 }
00124 }
00125 }
00126
00127 void
00128 AdrValue::_assemble()
00129 {
00130 vDebug("AdrValue::_assemble");
00131
00132 strRep_ = poBox_;
00133 strRep_ += ";" + extAddress_;
00134 strRep_ += ";" + street_;
00135 strRep_ += ";" + locality_;
00136 strRep_ += ";" + region_;
00137 strRep_ += ";" + postCode_;
00138 strRep_ += ";" + countryName_;
00139 }
00140
This file is part of the documentation for kdelibs Version 3.1.4.