SourceParam.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <VCardSourceParam.h>
00025
00026 #include <VCardParam.h>
00027
00028 using namespace VCARD;
00029
00030 SourceParam::SourceParam()
00031 : Param(),
00032 type_(SourceParam::TypeUnknown)
00033 {
00034 }
00035
00036 SourceParam::SourceParam(const SourceParam & x)
00037 : Param(x),
00038 type_ (x.type_),
00039 par_ (x.par_),
00040 val_ (x.val_)
00041 {
00042 }
00043
00044 SourceParam::SourceParam(const QCString & s)
00045 : Param(s),
00046 type_(SourceParam::TypeUnknown)
00047 {
00048 }
00049
00050 SourceParam &
00051 SourceParam::operator = (SourceParam & x)
00052 {
00053 if (*this == x) return *this;
00054 type_ = x.type();
00055 par_ = x.par();
00056 val_ = x.val();
00057
00058 Param::operator = (x);
00059 return *this;
00060 }
00061
00062 SourceParam &
00063 SourceParam::operator = (const QCString & s)
00064 {
00065 Param::operator = (s);
00066 return *this;
00067 }
00068
00069 bool
00070 SourceParam::operator == (SourceParam & x)
00071 {
00072 x.parse();
00073 return false;
00074 }
00075
00076 SourceParam::~SourceParam()
00077 {
00078 }
00079
00080 void
00081 SourceParam::_parse()
00082 {
00083 int i = strRep_.find('=');
00084 if (i == -1)
00085 return;
00086
00087 par_ = strRep_.left(i);
00088 val_ = strRep_.right(strRep_.length() - i - 1);
00089
00090 if (qstricmp(par_, "VALUE") == 0 && qstricmp(val_, "uri") == 0)
00091 type_ = TypeValue;
00092 else if (qstricmp(par_, "CONTEXT") == 0 && qstricmp(val_, "word") == 0)
00093 type_ = TypeContext;
00094 else if (qstrnicmp(par_, "X-", 2) == 0) {
00095 type_ = TypeX;
00096 }
00097 else type_ = TypeUnknown;
00098
00099 }
00100
00101 void
00102 SourceParam::_assemble()
00103 {
00104 if (type_ == TypeValue)
00105 strRep_ = "VALUE=uri";
00106 else if (type_ == TypeContext)
00107 strRep_ = "CONTEXT=word";
00108 else if (type_ == TypeX)
00109 strRep_ = par_ + "=" + val_;
00110 else strRep_ = "";
00111 }
00112
This file is part of the documentation for kdelibs Version 3.1.5.