kabc Library: AdrValue.cpp Source File (kabc Library)

| # kabc Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# AdrValue.cpp

    00001 /*
    00002     libvcard - vCard parsing library for vCard version 3.0
    00003
    00004     Copyright (C) 1998 Rik Hemsley rik@kde.org
    00005
    00006   Permission is hereby granted, free of charge, to any person obtaining a copy
    00007   of this software and associated documentation files (the "Software"), to
    00008   deal in the Software without restriction, including without limitation the
    00009   rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
    00010   sell copies of the Software, and to permit persons to whom the Software is
    00011   furnished to do so, subject to the following conditions:
    00012
    00013   The above copyright notice and this permission notice shall be included in
    00014   all copies or substantial portions of the Software.
    00015
    00016   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    00017   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00018   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    00019   AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
    00020   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    00021   WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    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 kabc Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:31:29 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003