VCardEntity.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 <qregexp.h>
00025
00026 #include <VCardDefines.h>
00027 #include <VCardVCardEntity.h>
00028
00029 using namespace VCARD;
00030
00031 VCardEntity::VCardEntity()
00032 : Entity()
00033 {
00034 }
00035
00036 VCardEntity::VCardEntity(const VCardEntity & x)
00037 : Entity(x)
00038 {
00039 }
00040
00041 VCardEntity::VCardEntity(const QCString & s)
00042 : Entity(s)
00043 {
00044 }
00045
00046 VCardEntity &
00047 VCardEntity::operator = (VCardEntity & x)
00048 {
00049 if (*this == x) return *this;
00050
00051 Entity::operator = (x);
00052 return *this;
00053 }
00054
00055 VCardEntity &
00056 VCardEntity::operator = (const QCString & s)
00057 {
00058 Entity::operator = (s);
00059 return *this;
00060 }
00061
00062 bool
00063 VCardEntity::operator == (VCardEntity & x)
00064 {
00065 x.parse();
00066 return false;
00067 }
00068
00069 VCardEntity::~VCardEntity()
00070 {
00071 }
00072
00073 void
00074 VCardEntity::_parse()
00075 {
00076 vDebug("parse");
00077 QCString s(strRep_);
00078
00079 int i = s.find(QRegExp("BEGIN:VCARD", false));
00080
00081 while (i != -1) {
00082
00083 i = s.find(QRegExp("BEGIN:VCARD", false), 11);
00084
00085 QCString cardStr(s.left(i));
00086
00087 VCard * v = new VCard(cardStr);
00088
00089 cardList_.append(v);
00090
00091 v->parse();
00092
00093 s.remove(0, i);
00094 }
00095 }
00096
00097 void
00098 VCardEntity::_assemble()
00099 {
00100 VCardListIterator it(cardList_);
00101
00102 for (; it.current(); ++it)
00103 strRep_ += it.current()->asString() + "\r\n";
00104 }
00105
00106 VCardList &
00107 VCardEntity::cardList()
00108 {
00109 parse();
00110 return cardList_;
00111 }
00112
00113 void
00114 VCardEntity::setCardList(const VCardList & l)
00115 {
00116 parse();
00117 cardList_ = l;
00118 }
00119
This file is part of the documentation for kdelibs Version 3.1.0.