TextBinValue.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 <kmdcodec.h>
00025 
00026 #include <VCardTextBinValue.h>
00027 #include <VCardValue.h>
00028 
00029 using namespace VCARD;
00030 
00031 TextBinValue::TextBinValue()
00032     :   Value()
00033 {
00034 }
00035 
00036 TextBinValue::TextBinValue(const TextBinValue & x)
00037     :   Value(x)
00038 {
00039   mIsBinary_ = x.mIsBinary_;
00040   mData_ = x.mData_;
00041   mUrl_ = x.mUrl_;
00042 }
00043 
00044 TextBinValue::TextBinValue(const QCString & s)
00045     :   Value(s)
00046 {
00047 }
00048 
00049     TextBinValue &
00050 TextBinValue::operator = (TextBinValue & x)
00051 {
00052     if (*this == x) return *this;
00053 
00054   mIsBinary_ = x.mIsBinary_;
00055   mData_ = x.mData_;
00056   mUrl_ = x.mUrl_;
00057 
00058     Value::operator = (x);
00059     return *this;
00060 }
00061 
00062     TextBinValue &
00063 TextBinValue::operator = (const QCString & s)
00064 {
00065     Value::operator = (s);
00066     return *this;
00067 }
00068 
00069     bool
00070 TextBinValue::operator == (TextBinValue & x)
00071 {
00072     x.parse();
00073 
00074   if ( mIsBinary_ != x.mIsBinary_ ) return false;
00075   if ( mData_ != x.mData_ ) return false;
00076   if ( mUrl_ != x.mUrl_ ) return false;
00077 
00078     return true;
00079 }
00080 
00081 TextBinValue::~TextBinValue()
00082 {
00083 }
00084 
00085   TextBinValue *
00086 TextBinValue::clone()
00087 {
00088   return new TextBinValue( *this );
00089 }
00090 
00091     void
00092 TextBinValue::_parse()
00093 {
00094 }
00095 
00096     void
00097 TextBinValue::_assemble()
00098 {
00099   if ( mIsBinary_ ) {
00100     strRep_ = KCodecs::base64Encode( mData_ );
00101   } else
00102     strRep_ = mUrl_.utf8();
00103 }
00104 
KDE Home | KDE Accessibility Home | Description of Access Keys