30#include <VCardAdrParam.h>
31#include <VCardAgentParam.h>
32#include <VCardDateParam.h>
33#include <VCardEmailParam.h>
34#include <VCardImageParam.h>
35#include <VCardSourceParam.h>
36#include <VCardTelParam.h>
37#include <VCardTextBinParam.h>
38#include <VCardTextParam.h>
40#include <VCardAdrValue.h>
41#include <VCardAgentValue.h>
42#include <VCardDateValue.h>
43#include <VCardImageValue.h>
44#include <VCardTextValue.h>
45#include <VCardTextBinValue.h>
46#include <VCardLangValue.h>
47#include <VCardNValue.h>
48#include <VCardURIValue.h>
49#include <VCardSoundValue.h>
50#include <VCardClassValue.h>
51#include <VCardFloatValue.h>
52#include <VCardOrgValue.h>
53#include <VCardTelValue.h>
54#include <VCardTextListValue.h>
55#include <VCardUTCValue.h>
56#include <VCardGeoValue.h>
58#include <VCardRToken.h>
59#include <VCardContentLine.h>
61#include <VCardEntity.h>
63#include <VCardDefines.h>
67ContentLine::ContentLine()
70 paramType_( ParamUnknown ),
71 valueType_( ValueUnknown ),
72 entityType_( EntityUnknown )
76ContentLine::ContentLine(
const ContentLine & x)
80 paramList_(x.paramList_),
81 value_(x.value_->clone()),
82 paramType_( x.paramType_ ),
83 valueType_( x.valueType_ ),
84 entityType_( x.entityType_ )
88ContentLine::ContentLine(
const TQCString & s)
91 paramType_( ParamUnknown ),
92 valueType_( ValueUnknown ),
93 entityType_( EntityUnknown )
98ContentLine::operator = (ContentLine & x)
100 if (*
this == x)
return *
this;
102 paramList_ = x.paramList();
103 value_ = x.value_->clone();
105 Entity::operator = (x);
110ContentLine::operator = (
const TQCString & s)
112 Entity::operator = (s);
119ContentLine::operator == (ContentLine & x)
123 TQPtrListIterator<Param> it(x.paramList());
125 if (!paramList_.find(it.current()))
131ContentLine::~ContentLine()
143 strRep_ = strRep_.replace( TQRegExp(
"\\\\n" ),
"\n" );
145 int split = strRep_.find(
':');
152 TQCString firstPart(strRep_.left(split));
153 TQCString valuePart(strRep_.mid(split + 1));
155 split = firstPart.find(
'.');
158 group_ = firstPart.left(split);
159 firstPart = firstPart.mid(split + 1);
162 vDebug(
"Group == " + group_);
163 vDebug(
"firstPart == " + firstPart);
164 vDebug(
"valuePart == " + valuePart);
170 RTokenise(firstPart,
";", l);
172 if (l.count() == 0) {
173 vDebug(
"No name for this content line !");
183 entityType_ = EntityNameToEntityType(name_);
184 paramType_ = EntityTypeToParamType(entityType_);
190 TQStrListIterator it(l);
192 for (; it.current(); ++it, i++) {
196 split = str.find(
"=");
198 vDebug(
"No '=' in parameter.");
202 TQCString paraName = str.left(split);
203 TQCString paraValue = str.mid(split + 1);
205 TQStrList paraValues;
206 RTokenise(paraValue,
",", paraValues);
208 TQStrListIterator it2( paraValues );
210 for(; it2.current(); ++it2) {
212 Param *p =
new Param;
213 p->setName( paraName );
216 paramList_.append(p);
222 valueType_ = EntityTypeToValueType(entityType_);
226 switch (valueType_) {
228 case ValueSound: value_ =
new SoundValue;
break;
229 case ValueAgent: value_ =
new AgentValue;
break;
230 case ValueAddress: value_ =
new AdrValue;
break;
231 case ValueTel: value_ =
new TelValue;
break;
232 case ValueTextBin: value_ =
new TextBinValue;
break;
233 case ValueOrg: value_ =
new OrgValue;
break;
234 case ValueN: value_ =
new NValue;
break;
235 case ValueUTC: value_ =
new UTCValue;
break;
236 case ValueURI: value_ =
new URIValue;
break;
237 case ValueClass: value_ =
new ClassValue;
break;
238 case ValueFloat: value_ =
new FloatValue;
break;
239 case ValueImage: value_ =
new ImageValue;
break;
240 case ValueDate: value_ =
new DateValue;
break;
241 case ValueTextList: value_ =
new TextListValue;
break;
242 case ValueGeo: value_ =
new GeoValue;
break;
245 default: value_ =
new TextValue;
break;
252ContentLine::_assemble()
254 vDebug(
"Assemble (argl) - my name is \"" + name_ +
"\"");
259 if (!group_.isEmpty())
260 line += group_ +
'.';
264 vDebug(
"Adding parameters");
265 ParamListIterator it(paramList_);
267 for (; it.current(); ++it)
268 line +=
";" + it.current()->asString();
270 vDebug(
"Adding value");
272 line +=
":" + value_->asString();
278 line = line.replace( TQRegExp(
"\n" ),
"\\n" );
281 const int maxLen = 72;
283 while( line.length() > ( cursor + 1 ) * maxLen ) {
284 strRep_ += line.mid( cursor * maxLen, maxLen );
288 strRep_ += line.mid( cursor * maxLen );
299 paramType_ = ParamUnknown;
300 valueType_ = ValueUnknown;
301 entityType_ = EntityUnknown;