kabc Library API Documentation

EmailParam.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 <VCardEmailParam.h>
00025 #include <VCardParam.h>
00026 #include <VCardDefines.h>
00027 
00028 using namespace VCARD;
00029 
00030 EmailParam::EmailParam()
00031     :   Param()
00032 {
00033     vDebug("ctor");
00034 }
00035 
00036 EmailParam::EmailParam(const EmailParam & x)
00037     :   Param(x),
00038         emailType_  (x.emailType_),
00039         pref_       (x.pref_)
00040 {
00041 }
00042 
00043 EmailParam::EmailParam(const QCString & s)
00044     :   Param(s)
00045 {
00046 }
00047 
00048     EmailParam &
00049 EmailParam::operator = (EmailParam & x)
00050 {
00051     if (*this == x) return *this;
00052     
00053     emailType_  = x.emailType();
00054     pref_       = x.pref_;
00055 
00056     Param::operator = (x);
00057     return *this;
00058 }
00059 
00060     EmailParam &
00061 EmailParam::operator = (const QCString & s)
00062 {
00063     Param::operator = (s);
00064     return *this;
00065 }
00066 
00067     bool
00068 EmailParam::operator == (EmailParam & x)
00069 {
00070     parse();
00071 
00072     if (pref_)
00073         return (x.pref_ && x.emailType() == emailType_);
00074 
00075     return !x.pref();
00076 }
00077 
00078 EmailParam::~EmailParam()
00079 {
00080 }
00081 
00082     void
00083 EmailParam::_parse()
00084 {
00085 #if 0
00086     Param::parseToList();
00087     
00088     SubParamListIterator it(subParamList_);
00089     
00090     pref_ = true;
00091     emailType_ = "";
00092 
00093     for (; it.current(); ++it) {
00094     
00095         if (qstricmp(it.current()->name(), "TYPE") == 0) {
00096             emailType_ = it.current()->value();
00097             continue;
00098         }
00099         
00100         if (qstricmp(it.current()->name(), "PREF") == 0) {
00101             pref_ = true;
00102         }
00103     }
00104 #endif
00105 }
00106 
00107     void
00108 EmailParam::_assemble()
00109 {
00110     strRep_ = "TYPE=";
00111     strRep_ += emailType_;
00112 
00113     if (pref_)
00114         strRep_ += ",PREF";
00115 }
00116 
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:22:07 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001