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 <qstrlist.h>
00025
00026
#include <VCardRToken.h>
00027
#include <VCardNValue.h>
00028
#include <VCardValue.h>
00029
#include <VCardDefines.h>
00030
00031
using namespace VCARD;
00032
00033 NValue::NValue()
00034 : Value()
00035 {
00036 vDebug(
"ctor");
00037 }
00038
00039 NValue::NValue(
const NValue & x)
00040 : Value(x),
00041 family_ (x.family_),
00042 given_ (x.given_),
00043 middle_ (x.middle_),
00044 prefix_ (x.prefix_),
00045 suffix_ (x.suffix_)
00046 {
00047 }
00048
00049 NValue::NValue(
const QCString & s)
00050 : Value(s)
00051 {
00052 vDebug(
"ctor");
00053 }
00054
00055 NValue &
00056 NValue::operator = (NValue & x)
00057 {
00058
if (*
this == x)
return *
this;
00059
00060 family_ = x.family_;
00061 given_ = x.given_;
00062 middle_ = x.middle_;
00063 prefix_ = x.prefix_;
00064 suffix_ = x.suffix_;
00065
00066 Value::operator = (x);
00067
return *
this;
00068 }
00069
00070 NValue &
00071 NValue::operator = (
const QCString & s)
00072 {
00073 Value::operator = (s);
00074
return *
this;
00075 }
00076
00077
bool
00078 NValue::operator == (NValue & x)
00079 {
00080 x.parse();
00081
00082
return (
00083 family_ == x.family_ &&
00084 given_ == x.given_ &&
00085 middle_ == x.middle_ &&
00086 prefix_ == x.prefix_ &&
00087 suffix_ == x.suffix_);
00088 }
00089
00090 NValue::~NValue()
00091 {
00092 }
00093
00094 NValue *
00095 NValue::clone()
00096 {
00097
return new NValue( *
this );
00098 }
00099
00100
void
00101 NValue::_parse()
00102 {
00103
QStrList l;
00104 RTokenise(strRep_,
";", l);
00105
00106
for (
unsigned int i = 0; i < l.count(); i++) {
00107
00108
switch (i) {
00109
case 0: family_ = l.at(0);
break;
00110
case 1: given_ = l.at(1);
break;
00111
case 2: middle_ = l.at(2);
break;
00112
case 3: prefix_ = l.at(3);
break;
00113
case 4: suffix_ = l.at(4);
break;
00114
default:
break;
00115 }
00116 }
00117 }
00118
00119
void
00120 NValue::_assemble()
00121 {
00122 strRep_ = family_;
00123 strRep_ +=
";" + given_;
00124 strRep_ +=
";" + middle_;
00125 strRep_ +=
";" + prefix_;
00126 strRep_ +=
";" + suffix_;
00127 }
00128