kabc Library API Documentation

URIValue.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 <VCardURIValue.h>
00025 
00026 #include <VCardValue.h>
00027 
00028 using namespace VCARD;
00029 
00030 URIValue::URIValue()
00031     :   Value()
00032 {
00033 }
00034 
00035 URIValue::URIValue(const QCString & scheme, const QCString & schemeSpecificPart)
00036     :   Value(),
00037         scheme_             (scheme),
00038         schemeSpecificPart_ (schemeSpecificPart)
00039 {
00040     parsed_ = true;
00041 }
00042 
00043 URIValue::URIValue(const URIValue & x)
00044     :   Value               (x),
00045         scheme_             (x.scheme_),
00046         schemeSpecificPart_ (x.schemeSpecificPart_)
00047 {
00048 }
00049 
00050 URIValue::URIValue(const QCString & s)
00051     :   Value(s)
00052 {
00053 }
00054 
00055     URIValue &
00056 URIValue::operator = (URIValue & x)
00057 {
00058     if (*this == x) return *this;
00059     
00060     scheme_             = x.scheme_;
00061     schemeSpecificPart_ = x.schemeSpecificPart_;
00062 
00063     Value::operator = (x);
00064     return *this;
00065 }
00066 
00067     URIValue &
00068 URIValue::operator = (const QCString & s)
00069 {
00070     Value::operator = (s);
00071     return *this;
00072 }
00073 
00074     bool
00075 URIValue::operator == (URIValue & x)
00076 {
00077     x.parse();
00078     return (
00079         (scheme_                == x.scheme_) &&
00080         (schemeSpecificPart_    == x.schemeSpecificPart_));
00081 
00082     return false;
00083 }
00084 
00085 URIValue::~URIValue()
00086 {
00087 }
00088 
00089     void
00090 URIValue::_parse()
00091 {
00092     int split = strRep_.find(':');
00093     if (split == -1)
00094         return;
00095     
00096     scheme_ = strRep_.left(split);
00097     schemeSpecificPart_ = strRep_.mid(split + 1);
00098 }
00099 
00100     void
00101 URIValue::_assemble()
00102 {
00103     strRep_ = scheme_ + ':' + schemeSpecificPart_;
00104 }
00105 
00106     QCString
00107 URIValue::scheme()
00108 {
00109     parse();
00110     return scheme_;
00111 }
00112 
00113     QCString
00114 URIValue::schemeSpecificPart()
00115 {
00116     parse();
00117     return schemeSpecificPart_;
00118 }
00119 
00120     void
00121 URIValue::setScheme(const QCString & s)
00122 {
00123     parse();
00124     scheme_ = s;
00125 }
00126 
00127     void
00128 URIValue::setSchemeSpecificPart(const QCString & s)
00129 {
00130     parse();
00131     schemeSpecificPart_ = s;
00132 }
00133 
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:08 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001