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

# ClassValue.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 <VCardClassValue.h>
    00025
    00026 #include <VCardValue.h>
    00027
    00028 #include <kdebug.h>
    00029
    00030 using namespace VCARD;
    00031
    00032 ClassValue::ClassValue()
    00033     :   Value()
    00034 {
    00035 }
    00036
    00037 ClassValue::ClassValue(const ClassValue & x)
    00038     :   Value(x),
    00039         classType_(x.classType_)
    00040 {
    00041 }
    00042
    00043 ClassValue::ClassValue(const QCString & s)
    00044     :   Value(s)
    00045 {
    00046 }
    00047
    00048     ClassValue &
    00049 ClassValue::operator = (ClassValue & x)
    00050 {
    00051     if (*this == x) return *this;
    00052     x.parse();
    00053
    00054     classType_ = x.classType_;
    00055
    00056     Value::operator = (x);
    00057     return *this;
    00058 }
    00059
    00060     ClassValue &
    00061 ClassValue::operator = (const QCString & s)
    00062 {
    00063     Value::operator = (s);
    00064     return *this;
    00065 }
    00066
    00067     bool
    00068 ClassValue::operator == (ClassValue & x)
    00069 {
    00070     x.parse();
    00071     return ( classType_ == x.classType_ );
    00072 }
    00073
    00074 ClassValue::~ClassValue()
    00075 {
    00076 }
    00077
    00078   ClassValue *
    00079 ClassValue::clone()
    00080 {
    00081   return new ClassValue( *this );
    00082 }
    00083
    00084     void
    00085 ClassValue::_parse()
    00086 {
    00087     if (qstricmp(strRep_, "PUBLIC") == 0)
    00088         classType_ = Public;
    00089
    00090     else if (qstricmp(strRep_, "PRIVATE") == 0)
    00091         classType_ = Private;
    00092
    00093     else if (qstricmp(strRep_, "CONFIDENTIAL") == 0)
    00094         classType_ = Confidential;
    00095
    00096     else classType_ = Other;
    00097 }
    00098
    00099     void
    00100 ClassValue::_assemble()
    00101 {
    00102     switch (classType_) {
    00103
    00104         case Public:
    00105             strRep_ = "PUBLIC";
    00106             break;
    00107
    00108         case Private:
    00109             strRep_ = "PRIVATE";
    00110             break;
    00111
    00112         case Confidential:
    00113             strRep_ = "CONFIDENTIAL";
    00114             break;
    00115
    00116         default:
    00117             break;
    00118     }
    00119 }
    00120

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