From b9aad1f15dc600e4dbe4c62d3fcced6363188ba3 Mon Sep 17 00:00:00 2001 From: zautrix Date: Sat, 26 Jun 2004 19:01:18 +0000 Subject: Initial revision --- (limited to 'kabc/vcard') diff --git a/kabc/vcard/AdrParam.cpp b/kabc/vcard/AdrParam.cpp new file mode 100644 index 0000000..fa46499 --- a/dev/null +++ b/kabc/vcard/AdrParam.cpp @@ -0,0 +1,126 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include +#include +#include + +using namespace VCARD; + +AdrParam::AdrParam() + : Param() +{ +} + +AdrParam::AdrParam(const AdrParam & x) + : Param(x), + adrTypeList_ (x.adrTypeList_) +{ +} + +AdrParam::AdrParam(const QCString & s) + : Param(s) +{ +} + + AdrParam & +AdrParam::operator = (AdrParam & x) +{ + if (*this == x) return *this; + + adrTypeList_ = x.adrTypeList(); + textParam_ = x.textParam(); + + Param::operator = (x); + return *this; +} + + AdrParam & +AdrParam::operator = (const QCString & s) +{ + Param::operator = (s); + + adrTypeList_.clear(); + textParam_.truncate(0); + + return *this; +} + + bool +AdrParam::operator == (AdrParam & x) +{ + parse(); + + if (!x.textParam().isEmpty()) + return (x.textParam_ == textParam_); + + if (x.adrTypeList().count() != adrTypeList_.count()) + return false; + + QStrListIterator it(x.adrTypeList_); + + for (; it.current(); ++it) + if (!adrTypeList_.find(it.current())) + return false; + + return true; +} + +AdrParam::~AdrParam() +{ +} + + void +AdrParam::_parse() +{ + adrTypeList_.clear(); + + if (strRep_.left(4) != "TYPE") { + textParam_ = strRep_; + return; + } + + if (!strRep_.contains('=')) + return; + + RTokenise(strRep_, ",", adrTypeList_); +} + + void +AdrParam::_assemble() +{ + if (!textParam_.isEmpty()) { + strRep_ = textParam_; + return; + } + + QStrListIterator it(adrTypeList_); + + for (; it.current(); ++it) { + + strRep_ += it.current(); + + if (it.current() != adrTypeList_.last()) + strRep_ += ','; + } +} diff --git a/kabc/vcard/AdrValue.cpp b/kabc/vcard/AdrValue.cpp new file mode 100644 index 0000000..7ecef33 --- a/dev/null +++ b/kabc/vcard/AdrValue.cpp @@ -0,0 +1,140 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include +#include +#include +#include + +using namespace VCARD; + +AdrValue::AdrValue() + : Value() +{ +} + +AdrValue::AdrValue(const AdrValue & x) + : Value(x), + poBox_ (x.poBox_), + extAddress_ (x.extAddress_), + street_ (x.street_), + locality_ (x.locality_), + region_ (x.region_), + postCode_ (x.postCode_), + countryName_ (x.countryName_) +{ +} + +AdrValue::AdrValue(const QCString & s) + : Value(s) +{ +} + + AdrValue & +AdrValue::operator = (AdrValue & x) +{ + if (*this == x) return *this; + + poBox_ = x.poBox_; + extAddress_ = x.extAddress_; + street_ = x.street_; + locality_ = x.locality_; + region_ = x.region_; + postCode_ = x.postCode_; + countryName_ = x.countryName_; + + Value::operator = (x); + return *this; +} + + AdrValue & +AdrValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +AdrValue::operator == (AdrValue & x) +{ + parse(); + x.parse(); + + return ( + poBox_ == x.poBox_ && + extAddress_ == x.extAddress_ && + street_ == x.street_ && + locality_ == x.locality_ && + region_ == x.region_ && + postCode_ == x.postCode_ && + countryName_ == x.countryName_); +} + +AdrValue::~AdrValue() +{ +} + + AdrValue * +AdrValue::clone() +{ + return new AdrValue( *this ); +} + + void +AdrValue::_parse() +{ + vDebug("AdrValue::_parse()"); + + QStrList l; + RTokenise(strRep_, ";", l); + + for (unsigned int i = 0; i < l.count(); i++) { + + switch (i) { + + case 0: poBox_ = l.at(0); break; + case 1: extAddress_ = l.at(1); break; + case 2: street_ = l.at(2); break; + case 3: locality_ = l.at(3); break; + case 4: region_ = l.at(4); break; + case 5: postCode_ = l.at(5); break; + case 6: countryName_ = l.at(6); break; + default: break; + } + } +} + + void +AdrValue::_assemble() +{ + vDebug("AdrValue::_assemble"); + + strRep_ = poBox_; + strRep_ += ";" + extAddress_; + strRep_ += ";" + street_; + strRep_ += ";" + locality_; + strRep_ += ";" + region_; + strRep_ += ";" + postCode_; + strRep_ += ";" + countryName_; +} + diff --git a/kabc/vcard/AgentParam.cpp b/kabc/vcard/AgentParam.cpp new file mode 100644 index 0000000..5625e00 --- a/dev/null +++ b/kabc/vcard/AgentParam.cpp @@ -0,0 +1,103 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +using namespace VCARD; + +AgentParam::AgentParam() + : Param() +{ +} + +AgentParam::AgentParam(const AgentParam & x) + : Param(x), + refer_ (x.refer_), + uri_ (x.uri_) +{ +} + +AgentParam::AgentParam(const QCString & s) + : Param(s) +{ +} + + AgentParam & +AgentParam::operator = (AgentParam & x) +{ + if (*this == x) return *this; + + refer_ = x.refer_; + uri_ = x.uri_; + + Param::operator = (x); + return *this; +} + + AgentParam & +AgentParam::operator = (const QCString & s) +{ + Param::operator = (s); + return *this; +} + + bool +AgentParam::operator == (AgentParam & x) +{ + parse(); + + if (refer_) + return (x.refer() && uri_ == x.uri_); + + return !x.refer(); +} + +AgentParam::~AgentParam() +{ +} + + void +AgentParam::_parse() +{ + if (strRep_.isEmpty()) { + refer_ = false; + return; + } + + refer_ = true; + uri_ = strRep_; +} + + void +AgentParam::_assemble() +{ + if (!refer_) { + strRep_.truncate(0); + return; + } + + strRep_ = uri_.asString(); + return; +} diff --git a/kabc/vcard/AgentValue.cpp b/kabc/vcard/AgentValue.cpp new file mode 100644 index 0000000..bccde80 --- a/dev/null +++ b/kabc/vcard/AgentValue.cpp @@ -0,0 +1,81 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +using namespace VCARD; + +AgentValue::AgentValue() + : Value() +{ +} + +AgentValue::AgentValue(const AgentValue & x) + : Value(x) +{ +} + +AgentValue::AgentValue(const QCString & s) + : Value(s) +{ +} + + AgentValue & +AgentValue::operator = (AgentValue & x) +{ + if (*this == x) return *this; + + Value::operator = (x); + return *this; +} + + AgentValue & +AgentValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +AgentValue::operator == (AgentValue & x) +{ + x.parse(); + return false; +} + +AgentValue::~AgentValue() +{ +} + + void +AgentValue::_parse() +{ +} + + void +AgentValue::_assemble() +{ +} + diff --git a/kabc/vcard/ClassValue.cpp b/kabc/vcard/ClassValue.cpp new file mode 100644 index 0000000..f01e5a6 --- a/dev/null +++ b/kabc/vcard/ClassValue.cpp @@ -0,0 +1,120 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +#include + +using namespace VCARD; + +ClassValue::ClassValue() + : Value() +{ +} + +ClassValue::ClassValue(const ClassValue & x) + : Value(x), + classType_(x.classType_) +{ +} + +ClassValue::ClassValue(const QCString & s) + : Value(s) +{ +} + + ClassValue & +ClassValue::operator = (ClassValue & x) +{ + if (*this == x) return *this; + x.parse(); + + classType_ = x.classType_; + + Value::operator = (x); + return *this; +} + + ClassValue & +ClassValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +ClassValue::operator == (ClassValue & x) +{ + x.parse(); + return ( classType_ == x.classType_ ); +} + +ClassValue::~ClassValue() +{ +} + + ClassValue * +ClassValue::clone() +{ + return new ClassValue( *this ); +} + + void +ClassValue::_parse() +{ + if (qstricmp(strRep_, "PUBLIC") == 0) + classType_ = Public; + + else if (qstricmp(strRep_, "PRIVATE") == 0) + classType_ = Private; + + else if (qstricmp(strRep_, "CONFIDENTIAL") == 0) + classType_ = Confidential; + + else classType_ = Other; +} + + void +ClassValue::_assemble() +{ + switch (classType_) { + + case Public: + strRep_ = "PUBLIC"; + break; + + case Private: + strRep_ = "PRIVATE"; + break; + + case Confidential: + strRep_ = "CONFIDENTIAL"; + break; + + default: + break; + } +} + diff --git a/kabc/vcard/ContentLine.cpp b/kabc/vcard/ContentLine.cpp new file mode 100644 index 0000000..6fa1a8f --- a/dev/null +++ b/kabc/vcard/ContentLine.cpp @@ -0,0 +1,289 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +using namespace VCARD; + +ContentLine::ContentLine() + : Entity(), + value_(0) +{ +} + +ContentLine::ContentLine(const ContentLine & x) + : Entity(x), + group_ (x.group_), + name_ (x.name_), + paramList_(x.paramList_), + value_(x.value_->clone()) +{ +} + +ContentLine::ContentLine(const QCString & s) + : Entity(s), + value_(0) +{ +} + + ContentLine & +ContentLine::operator = (ContentLine & x) +{ + if (*this == x) return *this; + + paramList_ = x.paramList(); + value_ = x.value_->clone(); + + Entity::operator = (x); + return *this; +} + + ContentLine & +ContentLine::operator = (const QCString & s) +{ + Entity::operator = (s); + delete value_; + value_ = 0; + return *this; +} + + bool +ContentLine::operator == (ContentLine & x) +{ + x.parse(); + + QPtrListIterator it(x.paramList()); + + if (!paramList_.find(it.current())) + return false; + + return true; +} + +ContentLine::~ContentLine() +{ + delete value_; + value_ = 0; +} + + void +ContentLine::_parse() +{ + vDebug("parse"); + + // Unqote newlines + strRep_ = strRep_.replace( QRegExp( "\\\\n" ), "\n" ); + + int split = strRep_.find(':'); + + if (split == -1) { // invalid content line + vDebug("No ':'"); + return; + } + + QCString firstPart(strRep_.left(split)); + QCString valuePart(strRep_.mid(split + 1)); + + split = firstPart.find('.'); + + if (split != -1) { + group_ = firstPart.left(split); + firstPart = firstPart.mid(split + 1); + } + + vDebug("Group == " + group_); + vDebug("firstPart == " + firstPart); + vDebug("valuePart == " + valuePart); + + // Now we have the group, the name and param list together and the value. + + QStrList l; + + RTokenise(firstPart, ";", l); + + if (l.count() == 0) {// invalid - no name ! + vDebug("No name for this content line !"); + return; + } + + name_ = l.at(0); + + // Now we have the name, so the rest of 'l' is the params. + // Remove the name part. + l.remove(0u); + + entityType_ = EntityNameToEntityType(name_); + paramType_ = EntityTypeToParamType(entityType_); + + unsigned int i = 0; + + // For each parameter, create a new parameter of the correct type. + + QStrListIterator it(l); + + for (; it.current(); ++it, i++) { + + QCString str = *it; + + split = str.find("="); + if (split < 0 ) { + vDebug("No '=' in paramter."); + continue; + } + + QCString paraName = str.left(split); + QCString paraValue = str.mid(split + 1); + + QStrList paraValues; + RTokenise(paraValue, ",", paraValues); + + QStrListIterator it2( paraValues ); + + for(; it2.current(); ++it2) { + + Param *p = new Param; + p->setName( paraName ); + p->setValue( *it2 ); + + paramList_.append(p); + } + } + + // Create a new value of the correct type. + + valueType_ = EntityTypeToValueType(entityType_); + +// kdDebug(5710) << "valueType: " << valueType_ << endl; + + switch (valueType_) { + + case ValueSound: value_ = new SoundValue; break; + case ValueAgent: value_ = new AgentValue; break; + case ValueAddress: value_ = new AdrValue; break; + case ValueTel: value_ = new TelValue; break; + case ValueTextBin: value_ = new TextBinValue; break; + case ValueOrg: value_ = new OrgValue; break; + case ValueN: value_ = new NValue; break; + case ValueUTC: value_ = new UTCValue; break; + case ValueURI: value_ = new URIValue; break; + case ValueClass: value_ = new ClassValue; break; + case ValueFloat: value_ = new FloatValue; break; + case ValueImage: value_ = new ImageValue; break; + case ValueDate: value_ = new DateValue; break; + case ValueTextList: value_ = new TextListValue; break; + case ValueGeo: value_ = new GeoValue; break; + case ValueText: + case ValueUnknown: + default: value_ = new TextValue; break; + } + + *value_ = valuePart; +} + + void +ContentLine::_assemble() +{ + vDebug("Assemble (argl) - my name is \"" + name_ + "\""); + strRep_.truncate(0); + + QCString line; + + if (!group_.isEmpty()) + line += group_ + '.'; + + line += name_; + + vDebug("Adding parameters"); + ParamListIterator it(paramList_); + + for (; it.current(); ++it) + line += ";" + it.current()->asString(); + + vDebug("Adding value"); + if (value_ != 0) + line += ":" + value_->asString(); + else + vDebug("No value"); + + // Quote newlines + line = line.replace( QRegExp( "\n" ), "\\n" ); + + // Fold lines longer than 72 chars + const int maxLen = 72; + uint cursor = 0; + while( line.length() > ( cursor + 1 ) * maxLen ) { + strRep_ += line.mid( cursor * maxLen, maxLen ); + strRep_ += "\r\n "; + ++cursor; + } + strRep_ += line.mid( cursor * maxLen ); +} + + void +ContentLine::clear() +{ + group_.truncate(0); + name_.truncate(0); + paramList_.clear(); + delete value_; + value_ = 0; +} diff --git a/kabc/vcard/DateParam.cpp b/kabc/vcard/DateParam.cpp new file mode 100644 index 0000000..52af089 --- a/dev/null +++ b/kabc/vcard/DateParam.cpp @@ -0,0 +1,82 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +using namespace VCARD; + +DateParam::DateParam() + : Param() +{ +} + +DateParam::DateParam(const DateParam & x) + : Param(x) +{ +} + +DateParam::DateParam(const QCString & s) + : Param(s) +{ +} + + DateParam & +DateParam::operator = (DateParam & x) +{ + if (*this == x) return *this; + + Param::operator = (x); + return *this; +} + + DateParam & +DateParam::operator = (const QCString & s) +{ + Param::operator = (s); + return *this; +} + + bool +DateParam::operator == (DateParam & x) +{ + x.parse(); + + return false; +} + +DateParam::~DateParam() +{ +} + + void +DateParam::_parse() +{ +} + + void +DateParam::_assemble() +{ +} + diff --git a/kabc/vcard/DateValue.cpp b/kabc/vcard/DateValue.cpp new file mode 100644 index 0000000..c5c5c85 --- a/dev/null +++ b/kabc/vcard/DateValue.cpp @@ -0,0 +1,434 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +#include +#include +#include + +using namespace VCARD; + +DateValue::DateValue() + : Value() +{ + vDebug("DateValue::DateValue()"); +} + +DateValue::DateValue( + unsigned int year, + unsigned int month, + unsigned int day, + unsigned int hour, + unsigned int minute, + unsigned int second, + double secFrac, + bool zonePositive, + unsigned int zoneHour, + unsigned int zoneMinute) + : Value (), + year_ (year), + month_ (month), + day_ (day), + hour_ (hour), + minute_ (minute), + second_ (second), + zoneHour_ (zoneHour), + zoneMinute_ (zoneMinute), + secFrac_ (secFrac), + zonePositive_ (zonePositive), + hasTime_(true) +{ + parsed_ = true; + assembled_ = false; +} + +DateValue::DateValue(const QDate & d) + : Value (), + year_ (d.year()), + month_ (d.month()), + day_ (d.day()), + hasTime_(false) +{ + parsed_ = true; + assembled_ = false; +} + +DateValue::DateValue(const QDateTime & d) + : Value (), + year_ (d.date().year()), + month_ (d.date().month()), + day_ (d.date().day()), + hour_ (d.time().hour()), + minute_ (d.time().minute()), + second_ (d.time().second()), + hasTime_(true) +{ + parsed_ = true; + assembled_ = false; +} + +DateValue::DateValue(const DateValue & x) + : Value(x) +{ + year_ = x.year_; + month_ = x.month_; + day_ = x.day_; + hour_ = x.hour_; + minute_ = x.minute_; + second_ = x.second_; + zoneHour_ = x.zoneHour_; + zoneMinute_ = x.zoneMinute_; + secFrac_ = x.secFrac_; + hasTime_ = x.hasTime_; +} + +DateValue::DateValue(const QCString & s) + : Value(s) +{ +} + + DateValue & +DateValue::operator = (DateValue & x) +{ + if (*this == x) return *this; + + Value::operator = (x); + return *this; +} + + DateValue & +DateValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +DateValue::operator == (DateValue & x) +{ + x.parse(); + return false; +} + +DateValue::~DateValue() +{ +} + + DateValue * +DateValue::clone() +{ + return new DateValue( *this ); +} + + void +DateValue::_parse() +{ + vDebug("DateValue::_parse()"); + + // date = date-full-year ["-"] date-month ["-"] date-mday + // time = time-hour [":"] time-minute [":"] time-second [":"] + // [time-secfrac] [time-zone] + + int timeSep = strRep_.find('T'); + + QCString dateStr; + QCString timeStr; + + if (timeSep == -1) { + + dateStr = strRep_; + vDebug("Has date string \"" + dateStr + "\""); + + } else { + + dateStr = strRep_.left(timeSep); + vDebug("Has date string \"" + dateStr + "\""); + + timeStr = strRep_.mid(timeSep + 1); + vDebug("Has time string \"" + timeStr + "\""); + } + + /////////////////////////////////////////////////////////////// DATE + + dateStr.replace(QRegExp("-"), ""); + + kdDebug(5710) << "dateStr: " << dateStr << endl; + + year_ = dateStr.left(4).toInt(); + month_ = dateStr.mid(4, 2).toInt(); + day_ = dateStr.right(2).toInt(); + + if (timeSep == -1) { + hasTime_ = false; + return; // No time, done. + } + else + hasTime_ = true; + + /////////////////////////////////////////////////////////////// TIME + + /////////////////////////////////////////////////////////////// ZONE + + int zoneSep = timeStr.find('Z'); + + if (zoneSep != -1 && timeStr.length() - zoneSep > 3) { + + QCString zoneStr(timeStr.mid(zoneSep + 1)); + vDebug("zoneStr == " + zoneStr); + + zonePositive_ = (zoneStr[0] == '+'); + zoneHour_ = zoneStr.mid(1, 2).toInt(); + zoneMinute_ = zoneStr.right(2).toInt(); + + timeStr.remove(zoneSep, timeStr.length() - zoneSep); + } + + //////////////////////////////////////////////////// SECOND FRACTION + + int secFracSep = timeStr.findRev(','); + + if (secFracSep != -1 && zoneSep != -1) { // zoneSep checked to avoid errors. + QCString quirkafleeg = "0." + timeStr.mid(secFracSep + 1, zoneSep); + secFrac_ = quirkafleeg.toDouble(); + } + + /////////////////////////////////////////////////////////////// HMS + + timeStr.replace(QRegExp(":"), ""); + + hour_ = timeStr.left(2).toInt(); + minute_ = timeStr.mid(2, 2).toInt(); + second_ = timeStr.mid(4, 2).toInt(); +} + + void +DateValue::_assemble() +{ + vDebug("DateValue::_assemble"); + + QCString year; + QCString month; + QCString day; + + year.setNum( year_ ); + month.setNum( month_ ); + day.setNum( day_ ); + + if ( month.length() < 2 ) month.prepend( "0" ); + if ( day.length() < 2 ) day.prepend( "0" ); + + strRep_ = year + '-' + month + '-' + day; + + if ( hasTime_ ) { + QCString hour; + QCString minute; + QCString second; + + hour.setNum( hour_ ); + minute.setNum( minute_ ); + second.setNum( second_ ); + + if ( hour.length() < 2 ) hour.prepend( "0" ); + if ( minute.length() < 2 ) minute.prepend( "0" ); + if ( second.length() < 2 ) second.prepend( "0" ); + + strRep_ += 'T' + hour + ':' + minute + ':' + second + 'Z'; + } +} + + unsigned int +DateValue::year() +{ + parse(); + return year_; +} + + unsigned int +DateValue::month() +{ + parse(); + return month_; +} + + unsigned int +DateValue::day() +{ + parse(); + return day_; +} + unsigned int +DateValue::hour() +{ + parse(); + return hour_; +} + + unsigned int +DateValue::minute() +{ + parse(); + return minute_; +} + + unsigned int +DateValue::second() +{ + parse(); + return second_; +} + + double +DateValue::secondFraction() +{ + parse(); + return secFrac_; +} + + bool +DateValue::zonePositive() +{ + parse(); + return zonePositive_; +} + + unsigned int +DateValue::zoneHour() +{ + parse(); + return zoneHour_; +} + + unsigned int +DateValue::zoneMinute() +{ + parse(); + return zoneMinute_; +} + + void +DateValue::setYear(unsigned int i) +{ + year_ = i; + assembled_ = false; +} + + void +DateValue::setMonth(unsigned int i) +{ + month_ = i; + assembled_ = false; +} + + void +DateValue::setDay(unsigned int i) +{ + day_ = i; + assembled_ = false; +} + + void +DateValue::setHour(unsigned int i) +{ + hour_ = i; + assembled_ = false; +} + + void +DateValue::setMinute(unsigned int i) +{ + minute_ = i; + assembled_ = false; +} + + void +DateValue::setSecond(unsigned int i) +{ + second_ = i; + assembled_ = false; +} + + void +DateValue::setSecondFraction(double d) +{ + secFrac_ = d; + assembled_ = false; +} + + void +DateValue::setZonePositive(bool b) +{ + zonePositive_ = b; + assembled_ = false; +} + + void +DateValue::setZoneHour(unsigned int i) +{ + zoneHour_ = i; + assembled_ = false; +} + + void +DateValue::setZoneMinute(unsigned int i) +{ + zoneMinute_ = i; + assembled_ = false; +} + + QDate +DateValue::qdate() +{ + parse(); + QDate d(year_, month_, day_); + return d; +} + + QTime +DateValue::qtime() +{ + parse(); + QTime t(hour_, minute_, second_); +// t.setMs(1 / secFrac_); + return t; +} + + QDateTime +DateValue::qdt() +{ + parse(); + QDateTime dt; + dt.setDate(qdate()); + dt.setTime(qtime()); + return dt; +} + + bool +DateValue::hasTime() +{ + parse(); + return hasTime_; +} + diff --git a/kabc/vcard/EmailParam.cpp b/kabc/vcard/EmailParam.cpp new file mode 100644 index 0000000..8c87477 --- a/dev/null +++ b/kabc/vcard/EmailParam.cpp @@ -0,0 +1,116 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include +#include +#include + +using namespace VCARD; + +EmailParam::EmailParam() + : Param() +{ + vDebug("ctor"); +} + +EmailParam::EmailParam(const EmailParam & x) + : Param(x), + emailType_ (x.emailType_), + pref_ (x.pref_) +{ +} + +EmailParam::EmailParam(const QCString & s) + : Param(s) +{ +} + + EmailParam & +EmailParam::operator = (EmailParam & x) +{ + if (*this == x) return *this; + + emailType_ = x.emailType(); + pref_ = x.pref_; + + Param::operator = (x); + return *this; +} + + EmailParam & +EmailParam::operator = (const QCString & s) +{ + Param::operator = (s); + return *this; +} + + bool +EmailParam::operator == (EmailParam & x) +{ + parse(); + + if (pref_) + return (x.pref_ && x.emailType() == emailType_); + + return !x.pref(); +} + +EmailParam::~EmailParam() +{ +} + + void +EmailParam::_parse() +{ +#if 0 + Param::parseToList(); + + SubParamListIterator it(subParamList_); + + pref_ = true; + emailType_ = ""; + + for (; it.current(); ++it) { + + if (qstricmp(it.current()->name(), "TYPE") == 0) { + emailType_ = it.current()->value(); + continue; + } + + if (qstricmp(it.current()->name(), "PREF") == 0) { + pref_ = true; + } + } +#endif +} + + void +EmailParam::_assemble() +{ + strRep_ = "TYPE="; + strRep_ += emailType_; + + if (pref_) + strRep_ += ",PREF"; +} + diff --git a/kabc/vcard/Entity.cpp b/kabc/vcard/Entity.cpp new file mode 100644 index 0000000..b7d09e0 --- a/dev/null +++ b/kabc/vcard/Entity.cpp @@ -0,0 +1,134 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +using namespace VCARD; + +Entity::Entity() + : parsed_ (false), + assembled_ (true) +{ + // empty +} + +Entity::Entity(const Entity & e) + : strRep_ (e.strRep_), + parsed_ (e.parsed_), + assembled_ (e.assembled_) +{ + // empty +} + +Entity::Entity(const QCString & s) + : strRep_ (s), + parsed_ (false), + assembled_ (true) +{ + // empty +} + + Entity & +Entity::operator = (const Entity & e) +{ + if (this == &e) return *this; + + strRep_ = e.strRep_; + parsed_ = e.parsed_; + assembled_ = e.assembled_; + + return *this; +} + + Entity & +Entity::operator = (const QCString & s) +{ + strRep_ = s; + parsed_ = false; + assembled_ = true; + + return *this; +} + + bool +Entity::operator == (Entity & e) +{ + return asString() == e.asString(); +} + + bool +Entity::operator != (Entity & e) +{ + return !(*this == e); +} + + bool +Entity::operator == (const QCString & s) +{ + return asString() == s; +} + + bool +Entity::operator != (const QCString & s) +{ + return !(*this == s); +} + +Entity::~Entity() +{ + // empty +} + + QCString +Entity::asString() +{ +// vDebug("Entity::asString()"); + assemble(); + + return strRep_; +} + + void +Entity::parse() +{ +// vDebug( "Entity::parse()" ); + + if (!parsed_) _parse(); + + parsed_ = true; + assembled_ = false; +} + + void +Entity::assemble() +{ +// vDebug( "Entity::assemble()" ); + + if (assembled_) return; + + parse(); + _assemble(); + + assembled_ = true; +} + diff --git a/kabc/vcard/Enum.cpp b/kabc/vcard/Enum.cpp new file mode 100644 index 0000000..cc48b5a --- a/dev/null +++ b/kabc/vcard/Enum.cpp @@ -0,0 +1,482 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include +#include + +#include + +using namespace VCARD; + +// There are 31 possible types, not including extensions. + const QCString +VCARD::paramNames [] = +{ + "NAME", + "PROFILE", + "SOURCE", + "FN", + "N", + "NICKNAME", + "PHOTO", + "BDAY", + "ADR", + "LABEL", + "TEL", + "EMAIL", + "MAILER", + "TZ", + "GEO", + "TITLE", + "ROLE", + "LOGO", + "AGENT", + "ORG", + "CATEGORIES", + "NOTE", + "PRODID", + "REV", + "SORT-STRING", + "SOUND", + "UID", + "URL", + "VERSION", + "CLASS", + "KEY" +}; + + const ParamType +VCARD::paramTypesTable[] = { + ParamNone, // NAME + ParamNone, // PROFILE + ParamSource, // SOURCE + ParamText, // FN + ParamText, // N + ParamText, // NICKNAME + ParamImage, // PHOTO (inline/refer) + ParamDate, // BDAY ("VALUE = "date-time/date) + ParamAddrText, // ADR (adr-param/text-param) + ParamAddrText, // LABEL (adr-param/text-param) + ParamTel, // TEL + ParamEmail, // EMAIL + ParamText, // MAILER + ParamNone, // TZ + ParamNone, // GEO + ParamText, // TITLE + ParamText, // ROLE + ParamImage, // LOGO + ParamAgent, // AGENT + ParamText, // ORG + ParamText, // CATEGORIES + ParamText, // NOTE + ParamNone, // PRODID + ParamDate, // REV + ParamText, // SORT-STRING + ParamSound, // SOUND + ParamNone, // UID + ParamNone, // URL + ParamNone, // VERSION + ParamNone, // CLASS + ParamTextBin, // KEY + ParamTextNS // X +}; + + ParamType +VCARD::EntityTypeToParamType(EntityType e) +{ + ParamType t(ParamUnknown); + + switch (e) { + + //---------------------------------------------------------------// + case EntityAgent: t = ParamAgent; break; + //---------------------------------------------------------------// + case EntitySound: t = ParamSound; break; + //---------------------------------------------------------------// + case EntitySource: t = ParamSource; break; + //---------------------------------------------------------------// + case EntityTelephone: t = ParamTel; break; + //---------------------------------------------------------------// + case EntityEmail: t = ParamEmail; break; + //---------------------------------------------------------------// + case EntityKey: t = ParamTextBin; break; + //---------------------------------------------------------------// + case EntityExtension: t = ParamTextNS; break; + //---------------------------------------------------------------// + case EntityAddress: + case EntityLabel: t = ParamAddrText; break; + //---------------------------------------------------------------// + case EntityBirthday: + case EntityRevision: t = ParamDate; break; + //---------------------------------------------------------------// + case EntityPhoto: + case EntityLogo: t = ParamImage; break; + //---------------------------------------------------------------// + case EntityOrganisation: + case EntityTitle: + case EntityRole: + case EntityFullName: + case EntityMailer: + case EntityN: + case EntitySortString: + case EntityNickname: + case EntityCategories: + case EntityNote: t = ParamText; break; + //---------------------------------------------------------------// + case EntityProductID: + case EntityTimeZone: + case EntityUID: + case EntityURL: + case EntityClass: + case EntityGeo: + case EntityName: + case EntityVersion: + case EntityProfile: + default: t = ParamNone; break; + //---------------------------------------------------------------// + + } + + return t; +} + + ValueType +VCARD::EntityTypeToValueType(EntityType e) +{ + ValueType t(ValueUnknown); + + switch (e) { + + //---------------------------------------------------------------// + case EntitySound: t = ValueSound; break; + //---------------------------------------------------------------// + case EntityAgent: t = ValueAgent; break; + //---------------------------------------------------------------// + case EntityAddress: t = ValueAddress; break; + //---------------------------------------------------------------// + case EntityTelephone: t = ValueTel; break; + //---------------------------------------------------------------// + case EntityKey: t = ValueTextBin; break; + //---------------------------------------------------------------// + case EntityOrganisation: t = ValueOrg; break; + //---------------------------------------------------------------// + case EntityN: t = ValueN; break; + //---------------------------------------------------------------// + case EntityTimeZone: t = ValueUTC; break; + //---------------------------------------------------------------// + case EntityClass: t = ValueClass; break; + //---------------------------------------------------------------// + case EntityGeo: t = ValueGeo; break; + //---------------------------------------------------------------// + case EntitySource: + case EntityURL: t = ValueURI; break; + //---------------------------------------------------------------// + case EntityPhoto: + case EntityLogo: t = ValueImage; break; + //---------------------------------------------------------------// + case EntityBirthday: + case EntityRevision: t = ValueDate; break; + //---------------------------------------------------------------// + case EntityCategories: + case EntityNickname: t = ValueTextList; break; + //---------------------------------------------------------------// + case EntityLabel: + case EntityExtension: + case EntityEmail: + case EntityTitle: + case EntityRole: + case EntityFullName: + case EntityMailer: + case EntityProductID: + case EntityName: + case EntitySortString: + case EntityVersion: + case EntityProfile: + case EntityUID: + case EntityNote: + default: t = ValueText; break; + //---------------------------------------------------------------// + + } + + return t; +} + + QCString +VCARD::EntityTypeToParamName(EntityType e) +{ + if ( e > EntityUnknown ) e = EntityUnknown; + return paramNames[ int( e ) ]; +} + + EntityType +VCARD::EntityNameToEntityType(const QCString & s) +{ + if (s.isEmpty()) return EntityUnknown; + + EntityType t(EntityUnknown); + + switch (s[0]) { + + case 'A': + if (s == "ADR") + t = EntityAddress; + else if (s == "AGENT") + t = EntityAgent; + break; + + case 'B': + if (s == "BDAY") + t = EntityBirthday; + break; + + case 'C': + if (s == "CATEGORIES") + t = EntityCategories; + else if (s == "CLASS") + t = EntityClass; + break; + + case 'E': + if (s == "EMAIL") + t = EntityEmail; + break; + + case 'F': + if (s == "FN") + t = EntityFullName; + break; + + case 'G': + if (s == "GEO") + t = EntityGeo; + break; + + case 'K': + if (s == "KEY") + t = EntityKey; + break; + + case 'L': + if (s == "LABEL") + t = EntityLabel; + else if (s == "LOGO") + t = EntityLogo; + break; + + case 'M': + if (s == "MAILER") + t = EntityMailer; + break; + + case 'N': + if (s == "N") + t = EntityN; + else if (s == "NAME") + t = EntityName; + else if (s == "NICKNAME") + t = EntityNickname; + else if (s == "NOTE") + t = EntityNote; + break; + + case 'O': + if (s == "ORG") + t = EntityOrganisation; + break; + + case 'P': + if (s == "PHOTO") + t = EntityPhoto; + else if (s == "PRODID") + t = EntityProductID; + else if (s == "PROFILE") + t = EntityProfile; + break; + + case 'R': + if (s == "REV") + t = EntityRevision; + else if (s == "ROLE") + t = EntityRole; + break; + + case 'S': + if (s == "SORT-STRING") + t = EntitySortString; + else if (s == "SOUND") + t = EntitySound; + else if (s == "SOURCE") + t = EntitySource; + break; + + case 'T': + if (s == "TEL") + t = EntityTelephone; + else if (s == "TITLE") + t = EntityTitle; + else if (s == "TZ") + t = EntityTimeZone; + break; + + case 'U': + if (s == "UID") + t = EntityUID; + else if (s == "URL") + t = EntityURL; + case 'V': + if (s == "VERSION") + t = EntityVersion; + break; + + case 'X': + if (s.left(2) == "X-") + t = EntityExtension; + break; + + default: + + t = EntityUnknown; + } + + return t; +} + +// The copyright notice below refers to the base64 codec functions used below, +// which are modified from the original sources. + +/* + * Original version Copyright 1988 by The Leland Stanford Junior University + * Copyright 1998 by the University of Washington + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notices appear in all copies and that both the + * above copyright notices and this permission notice appear in supporting + * documentation, and that the name of the University of Washington or The + * Leland Stanford Junior University not be used in advertising or publicity + * pertaining to distribution of the software without specific, written prior + * permission. This software is made available "as is", and + * THE UNIVERSITY OF WASHINGTON AND THE LELAND STANFORD JUNIOR UNIVERSITY + * DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO THIS SOFTWARE, + * INCLUDING WITHOUT LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF + * WASHINGTON OR THE LELAND STANFORD JUNIOR UNIVERSITY BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, TORT (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +static char B64[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +// the mime base64 disctionary used for decoding +static signed char b64dec[] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 10 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 20 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 30 + -1, -1, -1,-19, -1, -1, -1,-16, -4, -4, // 40 -19 == '+' -16 == '/' + -4, -4, -4, -4, -4, -4, -4, -4, -1, -1, // 50 -4 == '0' + -1, 0, -1, -1, -1, 65, 65, 65, 65, 65, // 60 0 == '=' 65 == 'A' + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, // 70 + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, // 80 + 65, -1, -1, -1, -1, -1, -1, 71, 71, 71, // 90 71 == 'a' + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, // 100 + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, // 110 + 71, 71, 71, -1, -1, -1, -1, -1, -1, -1, // 120 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 130 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 140 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 150 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 160 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 170 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 180 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 190 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 200 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 210 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 220 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 230 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 240 + -1, -1, -1, -1, -1, -1, -1 // 250 +}; + + char * +VCARD::decodeBase64(const char * s, unsigned long srcl, unsigned long & len) +{ + register unsigned char c; + register unsigned long e(0); + len = 0; + unsigned const char * src = (unsigned const char *)s; + char * ret = new char[srcl + (srcl / 4 + 1)]; + register char *d = ret; + while (srcl--) { // Critical loop + c = *src++; + int dec = b64dec[c]; + if (dec == -1) continue; + if (c == '=') { + switch (e++) { + case 3: e = 0; break; + case 2: if (*src == '=') break; + default: delete [] ret; ret = 0; return 0; break; + } + continue; + } + c -= dec; + if (e == 0) { *d = c << 2; ++e; continue; } + switch (e) { + case 1: *d |= c >> 4; *++d = c << 4; break; + case 2: *d |= c >> 2; *++d = c << 6; break; + case 3: *d++ |= c; e = 0; continue; break; + } + ++e; + } + len = d - (char *)ret; + return ret; +} + + + char * +VCARD::encodeBase64(const char * src, unsigned long srcl, unsigned long & destl) +{ + register const unsigned char *s = (unsigned char *)src; + register unsigned long i = ((srcl + 2) / 3) * 4; + destl = i += 2 * ((i / 60) + 1); + i = 0; + char * ret = new char[destl]; + register unsigned char *d((unsigned char *)ret); + while (srcl != 0) { // Critical loop + *d++ = B64[s[0] >> 2]; + *d++ = B64[((s[0] << 4) + (--srcl == 0 ? 0 : s[1] >> 4)) & 0x3f]; + *d++ = srcl == 0 ? '=' : + B64[((s[1] << 2) + (--srcl == 0 ? 0 : s[2] >> 6)) & 0x3f]; + *d++ = srcl == 0 ? '=' : B64[s[2] & 0x3f]; + if (srcl != 0) srcl--; + if (++i == 15) { i = 0; *d++ = '\r'; *d++ = '\n'; } + s += 3; + } + *d = '\r'; *++d = '\n'; *++d = '\0'; + return ret; +} + diff --git a/kabc/vcard/FloatValue.cpp b/kabc/vcard/FloatValue.cpp new file mode 100644 index 0000000..15bb664 --- a/dev/null +++ b/kabc/vcard/FloatValue.cpp @@ -0,0 +1,120 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +using namespace VCARD; + +FloatValue::FloatValue() + : Value() +{ +} + +FloatValue::FloatValue(float f) + : Value (), + value_ (f) +{ + parsed_ = true; +} + +FloatValue::FloatValue(const FloatValue & x) + : Value(x) +{ + value_ = x.value_; +} + +FloatValue::FloatValue(const QCString & s) + : Value(s) +{ +} + + FloatValue & +FloatValue::operator = (FloatValue & x) +{ + if (*this == x) return *this; + + x.parse(); + value_ = x.value_; + + Value::operator = (x); + return *this; +} + + FloatValue & +FloatValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +FloatValue::operator == (FloatValue & x) +{ + x.parse(); + return (value_ == x.value_); +} + +FloatValue::~FloatValue() +{ +} + + void +FloatValue::_parse() +{ + bool negative(false); + + if (strRep_[0] == '-' || strRep_[1] == '+') { + + if (strRep_[0] == '-') + negative = true; + + strRep_.remove(0, 1); + } + + value_ = strRep_.toFloat(); + if (negative) + value_ = -value_; +} + + void +FloatValue::_assemble() +{ + strRep_ = QCString().setNum(value_); +} + + float +FloatValue::value() +{ + parse(); + return value_; +} + + void +FloatValue::setValue(float f) +{ + parsed_ = true; + value_ = f; +} + diff --git a/kabc/vcard/GeoValue.cpp b/kabc/vcard/GeoValue.cpp new file mode 100644 index 0000000..e02b402 --- a/dev/null +++ b/kabc/vcard/GeoValue.cpp @@ -0,0 +1,100 @@ +/* + This file is part of libvcard. + Copyright (c) 2002 Tobias Koenig + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include + +#include + +#include + +using namespace VCARD; + +GeoValue::GeoValue() + : Value() +{ +} + +GeoValue::GeoValue(const GeoValue & x) + : Value(x), latitude_(x.latitude_), longitude_(x.longitude_) +{ +} + +GeoValue::GeoValue(const QCString & s) + : Value(s) +{ +} + + GeoValue & +GeoValue::operator = (GeoValue & x) +{ + if (*this == x) return *this; + + latitude_ = x.latitude_; + longitude_ = x.longitude_; + + Value::operator = (x); + return *this; +} + + GeoValue & +GeoValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +GeoValue::operator == (GeoValue & x) +{ + x.parse(); + + if ( latitude_ != x.latitude_ ) return false; + if ( longitude_ != x.longitude_ ) return false; + + return true; +} + +GeoValue::~GeoValue() +{ +} + + GeoValue * +GeoValue::clone() +{ + return new GeoValue( *this ); +} + + void +GeoValue::_parse() +{ + int semiColon = strRep_.find( ";" ); + + if ( semiColon == -1 ) // invalid + return; + + latitude_ = strRep_.left( semiColon ).toFloat(); + longitude_ = strRep_.mid( semiColon + 1, strRep_.length() - semiColon ).toFloat(); +} + + void +GeoValue::_assemble() +{ + strRep_.sprintf( "%.6f;%.6f", latitude_, longitude_ ); +} diff --git a/kabc/vcard/ImageParam.cpp b/kabc/vcard/ImageParam.cpp new file mode 100644 index 0000000..c9cf6fd --- a/dev/null +++ b/kabc/vcard/ImageParam.cpp @@ -0,0 +1,81 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +using namespace VCARD; + +ImageParam::ImageParam() + : Param() +{ +} + +ImageParam::ImageParam(const ImageParam & x) + : Param(x) +{ +} + +ImageParam::ImageParam(const QCString & s) + : Param(s) +{ +} + + ImageParam & +ImageParam::operator = (ImageParam & x) +{ + if (*this == x) return *this; + + Param::operator = (x); + return *this; +} + + ImageParam & +ImageParam::operator = (const QCString & s) +{ + Param::operator = (s); + return *this; +} + + bool +ImageParam::operator == (ImageParam & x) +{ + x.parse(); + return false; +} + +ImageParam::~ImageParam() +{ +} + + void +ImageParam::_parse() +{ +} + + void +ImageParam::_assemble() +{ +} + diff --git a/kabc/vcard/ImageValue.cpp b/kabc/vcard/ImageValue.cpp new file mode 100644 index 0000000..4630fac --- a/dev/null +++ b/kabc/vcard/ImageValue.cpp @@ -0,0 +1,81 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +using namespace VCARD; + +ImageValue::ImageValue() + : Value() +{ +} + +ImageValue::ImageValue(const ImageValue & x) + : Value(x) +{ +} + +ImageValue::ImageValue(const QCString & s) + : Value(s) +{ +} + + ImageValue & +ImageValue::operator = (ImageValue & x) +{ + if (*this == x) return *this; + + Value::operator = (x); + return *this; +} + + ImageValue & +ImageValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +ImageValue::operator == (ImageValue & x) +{ + x.parse(); + return false; +} + +ImageValue::~ImageValue() +{ +} + + void +ImageValue::_parse() +{ +} + + void +ImageValue::_assemble() +{ +} + diff --git a/kabc/vcard/ImgValue.cpp b/kabc/vcard/ImgValue.cpp new file mode 100644 index 0000000..7b961f8 --- a/dev/null +++ b/kabc/vcard/ImgValue.cpp @@ -0,0 +1,81 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +using namespace VCARD; + +ImgValue::ImgValue() + : Value() +{ +} + +ImgValue::ImgValue(const ImgValue & x) + : Value(x) +{ +} + +ImgValue::ImgValue(const QCString & s) + : Value(s) +{ +} + + ImgValue & +ImgValue::operator = (ImgValue & x) +{ + if (*this == x) return *this; + + Value::operator = (x); + return *this; +} + + ImgValue & +ImgValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +ImgValue::operator == (ImgValue & x) +{ + x.parse(); + return false; +} + +ImgValue::~ImgValue() +{ +} + + void +ImgValue::_parse() +{ +} + + void +ImgValue::_assemble() +{ +} + diff --git a/kabc/vcard/LangValue.cpp b/kabc/vcard/LangValue.cpp new file mode 100644 index 0000000..edf1804 --- a/dev/null +++ b/kabc/vcard/LangValue.cpp @@ -0,0 +1,127 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +#include + +using namespace VCARD; + +LangValue::LangValue() + : Value() +{ +} + +LangValue::LangValue(const LangValue & x) + : Value(x) +{ +} + +LangValue::LangValue(const QCString & s) + : Value(s) +{ +} + + LangValue & +LangValue::operator = (LangValue & x) +{ + if (*this == x) return *this; + + Value::operator = (x); + return *this; +} + + LangValue & +LangValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +LangValue::operator == (LangValue & x) +{ + x.parse(); + return false; +} + +LangValue::~LangValue() +{ +} + + void +LangValue::_parse() +{ + QStrList l; + RTokenise(strRep_, "-", l); + + if (l.count() == 0) return; + + primary_ = l.at(0); + + l.remove(0u); + + subtags_ = l; +} + + void +LangValue::_assemble() +{ + strRep_ = primary_; + + QStrListIterator it(subtags_); + + for (; it.current(); ++it) + strRep_ += QCString('-') + it.current(); +} + + QCString +LangValue::primary() +{ + parse(); + return primary_; +} + + QStrList +LangValue::subtags() +{ + parse(); + return subtags_; +} + + void +LangValue::setPrimary(const QCString & s) +{ + parse(); + primary_ = s; +} + + void +LangValue::setSubTags(const QStrList & l) +{ + parse(); + subtags_ = l; +} + diff --git a/kabc/vcard/NValue.cpp b/kabc/vcard/NValue.cpp new file mode 100644 index 0000000..cdec621 --- a/dev/null +++ b/kabc/vcard/NValue.cpp @@ -0,0 +1,128 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include +#include +#include + +using namespace VCARD; + +NValue::NValue() + : Value() +{ + vDebug("ctor"); +} + +NValue::NValue(const NValue & x) + : Value(x), + family_ (x.family_), + given_ (x.given_), + middle_ (x.middle_), + prefix_ (x.prefix_), + suffix_ (x.suffix_) +{ +} + +NValue::NValue(const QCString & s) + : Value(s) +{ + vDebug("ctor"); +} + + NValue & +NValue::operator = (NValue & x) +{ + if (*this == x) return *this; + + family_ = x.family_; + given_ = x.given_; + middle_ = x.middle_; + prefix_ = x.prefix_; + suffix_ = x.suffix_; + + Value::operator = (x); + return *this; +} + + NValue & +NValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +NValue::operator == (NValue & x) +{ + x.parse(); + + return ( + family_ == x.family_ && + given_ == x.given_ && + middle_ == x.middle_ && + prefix_ == x.prefix_ && + suffix_ == x.suffix_); +} + +NValue::~NValue() +{ +} + + NValue * +NValue::clone() +{ + return new NValue( *this ); +} + + void +NValue::_parse() +{ + QStrList l; + RTokenise(strRep_, ";", l); + + for (unsigned int i = 0; i < l.count(); i++) { + + switch (i) { + case 0: family_ = l.at(0); break; + case 1: given_ = l.at(1); break; + case 2: middle_ = l.at(2); break; + case 3: prefix_ = l.at(3); break; + case 4: suffix_ = l.at(4); break; + default: break; + } + } +} + + void +NValue::_assemble() +{ + strRep_ = family_; + strRep_ += ";" + given_; + strRep_ += ";" + middle_; + strRep_ += ";" + prefix_; + strRep_ += ";" + suffix_; +} + diff --git a/kabc/vcard/OrgValue.cpp b/kabc/vcard/OrgValue.cpp new file mode 100644 index 0000000..c3134c8 --- a/dev/null +++ b/kabc/vcard/OrgValue.cpp @@ -0,0 +1,107 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +#include + +using namespace VCARD; + +OrgValue::OrgValue() + : Value() +{ +} + +OrgValue::OrgValue(const OrgValue & x) + : Value(x) +{ +} + +OrgValue::OrgValue(const QCString & s) + : Value(s) +{ +} + + OrgValue & +OrgValue::operator = (OrgValue & x) +{ + if (*this == x) return *this; + + Value::operator = (x); + return *this; +} + + OrgValue & +OrgValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +OrgValue::operator == (OrgValue & x) +{ + x.parse(); + return false; +} + +OrgValue::~OrgValue() +{ +} + + void +OrgValue::_parse() +{ + RTokenise(strRep_, ";", valueList_); +} + + void +OrgValue::_assemble() +{ + bool first(true); + + QStrListIterator it(valueList_); + + for (; it.current(); ++it) { + if (!first) strRep_ += ';'; + strRep_ += it.current(); + first = false; + } +} + + unsigned int +OrgValue::numValues() +{ + parse(); + return valueList_.count(); +} + + QCString +OrgValue::value(unsigned int i) +{ + parse(); + return valueList_.at(i); +} + diff --git a/kabc/vcard/Param.cpp b/kabc/vcard/Param.cpp new file mode 100644 index 0000000..c513613 --- a/dev/null +++ b/kabc/vcard/Param.cpp @@ -0,0 +1,129 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +#include + +using namespace VCARD; + +Param::Param() + : Entity(), + name_(""), + value_("") +{ +} + +Param::Param(const Param & x) + : Entity(x), + name_(x.name_), + value_(x.value_) +{ +} + +Param::Param(const QCString & s) + : Entity(s), + name_(""), + value_("") +{ +} + + Param & +Param::operator = (Param & x) +{ + if (*this == x) return *this; + + Entity::operator = (x); + name_ = x.name_; + value_ = x.value_; + + return *this; +} + + Param & +Param::operator = (const QCString & s) +{ + Entity::operator = (s); + return *this; +} + + bool +Param::operator == (Param & x) +{ + x.parse(); + return false; +} + +Param::~Param() +{ +} + + void +Param::_parse() +{ +} + + void +Param::_assemble() +{ + strRep_ = name_ + "=" + value_; +} + +Param::Param(const QCString &name, const QCString &value) + : Entity(), + name_(name), + value_(value) +{ + parsed_ = true; + assembled_ = false; +} + + void +Param::setName(const QCString & name) +{ + name_ = name; + + assembled_ = false; +} + + void +Param::setValue(const QCString & value) +{ + value_ = value; + + assembled_ = false; +} + + QCString +Param::name() +{ + return name_; +} + + QCString +Param::value() +{ + return value_; +} diff --git a/kabc/vcard/PhoneNumberValue.cpp b/kabc/vcard/PhoneNumberValue.cpp new file mode 100644 index 0000000..17b1400 --- a/dev/null +++ b/kabc/vcard/PhoneNumberValue.cpp @@ -0,0 +1,81 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +using namespace VCARD; + +PhoneNumberValue::PhoneNumberValue() + : Value() +{ +} + +PhoneNumberValue::PhoneNumberValue(const PhoneNumberValue & x) + : Value(x) +{ +} + +PhoneNumberValue::PhoneNumberValue(const QCString & s) + : Value(s) +{ +} + + PhoneNumberValue & +PhoneNumberValue::operator = (PhoneNumberValue & x) +{ + if (*this == x) return *this; + + Value::operator = (x); + return *this; +} + + PhoneNumberValue & +PhoneNumberValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +PhoneNumberValue::operator == (PhoneNumberValue & x) +{ + x.parse(); + return false; +} + +PhoneNumberValue::~PhoneNumberValue() +{ +} + + void +PhoneNumberValue::_parse() +{ +} + + void +PhoneNumberValue::_assemble() +{ +} + diff --git a/kabc/vcard/README b/kabc/vcard/README new file mode 100644 index 0000000..18a9daf --- a/dev/null +++ b/kabc/vcard/README @@ -0,0 +1,15 @@ +libvcard (C) 1999 Rik Hemsley +Written for the KDE project. + +This software is licensed under the MIT license. + +A vCard 3.0 parser based on the same principles that librmm (from Empath) uses. + +It's small and very fast due to parsing and assembly of object being lazy. + +There is a base64 codec declared in Enum.h + +Feedback welcome. + +Rik + diff --git a/kabc/vcard/RToken.cpp b/kabc/vcard/RToken.cpp new file mode 100644 index 0000000..2a85820 --- a/dev/null +++ b/kabc/vcard/RToken.cpp @@ -0,0 +1,88 @@ +/* + + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include +#include +#include +#include + +namespace VCARD +{ + + Q_UINT32 +RTokenise(const char * str, const char * delim, QStrList & l) +{ + // FIXME no stderr ! + l.clear(); + + if (!delim || !str || strlen(delim) == 0 || strlen(str) == 0) return 0; + + char * len = (char *)(str + strlen(str)); // End of string. + + register char * rstart = new char[strlen(str) + 1]; + register char * r = rstart; + + + register const char * i = str; // Cursor. + + while (i <= len) { + + if (*i == '\\') { // Escaped chars go straight through. + *r++ = *i++; + if (i <= len) + *r++ = *i++; + continue; + } + + if (strchr(delim, *i) != 0) { + // We hit a delimiter. If we have some text, make a new token. + // This has the effect that multiple delimiters are collapsed. + // cs: We mustn't collapse multiple delimiters, otherwise we + // lose empty fields. + *r = '\0'; +// if (r != rstart) { + l.append(rstart); +// } + r = rstart; + ++i; + continue; + } + + *r++ = *i++; + } + + // Catch last token +// if (r != rstart) { + *r = '\0'; + l.append(rstart); +// } + + r = 0; + + delete [] rstart; + + return l.count(); +} + +} diff --git a/kabc/vcard/SoundValue.cpp b/kabc/vcard/SoundValue.cpp new file mode 100644 index 0000000..81040d1 --- a/dev/null +++ b/kabc/vcard/SoundValue.cpp @@ -0,0 +1,81 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +using namespace VCARD; + +SoundValue::SoundValue() + : Value() +{ +} + +SoundValue::SoundValue(const SoundValue & x) + : Value(x) +{ +} + +SoundValue::SoundValue(const QCString & s) + : Value(s) +{ +} + + SoundValue & +SoundValue::operator = (SoundValue & x) +{ + if (*this == x) return *this; + + Value::operator = (x); + return *this; +} + + SoundValue & +SoundValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +SoundValue::operator == (SoundValue & x) +{ + x.parse(); + return false; +} + +SoundValue::~SoundValue() +{ +} + + void +SoundValue::_parse() +{ +} + + void +SoundValue::_assemble() +{ +} + diff --git a/kabc/vcard/SourceParam.cpp b/kabc/vcard/SourceParam.cpp new file mode 100644 index 0000000..cd51cbd --- a/dev/null +++ b/kabc/vcard/SourceParam.cpp @@ -0,0 +1,112 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +using namespace VCARD; + +SourceParam::SourceParam() + : Param(), + type_(SourceParam::TypeUnknown) +{ +} + +SourceParam::SourceParam(const SourceParam & x) + : Param(x), + type_ (x.type_), + par_ (x.par_), + val_ (x.val_) +{ +} + +SourceParam::SourceParam(const QCString & s) + : Param(s), + type_(SourceParam::TypeUnknown) +{ +} + + SourceParam & +SourceParam::operator = (SourceParam & x) +{ + if (*this == x) return *this; + type_ = x.type(); + par_ = x.par(); + val_ = x.val(); + + Param::operator = (x); + return *this; +} + + SourceParam & +SourceParam::operator = (const QCString & s) +{ + Param::operator = (s); + return *this; +} + + bool +SourceParam::operator == (SourceParam & x) +{ + x.parse(); + return false; +} + +SourceParam::~SourceParam() +{ +} + + void +SourceParam::_parse() +{ + int i = strRep_.find('='); + if (i == -1) // Invalid + return; + + par_ = strRep_.left(i); + val_ = strRep_.right(strRep_.length() - i - 1); + + if (qstricmp(par_, "VALUE") == 0 && qstricmp(val_, "uri") == 0) + type_ = TypeValue; + else if (qstricmp(par_, "CONTEXT") == 0 && qstricmp(val_, "word") == 0) + type_ = TypeContext; + else if (qstrnicmp(par_, "X-", 2) == 0) { + type_ = TypeX; + } + else type_ = TypeUnknown; + +} + + void +SourceParam::_assemble() +{ + if (type_ == TypeValue) + strRep_ = "VALUE=uri"; + else if (type_ == TypeContext) + strRep_ = "CONTEXT=word"; + else if (type_ == TypeX) + strRep_ = par_ + "=" + val_; + else strRep_ = ""; +} + diff --git a/kabc/vcard/TelParam.cpp b/kabc/vcard/TelParam.cpp new file mode 100644 index 0000000..9d9fe4d --- a/dev/null +++ b/kabc/vcard/TelParam.cpp @@ -0,0 +1,81 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +using namespace VCARD; + +TelParam::TelParam() + : Param() +{ +} + +TelParam::TelParam(const TelParam & x) + : Param(x) +{ +} + +TelParam::TelParam(const QCString & s) + : Param(s) +{ +} + + TelParam & +TelParam::operator = (TelParam & x) +{ + if (*this == x) return *this; + + Param::operator = (x); + return *this; +} + + TelParam & +TelParam::operator = (const QCString & s) +{ + Param::operator = (s); + return *this; +} + + bool +TelParam::operator == (TelParam & x) +{ + x.parse(); + return false; +} + +TelParam::~TelParam() +{ +} + + void +TelParam::_parse() +{ +} + + void +TelParam::_assemble() +{ +} + diff --git a/kabc/vcard/TelValue.cpp b/kabc/vcard/TelValue.cpp new file mode 100644 index 0000000..349f99a --- a/dev/null +++ b/kabc/vcard/TelValue.cpp @@ -0,0 +1,81 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +using namespace VCARD; + +TelValue::TelValue() + : Value() +{ +} + +TelValue::TelValue(const TelValue & x) + : Value(x) +{ +} + +TelValue::TelValue(const QCString & s) + : Value(s) +{ +} + + TelValue & +TelValue::operator = (TelValue & x) +{ + if (*this == x) return *this; + + Value::operator = (x); + return *this; +} + + TelValue & +TelValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +TelValue::operator == (TelValue & x) +{ + x.parse(); + return false; +} + +TelValue::~TelValue() +{ +} + + void +TelValue::_parse() +{ +} + + void +TelValue::_assemble() +{ +} + diff --git a/kabc/vcard/TextBinParam.cpp b/kabc/vcard/TextBinParam.cpp new file mode 100644 index 0000000..66f2946 --- a/dev/null +++ b/kabc/vcard/TextBinParam.cpp @@ -0,0 +1,81 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +using namespace VCARD; + +TextBinParam::TextBinParam() + : Param() +{ +} + +TextBinParam::TextBinParam(const TextBinParam & x) + : Param(x) +{ +} + +TextBinParam::TextBinParam(const QCString & s) + : Param(s) +{ +} + + TextBinParam & +TextBinParam::operator = (TextBinParam & x) +{ + if (*this == x) return *this; + + Param::operator = (x); + return *this; +} + + TextBinParam & +TextBinParam::operator = (const QCString & s) +{ + Param::operator = (s); + return *this; +} + + bool +TextBinParam::operator == (TextBinParam & x) +{ + x.parse(); + return false; +} + +TextBinParam::~TextBinParam() +{ +} + + void +TextBinParam::_parse() +{ +} + + void +TextBinParam::_assemble() +{ +} + diff --git a/kabc/vcard/TextBinValue.cpp b/kabc/vcard/TextBinValue.cpp new file mode 100644 index 0000000..c584009 --- a/dev/null +++ b/kabc/vcard/TextBinValue.cpp @@ -0,0 +1,104 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include + +using namespace VCARD; + +TextBinValue::TextBinValue() + : Value() +{ +} + +TextBinValue::TextBinValue(const TextBinValue & x) + : Value(x) +{ + mIsBinary_ = x.mIsBinary_; + mData_ = x.mData_; + mUrl_ = x.mUrl_; +} + +TextBinValue::TextBinValue(const QCString & s) + : Value(s) +{ +} + + TextBinValue & +TextBinValue::operator = (TextBinValue & x) +{ + if (*this == x) return *this; + + mIsBinary_ = x.mIsBinary_; + mData_ = x.mData_; + mUrl_ = x.mUrl_; + + Value::operator = (x); + return *this; +} + + TextBinValue & +TextBinValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +TextBinValue::operator == (TextBinValue & x) +{ + x.parse(); + + if ( mIsBinary_ != x.mIsBinary_ ) return false; + if ( mData_ != x.mData_ ) return false; + if ( mUrl_ != x.mUrl_ ) return false; + + return true; +} + +TextBinValue::~TextBinValue() +{ +} + + TextBinValue * +TextBinValue::clone() +{ + return new TextBinValue( *this ); +} + + void +TextBinValue::_parse() +{ +} + + void +TextBinValue::_assemble() +{ + if ( mIsBinary_ ) { + strRep_ = KCodecs::base64Encode( mData_ ); + } else + strRep_ = mUrl_.utf8(); +} + diff --git a/kabc/vcard/TextListValue.cpp b/kabc/vcard/TextListValue.cpp new file mode 100644 index 0000000..c4ac1e3 --- a/dev/null +++ b/kabc/vcard/TextListValue.cpp @@ -0,0 +1,107 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +#include + +using namespace VCARD; + +TextListValue::TextListValue() + : Value() +{ +} + +TextListValue::TextListValue(const TextListValue & x) + : Value(x) +{ +} + +TextListValue::TextListValue(const QCString & s) + : Value(s) +{ +} + + TextListValue & +TextListValue::operator = (TextListValue & x) +{ + if (*this == x) return *this; + + Value::operator = (x); + return *this; +} + + TextListValue & +TextListValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +TextListValue::operator == (TextListValue & x) +{ + x.parse(); + return false; +} + +TextListValue::~TextListValue() +{ +} + + void +TextListValue::_parse() +{ + RTokenise(strRep_, ";", valueList_); +} + + void +TextListValue::_assemble() +{ + bool first(true); + + QStrListIterator it(valueList_); + + for (; it.current(); ++it) { + if (!first) strRep_ += ';'; + strRep_ += it.current(); + first = false; + } +} + + unsigned int +TextListValue::numValues() +{ + parse(); + return valueList_.count(); +} + + QCString +TextListValue::value(unsigned int i) +{ + parse(); + return valueList_.at(i); +} + diff --git a/kabc/vcard/TextParam.cpp b/kabc/vcard/TextParam.cpp new file mode 100644 index 0000000..7c68700 --- a/dev/null +++ b/kabc/vcard/TextParam.cpp @@ -0,0 +1,82 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +using namespace VCARD; + +TextParam::TextParam() + : Param() +{ +} + +TextParam::TextParam(const TextParam & x) + : Param(x) +{ +} + +TextParam::TextParam(const QCString & s) + : Param(s) +{ +} + + TextParam & +TextParam::operator = (TextParam & x) +{ + if (*this == x) return *this; + + Param::operator = (x); + return *this; +} + + TextParam & +TextParam::operator = (const QCString & s) +{ + Param::operator = (s); + return *this; +} + + bool +TextParam::operator == (TextParam & x) +{ + x.parse(); + + return false; +} + +TextParam::~TextParam() +{ +} + + void +TextParam::_parse() +{ +} + + void +TextParam::_assemble() +{ +} + diff --git a/kabc/vcard/TextValue.cpp b/kabc/vcard/TextValue.cpp new file mode 100644 index 0000000..09934fa --- a/dev/null +++ b/kabc/vcard/TextValue.cpp @@ -0,0 +1,86 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +using namespace VCARD; + +TextValue::TextValue() + : Value() +{ +} + +TextValue::TextValue(const TextValue & x) + : Value(x) +{ +} + +TextValue::TextValue(const QCString & s) + : Value(s) +{ +} + + TextValue & +TextValue::operator = (TextValue & x) +{ + if (*this == x) return *this; + + Value::operator = (x); + return *this; +} + + TextValue & +TextValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +TextValue::operator == (TextValue & x) +{ + return strRep_ = x.strRep_; +} + +TextValue::~TextValue() +{ +} + + TextValue * +TextValue::clone() +{ + return new TextValue( *this ); +} + + void +TextValue::_parse() +{ +} + + void +TextValue::_assemble() +{ +} + diff --git a/kabc/vcard/URIValue.cpp b/kabc/vcard/URIValue.cpp new file mode 100644 index 0000000..c1d1022 --- a/dev/null +++ b/kabc/vcard/URIValue.cpp @@ -0,0 +1,133 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +using namespace VCARD; + +URIValue::URIValue() + : Value() +{ +} + +URIValue::URIValue(const QCString & scheme, const QCString & schemeSpecificPart) + : Value(), + scheme_ (scheme), + schemeSpecificPart_ (schemeSpecificPart) +{ + parsed_ = true; +} + +URIValue::URIValue(const URIValue & x) + : Value (x), + scheme_ (x.scheme_), + schemeSpecificPart_ (x.schemeSpecificPart_) +{ +} + +URIValue::URIValue(const QCString & s) + : Value(s) +{ +} + + URIValue & +URIValue::operator = (URIValue & x) +{ + if (*this == x) return *this; + + scheme_ = x.scheme_; + schemeSpecificPart_ = x.schemeSpecificPart_; + + Value::operator = (x); + return *this; +} + + URIValue & +URIValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +URIValue::operator == (URIValue & x) +{ + x.parse(); + return ( + (scheme_ == x.scheme_) && + (schemeSpecificPart_ == x.schemeSpecificPart_)); + + return false; +} + +URIValue::~URIValue() +{ +} + + void +URIValue::_parse() +{ + int split = strRep_.find(':'); + if (split == -1) + return; + + scheme_ = strRep_.left(split); + schemeSpecificPart_ = strRep_.mid(split + 1); +} + + void +URIValue::_assemble() +{ + strRep_ = scheme_ + ':' + schemeSpecificPart_; +} + + QCString +URIValue::scheme() +{ + parse(); + return scheme_; +} + + QCString +URIValue::schemeSpecificPart() +{ + parse(); + return schemeSpecificPart_; +} + + void +URIValue::setScheme(const QCString & s) +{ + parse(); + scheme_ = s; +} + + void +URIValue::setSchemeSpecificPart(const QCString & s) +{ + parse(); + schemeSpecificPart_ = s; +} + diff --git a/kabc/vcard/UTCValue.cpp b/kabc/vcard/UTCValue.cpp new file mode 100644 index 0000000..374306c --- a/dev/null +++ b/kabc/vcard/UTCValue.cpp @@ -0,0 +1,110 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include + +using namespace VCARD; + +UTCValue::UTCValue() + : Value() +{ +} + +UTCValue::UTCValue(const UTCValue & x) + : Value(x), positive_(x.positive_), hour_(x.hour_), minute_(x.minute_) + +{ +} + +UTCValue::UTCValue(const QCString & s) + : Value(s) +{ +} + + UTCValue & +UTCValue::operator = (UTCValue & x) +{ + if (*this == x) return *this; + + positive_ = x.positive_; + hour_ = x.hour_; + minute_ = x.minute_; + + Value::operator = (x); + return *this; +} + + UTCValue & +UTCValue::operator = (const QCString & s) +{ + Value::operator = (s); + return *this; +} + + bool +UTCValue::operator == (UTCValue & x) +{ + x.parse(); + + if (positive_ != x.positive_) return false; + if (hour_ != x.hour_) return false; + if (minute_ != x.minute_) return false; + + return true; +} + +UTCValue::~UTCValue() +{ +} + + UTCValue * +UTCValue::clone() +{ + return new UTCValue( *this ); +} + + void +UTCValue::_parse() +{ + if ( strRep_.isEmpty() ) + return; + + positive_ = ( strRep_[0] == '+' ); + + int colon = strRep_.find( ':' ); + + if ( colon == -1 ) // Not valid. + return; + + hour_ = strRep_.mid( 1, 2 ).toInt(); + minute_ = strRep_.right( 2 ).toInt(); +} + + void +UTCValue::_assemble() +{ + strRep_.sprintf( "%c%.2i:%.2i", (positive_ ? '+' : '-'), hour_, minute_ ); +} + diff --git a/kabc/vcard/VCardEntity.cpp b/kabc/vcard/VCardEntity.cpp new file mode 100644 index 0000000..0c21e2f --- a/dev/null +++ b/kabc/vcard/VCardEntity.cpp @@ -0,0 +1,119 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include + +using namespace VCARD; + +VCardEntity::VCardEntity() + : Entity() +{ +} + +VCardEntity::VCardEntity(const VCardEntity & x) + : Entity(x) +{ +} + +VCardEntity::VCardEntity(const QCString & s) + : Entity(s) +{ +} + + VCardEntity & +VCardEntity::operator = (VCardEntity & x) +{ + if (*this == x) return *this; + + Entity::operator = (x); + return *this; +} + + VCardEntity & +VCardEntity::operator = (const QCString & s) +{ + Entity::operator = (s); + return *this; +} + + bool +VCardEntity::operator == (VCardEntity & x) +{ + x.parse(); + return false; +} + +VCardEntity::~VCardEntity() +{ +} + + void +VCardEntity::_parse() +{ + vDebug("parse"); + QCString s(strRep_); + + int i = s.find(QRegExp("BEGIN:VCARD", false)); + + while (i != -1) { + + i = s.find(QRegExp("BEGIN:VCARD", false), 11); + + QCString cardStr(s.left(i)); + + VCard * v = new VCard(cardStr); + + cardList_.append(v); + + v->parse(); + + s.remove(0, i); + } +} + + void +VCardEntity::_assemble() +{ + VCardListIterator it(cardList_); + + for (; it.current(); ++it) + strRep_ += it.current()->asString() + "\r\n"; // One CRLF for luck. +} + + VCardList & +VCardEntity::cardList() +{ + parse(); + return cardList_; +} + + void +VCardEntity::setCardList(const VCardList & l) +{ + parse(); + cardList_ = l; +} + diff --git a/kabc/vcard/VCardv.cpp b/kabc/vcard/VCardv.cpp new file mode 100644 index 0000000..8d271f4 --- a/dev/null +++ b/kabc/vcard/VCardv.cpp @@ -0,0 +1,282 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include +#include + +#include +#include +#include +#include + +#include + +using namespace VCARD; + +VCard::VCard() + : Entity() +{ +} + +VCard::VCard(const VCard & x) + : Entity(x), + group_(x.group_), + contentLineList_(x.contentLineList_) +{ +} + +VCard::VCard(const QCString & s) + : Entity(s) +{ +} + + VCard & +VCard::operator = (VCard & x) +{ + if (*this == x) return *this; + + group_ = x.group(); + contentLineList_ = x.contentLineList_; + + Entity::operator = (x); + return *this; +} + + VCard & +VCard::operator = (const QCString & s) +{ + Entity::operator = (s); + return *this; +} + + bool +VCard::operator == (VCard & x) +{ + x.parse(); + return false; +} + +VCard::~VCard() +{ +} + + void +VCard::_parse() +{ + vDebug("parse() called"); + QStrList l; + + RTokenise(strRep_, "\r\n", l); + + if (l.count() < 3) { // Invalid VCARD ! + vDebug("Invalid vcard"); + return; + } + + // Get the first line + QCString beginLine = QCString(l.at(0)).stripWhiteSpace(); + + vDebug("Begin line == \"" + beginLine + "\""); + + // Remove extra blank lines + while (QCString(l.last()).isEmpty()) + l.remove(l.last()); + + // Now we know this is the last line + QCString endLine = l.last(); + + // Trash the first and last lines as we have seen them. + l.remove(0u); + l.remove(l.last()); + + /////////////////////////////////////////////////////////////// + // FIRST LINE + + int split = beginLine.find(':'); + + if (split == -1) { // invalid, no BEGIN + vDebug("No split"); + return; + } + + QCString firstPart(beginLine.left(split)); + QCString valuePart(beginLine.mid(split + 1)); + + split = firstPart.find('.'); + + if (split != -1) { + group_ = firstPart.left(split); + firstPart = firstPart.right(firstPart.length() - split - 1); + } + + if (qstrnicmp(firstPart, "BEGIN", 5) != 0) { // No BEGIN ! + vDebug("No BEGIN"); + return; + } + + if (qstrnicmp(valuePart, "VCARD", 5) != 0) { // Not a vcard ! + vDebug("No VCARD"); + return; + } + + /////////////////////////////////////////////////////////////// + // CONTENT LINES + // + vDebug("Content lines"); + + // Handle folded lines. + + QStrList refolded; + + QStrListIterator it(l); + + QCString cur; + + for (; it.current(); ++it) { + + cur = it.current(); + + ++it; + + while ( + it.current() && + it.current()[0] == ' ' && + strlen(it.current()) != 1) + { + cur += it.current() + 1; + ++it; + } + + --it; + + refolded.append(cur); + } + + QStrListIterator it2(refolded); + + for (; it2.current(); ++it2) { + + vDebug("New contentline using \"" + QCString(it2.current()) + "\""); + ContentLine * cl = new ContentLine(it2.current()); + + cl->parse(); + + contentLineList_.append(cl); + } + + /////////////////////////////////////////////////////////////// + // LAST LINE + + split = endLine.find(':'); + + if (split == -1) // invalid, no END + return; + + firstPart = endLine.left(split); + valuePart = endLine.right(firstPart.length() - split - 1); + + split = firstPart.find('.'); + + if (split != -1) { + group_ = firstPart.left(split); + firstPart = firstPart.right(firstPart.length() - split - 1); + } + + if (qstricmp(firstPart, "END") != 0) // No END ! + return; + + if (qstricmp(valuePart, "VCARD") != 0) // Not a vcard ! + return; +} + + void +VCard::_assemble() +{ + vDebug("Assembling vcard"); + strRep_ = "BEGIN:VCARD\r\n"; + strRep_ += "VERSION:3.0\r\n"; + + QPtrListIterator it(contentLineList_); + + for (; it.current(); ++it) + strRep_ += it.current()->asString() + "\r\n"; + + strRep_ += "END:VCARD\r\n"; +} + + bool +VCard::has(EntityType t) +{ + parse(); + return contentLine(t) == 0 ? false : true; +} + + bool +VCard::has(const QCString & s) +{ + parse(); + return contentLine(s) == 0 ? false : true; +} + + void +VCard::add(const ContentLine & cl) +{ + parse(); + ContentLine * c = new ContentLine(cl); + contentLineList_.append(c); +} + + void +VCard::add(const QCString & s) +{ + parse(); + ContentLine * c = new ContentLine(s); + contentLineList_.append(c); +} + + ContentLine * +VCard::contentLine(EntityType t) +{ + parse(); + QPtrListIterator it(contentLineList_); + + for (; it.current(); ++it) + if (it.current()->entityType() == t) + return it.current(); + + return 0; +} + + ContentLine * +VCard::contentLine(const QCString & s) +{ + parse(); + QPtrListIterator it(contentLineList_); + + for (; it.current(); ++it) + if (it.current()->entityType() == EntityNameToEntityType(s)) + return it.current(); + + return 0; +} + diff --git a/kabc/vcard/Value.cpp b/kabc/vcard/Value.cpp new file mode 100644 index 0000000..1978af2 --- a/dev/null +++ b/kabc/vcard/Value.cpp @@ -0,0 +1,82 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include +#include + +using namespace VCARD; + +Value::Value() + : Entity() +{ +} + +Value::Value(const Value & x) + : Entity(x) +{ +} + +Value::Value(const QCString & s) + : Entity(s) +{ +} + + Value & +Value::operator = (Value & x) +{ + if (*this == x) return *this; + + Entity::operator = (x); + return *this; +} + + Value & +Value::operator = (const QCString & s) +{ + Entity::operator = (s); + return *this; +} + + bool +Value::operator == (Value & x) +{ + x.parse(); + return false; +} + +Value::~Value() +{ +} + + void +Value::_parse() +{ +} + + void +Value::_assemble() +{ +//US vDebug("Value::_assemble()"); + qDebug("Value::_assemble()"); +} + diff --git a/kabc/vcard/include/VCard.h b/kabc/vcard/include/VCard.h new file mode 100644 index 0000000..17b50e8 --- a/dev/null +++ b/kabc/vcard/include/VCard.h @@ -0,0 +1,43 @@ +#ifndef VCARD_H +#define VCARD_H + +#include "VCardAdrParam.h" +#include "VCardAdrValue.h" +#include "VCardAgentParam.h" +#include "VCardAgentValue.h" +#include "VCardClassValue.h" +#include "VCardContentLine.h" +#include "VCardDateParam.h" +#include "VCardDateValue.h" +#include "VCardDefines.h" +#include "VCardEmailParam.h" +#include "VCardEntity.h" +#include "VCardEnum.h" +#include "VCardFloatValue.h" +#include "VCardGeoValue.h" +#include "VCardGroup.h" +#include "VCardImageParam.h" +#include "VCardImageValue.h" +#include "VCardImgValue.h" +#include "VCardLangValue.h" +#include "VCardNValue.h" +#include "VCardOrgValue.h" +#include "VCardParam.h" +#include "VCardPhoneNumberValue.h" +#include "VCardRToken.h" +#include "VCardSoundValue.h" +#include "VCardSourceParam.h" +#include "VCardTelParam.h" +#include "VCardTelValue.h" +#include "VCardTextBinParam.h" +#include "VCardTextBinValue.h" +#include "VCardTextListValue.h" +#include "VCardTextParam.h" +#include "VCardTextValue.h" +#include "VCardURIValue.h" +#include "VCardUTCValue.h" +#include "VCardVCard.h" +#include "VCardVCardEntity.h" +#include "VCardValue.h" + +#endif diff --git a/kabc/vcard/include/VCardAdrParam.h b/kabc/vcard/include/VCardAdrParam.h new file mode 100644 index 0000000..89dcb64 --- a/dev/null +++ b/kabc/vcard/include/VCardAdrParam.h @@ -0,0 +1,64 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef ADRPARAM_H +#define ADRPARAM_H + +#include +#include + +#include + +namespace VCARD +{ + +class AdrParam : public Param +{ + +#include "AdrParam-generated.h" + + QStrList adrTypeList() + { parse(); return adrTypeList_; } + + QCString textParam() + { parse(); return textParam_; } + + void setAdrTypeList(const QStrList & l) + { adrTypeList_ = l; assembled_ = false; } + + void setTextParam(const QCString & s) + { textParam_ = s; assembled_ = false; } + + enum AdrType { + AdrDom, AdrIntl, AdrPostal, AdrParcel, AdrHome, AdrWork, AdrPref, + AdrIANA, AdrX + }; + + private: + + QStrList adrTypeList_; + QCString textParam_; +}; +} + +#endif diff --git a/kabc/vcard/include/VCardAdrValue.h b/kabc/vcard/include/VCardAdrValue.h new file mode 100644 index 0000000..0731924 --- a/dev/null +++ b/kabc/vcard/include/VCardAdrValue.h @@ -0,0 +1,83 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef ADRVALUE_H +#define ADRVALUE_H + +#include +#include + +namespace VCARD +{ + +class AdrValue : public Value +{ + +#include "AdrValue-generated.h" + + AdrValue *clone(); + + void setPOBox(const QCString & s) + { poBox_ = s; assembled_ = false; } + + void setExtAddress(const QCString & s) + { extAddress_ = s; assembled_ = false; } + + void setStreet(const QCString & s) + { street_ = s; assembled_ = false; } + + void setLocality(const QCString & s) + { locality_ = s; assembled_ = false; } + + void setRegion(const QCString & s) + { region_ = s; assembled_ = false; } + + void setPostCode(const QCString & s) + { postCode_ = s; assembled_ = false; } + + void setCountryName(const QCString & s) + { countryName_ = s; assembled_ = false; } + + QCString poBox() { parse(); return poBox_; } + QCString extAddress() { parse(); return extAddress_; } + QCString street() { parse(); return street_; } + QCString locality() { parse(); return locality_; } + QCString region() { parse(); return region_; } + QCString postCode() { parse(); return postCode_; } + QCString countryName() { parse(); return countryName_; } + + private: + + QCString poBox_; + QCString extAddress_; + QCString street_; + QCString locality_; + QCString region_; + QCString postCode_; + QCString countryName_; +}; + +} + +#endif + diff --git a/kabc/vcard/include/VCardAgentParam.h b/kabc/vcard/include/VCardAgentParam.h new file mode 100644 index 0000000..72a05db --- a/dev/null +++ b/kabc/vcard/include/VCardAgentParam.h @@ -0,0 +1,60 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef AGENTPARAM_H +#define AGENTPARAM_H + +#include + +#include +#include + +namespace VCARD +{ + +class AgentParam : public Param +{ + +#include "AgentParam-generated.h" + + bool refer() + { parse(); return refer_; } + + URIValue uri() + { parse(); return uri_; } + + void setRefer(bool b) + { refer_ = b; assembled_ = false; } + + void setURI(const QCString & s) + { uri_ = s; assembled_ = false; } + + private: + + bool refer_; + URIValue uri_; +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardAgentValue.h b/kabc/vcard/include/VCardAgentValue.h new file mode 100644 index 0000000..f655836 --- a/dev/null +++ b/kabc/vcard/include/VCardAgentValue.h @@ -0,0 +1,44 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef AGENTVALUE_H +#define AGENTVALUE_H + +#include + +#include + +namespace VCARD +{ + +class AgentValue : public Value +{ + +#include "AgentValue-generated.h" + + private: +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardClassValue.h b/kabc/vcard/include/VCardClassValue.h new file mode 100644 index 0000000..ff133c2 --- a/dev/null +++ b/kabc/vcard/include/VCardClassValue.h @@ -0,0 +1,56 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef CLASSVALUE_H +#define CLASSVALUE_H + +#include + +#include + +#include + +namespace VCARD +{ + +class ClassValue : public Value +{ + +#include "ClassValue-generated.h" + + enum ClassType { + Public, Private, Confidential, Other + }; + + ClassValue *clone(); + + void setType( int type ) { classType_ = type; assembled_ = false; parsed_ = true; } + int type() { parse(); return classType_; } + + private: + int classType_; +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardContentLine.h b/kabc/vcard/include/VCardContentLine.h new file mode 100644 index 0000000..1c5f5be --- a/dev/null +++ b/kabc/vcard/include/VCardContentLine.h @@ -0,0 +1,77 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef CONTENTLINE_H +#define CONTENTLINE_H + +#include + +#include "VCardEnum.h" +#include "VCardEntity.h" +#include "VCardParam.h" +#include "VCardValue.h" + +namespace VCARD +{ + +class ContentLine : public Entity +{ + +#include "ContentLine-generated.h" + + QCString group() { parse(); return group_; } + QCString name() { parse(); return name_; } + Value * value() { parse(); return value_; } + ParamList paramList() { parse(); return paramList_; } + ParamType paramType() { parse(); return paramType_; } + ValueType valueType() { parse(); return valueType_; } + EntityType entityType() { parse(); return entityType_; } + + void setGroup (const QCString & s) + { group_ = s; assembled_ = false; } + + void setName (const QCString & s) + { name_ = s; assembled_ = false; } + + void setValue (Value *s) + { value_ = s; assembled_ = false; } + + void setParamList (const ParamList & l) + { paramList_ = l; assembled_ = false; } + + void clear (); + + private: + + QCString group_; + QCString name_; + QPtrList paramList_; + Value * value_; + + ParamType paramType_; + ValueType valueType_; + EntityType entityType_; +}; +} + +#endif diff --git a/kabc/vcard/include/VCardDateParam.h b/kabc/vcard/include/VCardDateParam.h new file mode 100644 index 0000000..21ac1f1 --- a/dev/null +++ b/kabc/vcard/include/VCardDateParam.h @@ -0,0 +1,44 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef DATEPARAM_H +#define DATEPARAM_H + +#include + +#include + +namespace VCARD +{ + +class DateParam : public Param +{ + +#include "DateParam-generated.h" + + private: +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardDateValue.h b/kabc/vcard/include/VCardDateValue.h new file mode 100644 index 0000000..c248966 --- a/dev/null +++ b/kabc/vcard/include/VCardDateValue.h @@ -0,0 +1,99 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef DATEVALUE_H +#define DATEVALUE_H + +#include +#include + +#include + +namespace VCARD +{ + +class DateValue : public Value +{ +#include "DateValue-generated.h" + + DateValue( + unsigned int year, + unsigned int month, + unsigned int day, + unsigned int hour = 0, + unsigned int minute = 0, + unsigned int second = 0, + double secFrac = 0, + bool zonePositive = true, + unsigned int zoneHour = 0, + unsigned int zoneMinute = 0); + + DateValue(const QDate &); + DateValue(const QDateTime &); + + DateValue *clone(); + + bool hasTime(); + + unsigned int year(); + unsigned int month(); + unsigned int day(); + unsigned int hour(); + unsigned int minute(); + unsigned int second(); + double secondFraction(); + bool zonePositive(); + unsigned int zoneHour(); + unsigned int zoneMinute(); + + void setYear (unsigned int); + void setMonth (unsigned int); + void setDay (unsigned int); + void setHour (unsigned int); + void setMinute (unsigned int); + void setSecond (unsigned int); + void setSecondFraction (double); + void setZonePositive (bool); + void setZoneHour (unsigned int); + void setZoneMinute (unsigned int); + + QDate qdate(); + QTime qtime(); + QDateTime qdt(); + + private: + + unsigned int year_, month_, day_, + hour_, minute_, second_, + zoneHour_, zoneMinute_; + + double secFrac_; + + bool zonePositive_; + + bool hasTime_; +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardDefines.h b/kabc/vcard/include/VCardDefines.h new file mode 100644 index 0000000..dd38ae2 --- a/dev/null +++ b/kabc/vcard/include/VCardDefines.h @@ -0,0 +1,52 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1998 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef VCARD_DEFINES_H +#define VCARD_DEFINES_H + +#include + +#ifdef VCARD_DEBUG +#define vDebug(a) kdDebug(5710) << a << endl; +#else +#define vDebug(a) +#endif + +#if 0 +#ifndef NDEBUG +# include +# include +# ifdef __GNUG__ +# define vDebug(a) cerr << className() << ":" << __FUNCTION__ << " (" \ + << __LINE__ << "): " << QCString((a)).data() << endl; +# else +# define vDebug(a) cerr << className() << ": " \ + << QCString((a)).data() << endl; +# endif +#else +# define vDebug(a) +#endif +#endif + +#endif // Included this file + diff --git a/kabc/vcard/include/VCardEmailParam.h b/kabc/vcard/include/VCardEmailParam.h new file mode 100644 index 0000000..98d1b30 --- a/dev/null +++ b/kabc/vcard/include/VCardEmailParam.h @@ -0,0 +1,56 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef EMAILPARAM_H +#define EMAILPARAM_H + +#include + +#include + +namespace VCARD +{ + +class EmailParam : public Param +{ + +#include "EmailParam-generated.h" + + QCString emailType() { parse(); return emailType_; } + bool pref() { parse(); return pref_; } + + void setEmailType(const QCString & s) + { emailType_ = s; assembled_ = false; } + + void setPref(bool b) + { pref_ = b; assembled_ = false; } + + private: + + QCString emailType_; + bool pref_; +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardEntity.h b/kabc/vcard/include/VCardEntity.h new file mode 100644 index 0000000..3c945b5 --- a/dev/null +++ b/kabc/vcard/include/VCardEntity.h @@ -0,0 +1,67 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef ENTITY_H +#define ENTITY_H + +#include + +namespace VCARD +{ + +class Entity +{ + public: + + Entity(); + Entity(const Entity & e); + Entity(const QCString & s); + + virtual Entity & operator = (const Entity & e); + virtual Entity & operator = (const QCString & s); + + virtual bool operator == (Entity & e); + virtual bool operator != (Entity & e); + virtual bool operator == (const QCString & s); + virtual bool operator != (const QCString & s); + + virtual ~Entity(); + + QCString asString(); + + virtual void parse(); + virtual void assemble(); + + virtual void _parse() = 0; + virtual void _assemble() = 0; + + protected: + + QCString strRep_; + bool parsed_; + bool assembled_; +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardEnum.h b/kabc/vcard/include/VCardEnum.h new file mode 100644 index 0000000..b4e4094 --- a/dev/null +++ b/kabc/vcard/include/VCardEnum.h @@ -0,0 +1,120 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef ENUM_H +#define ENUM_H + +#include + +namespace VCARD +{ + +extern const QCString paramNames []; + +enum EntityType { + EntityName, + EntityProfile, + EntitySource, + EntityFullName, + EntityN, + EntityNickname, + EntityPhoto, + EntityBirthday, + EntityAddress, + EntityLabel, + EntityTelephone, + EntityEmail, + EntityMailer, + EntityTimeZone, + EntityGeo, + EntityTitle, + EntityRole, + EntityLogo, + EntityAgent, + EntityOrganisation, + EntityCategories, + EntityNote, + EntityProductID, + EntityRevision, + EntitySortString, + EntitySound, + EntityUID, + EntityURL, + EntityVersion, + EntityClass, + EntityKey, + EntityExtension, + EntityUnknown +}; + +enum ValueType { + ValueSound, + ValueAgent, + ValueAddress, + ValueTel, + ValueTextBin, + ValueOrg, + ValueN, + ValueUTC, + ValueURI, + ValueClass, + ValueFloat, + ValueImage, + ValueDate, + ValueTextList, + ValueText, + ValueGeo, + ValueUnknown +}; + +enum ParamType { + ParamUnknown, + ParamNone, + ParamSource, + ParamText, + ParamImage, + ParamDate, + ParamAddrText, + ParamTel, + ParamEmail, + ParamMailer, + ParamAgent, + ParamTextBin, + ParamTextNS, + ParamSound +}; + +extern const ParamType paramTypesTable[]; + +ParamType EntityTypeToParamType(EntityType); +ValueType EntityTypeToValueType(EntityType); +QCString EntityTypeToParamName(EntityType); +EntityType EntityNameToEntityType(const QCString &); + +char * encodeBase64(const char *, unsigned long, unsigned long &); +char * decodeBase64(const char *, unsigned long, unsigned long &); + +} + +#endif + diff --git a/kabc/vcard/include/VCardFloatValue.h b/kabc/vcard/include/VCardFloatValue.h new file mode 100644 index 0000000..69fdc22 --- a/dev/null +++ b/kabc/vcard/include/VCardFloatValue.h @@ -0,0 +1,51 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef FLOATVALUE_H +#define FLOATVALUE_H + +#include + +#include + +namespace VCARD +{ + +class FloatValue : public Value +{ + +#include "FloatValue-generated.h" + + FloatValue(float); + + float value(); + void setValue(float); + + private: + + float value_; +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardGeoValue.h b/kabc/vcard/include/VCardGeoValue.h new file mode 100644 index 0000000..662761c --- a/dev/null +++ b/kabc/vcard/include/VCardGeoValue.h @@ -0,0 +1,49 @@ +/* + This file is part of libvcard. + Copyright (c) 2002 Tobias Koenig + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef GEOVALUE_H +#define GEOVALUE_H + +#include + +namespace VCARD +{ + +class GeoValue : public Value +{ + +#include "GeoValue-generated.h" + + GeoValue *clone(); + + void setLatitude( float lat ) { latitude_ = lat; assembled_ = false; } + void setLongitude( float lon ) { longitude_ = lon; assembled_ = false; } + + float latitude() { parse(); return latitude_; } + float longitude() { parse(); return longitude_; } + + private: + float latitude_; + float longitude_; +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardGroup.h b/kabc/vcard/include/VCardGroup.h new file mode 100644 index 0000000..ff775fb --- a/dev/null +++ b/kabc/vcard/include/VCardGroup.h @@ -0,0 +1,39 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef GROUP_H +#define GROUP_H + +#include + +namespace VCARD +{ + +class Group : public Entity +{ +#include "Group-generated.h" +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardImageParam.h b/kabc/vcard/include/VCardImageParam.h new file mode 100644 index 0000000..ce99ccc --- a/dev/null +++ b/kabc/vcard/include/VCardImageParam.h @@ -0,0 +1,44 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef IMGPARAM_H +#define IMGPARAM_H + +#include + +#include + +namespace VCARD +{ + +class ImageParam : public Param +{ + +#include "ImageParam-generated.h" + + private: +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardImageValue.h b/kabc/vcard/include/VCardImageValue.h new file mode 100644 index 0000000..6ce0371 --- a/dev/null +++ b/kabc/vcard/include/VCardImageValue.h @@ -0,0 +1,44 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef IMAGEVALUE_H +#define IMAGEVALUE_H + +#include + +#include + +namespace VCARD +{ + +class ImageValue : public Value +{ + +#include "ImageValue-generated.h" + + private: +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardImgValue.h b/kabc/vcard/include/VCardImgValue.h new file mode 100644 index 0000000..b09ad64 --- a/dev/null +++ b/kabc/vcard/include/VCardImgValue.h @@ -0,0 +1,39 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef IMGVALUE_H +#define IMGVALUE_H + +#include + +namespace VCARD +{ + +class ImgValue : public Value +{ +#include "ImgValue-generated.h" +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardLangValue.h b/kabc/vcard/include/VCardLangValue.h new file mode 100644 index 0000000..991ceed --- a/dev/null +++ b/kabc/vcard/include/VCardLangValue.h @@ -0,0 +1,51 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef LANGVALUE_H +#define LANGVALUE_H + +#include +#include + +#include + +namespace VCARD +{ + +class LangValue : public Value +{ +#include "LangValue-generated.h" + + QCString primary(); + QStrList subtags(); + + void setPrimary(const QCString &); + void setSubTags(const QStrList &); + + QCString primary_; + QStrList subtags_; +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardNValue.h b/kabc/vcard/include/VCardNValue.h new file mode 100644 index 0000000..306821b --- a/dev/null +++ b/kabc/vcard/include/VCardNValue.h @@ -0,0 +1,56 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef NVALUE_H +#define NVALUE_H + +#include + +namespace VCARD +{ + +class NValue : public Value +{ +#include "NValue-generated.h" + NValue *clone(); + + QCString family() { parse(); return family_; } + QCString given() { parse(); return given_; } + QCString middle() { parse(); return middle_; } + QCString prefix() { parse(); return prefix_; } + QCString suffix() { parse(); return suffix_; } + + void setFamily (const QCString & s) { family_ = s; assembled_ = false; } + void setGiven (const QCString & s) { given_ = s; assembled_ = false; } + void setMiddle (const QCString & s) { middle_ = s; assembled_ = false; } + void setPrefix (const QCString & s) { prefix_ = s; assembled_ = false; } + void setSuffix (const QCString & s) { suffix_ = s; assembled_ = false; } + + private: + + QCString family_, given_, middle_, prefix_, suffix_; +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardOrgValue.h b/kabc/vcard/include/VCardOrgValue.h new file mode 100644 index 0000000..c4f3f25 --- a/dev/null +++ b/kabc/vcard/include/VCardOrgValue.h @@ -0,0 +1,50 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef ORGVALUE_H +#define ORGVALUE_H + +#include +#include + +#include + +namespace VCARD +{ + +class OrgValue : public Value +{ + +#include "OrgValue-generated.h" + + unsigned int numValues(); + QCString value(unsigned int); + + private: + + QStrList valueList_; +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardParam.h b/kabc/vcard/include/VCardParam.h new file mode 100644 index 0000000..b61ce5c --- a/dev/null +++ b/kabc/vcard/include/VCardParam.h @@ -0,0 +1,59 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef PARAM_H +#define PARAM_H + +#include +#include + +#include + +namespace VCARD +{ + +class Param : public Entity +{ + +#include "Param-generated.h" + + Param(const QCString &name, const QCString &value); + + void setName(const QCString &); + void setValue(const QCString &); + + QCString name(); + QCString value(); + + private: + + QCString name_; + QCString value_; +}; + +typedef QPtrList ParamList; +typedef QPtrListIterator ParamListIterator; + +} + +#endif diff --git a/kabc/vcard/include/VCardPhoneNumberValue.h b/kabc/vcard/include/VCardPhoneNumberValue.h new file mode 100644 index 0000000..a567bdc --- a/dev/null +++ b/kabc/vcard/include/VCardPhoneNumberValue.h @@ -0,0 +1,39 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef PHONENUMBERVALUE_H +#define PHONENUMBERVALUE_H + +#include + +namespace VCARD +{ + +class PhoneNumberValue : public Value +{ +#include "PhoneNumberValue-generated.h" +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardRToken.h b/kabc/vcard/include/VCardRToken.h new file mode 100644 index 0000000..2f95f1b --- a/dev/null +++ b/kabc/vcard/include/VCardRToken.h @@ -0,0 +1,38 @@ +/* + + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef RTOKEN_H +#define RTOKEN_H + +#include + +namespace VCARD +{ + +Q_UINT32 RTokenise(const char * str, const char * delim, QStrList & l); + +} + +#endif + diff --git a/kabc/vcard/include/VCardSndValue.h b/kabc/vcard/include/VCardSndValue.h new file mode 100644 index 0000000..ce56221 --- a/dev/null +++ b/kabc/vcard/include/VCardSndValue.h @@ -0,0 +1,39 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef SNDVALUE_H +#define SNDVALUE_H + +#include + +namespace VCARD +{ + +class SndValue : public Value +{ +#include "SndValue-generated.h" +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardSoundValue.h b/kabc/vcard/include/VCardSoundValue.h new file mode 100644 index 0000000..994f55e --- a/dev/null +++ b/kabc/vcard/include/VCardSoundValue.h @@ -0,0 +1,44 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef SOUNDVALUE_H +#define SOUNDVALUE_H + +#include + +#include + +namespace VCARD +{ + +class SoundValue : public Value +{ + +#include "SoundValue-generated.h" + + private: +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardSourceParam.h b/kabc/vcard/include/VCardSourceParam.h new file mode 100644 index 0000000..887ea20 --- a/dev/null +++ b/kabc/vcard/include/VCardSourceParam.h @@ -0,0 +1,58 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef SOURCEPARAM_H +#define SOURCEPARAM_H + +#include + +#include + +namespace VCARD +{ + +class SourceParam : public Param +{ + +#include "SourceParam-generated.h" + + enum SourceParamType { TypeUnknown, TypeValue, TypeContext, TypeX }; + + SourceParamType type() { parse(); return type_;} + QCString par() { parse(); return par_; } + QCString val() { parse(); return val_; } + + void setType(SourceParamType t) { type_ = t; assembled_ = false; } + void setPar(const QCString & s) { par_ = s; assembled_ = false; } + void setVal(const QCString & s) { val_ = s; assembled_ = false; } + + private: + + SourceParamType type_; + // May be "VALUE = uri" or "CONTEXT = word" or "x-name = *SAFE-CHAR" + QCString par_, val_; // Sub-parameter, value +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardTelParam.h b/kabc/vcard/include/VCardTelParam.h new file mode 100644 index 0000000..27d7dcc --- a/dev/null +++ b/kabc/vcard/include/VCardTelParam.h @@ -0,0 +1,51 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef TELPARAM_H +#define TELPARAM_H + +#include + +#include + +namespace VCARD +{ + +class TelParam : public Param +{ +#include "TelParam-generated.h" + + enum TelType { + TelHome, TelWork, TelPref, TelVoice, TelFex, TelMsg, TelCell, + TelPager, TelBBS, TelModem, TelCar, TelISDN, TelVideo, TelPCS, + TelIANA, TelX + }; + + private: + + QPtrList types_; +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardTelValue.h b/kabc/vcard/include/VCardTelValue.h new file mode 100644 index 0000000..9cf5a98 --- a/dev/null +++ b/kabc/vcard/include/VCardTelValue.h @@ -0,0 +1,44 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef TELVALUE_H +#define TELVALUE_H + +#include + +#include + +namespace VCARD +{ + +class TelValue : public Value +{ + +#include "TelValue-generated.h" + + private: +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardTextBinParam.h b/kabc/vcard/include/VCardTextBinParam.h new file mode 100644 index 0000000..31dec86 --- a/dev/null +++ b/kabc/vcard/include/VCardTextBinParam.h @@ -0,0 +1,44 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef TEXTBINPARAM_H +#define TEXTBINPARAM_H + +#include + +#include + +namespace VCARD +{ + +class TextBinParam : public Param +{ + +#include "TextBinParam-generated.h" + + private: +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardTextBinValue.h b/kabc/vcard/include/VCardTextBinValue.h new file mode 100644 index 0000000..8d44fdf --- a/dev/null +++ b/kabc/vcard/include/VCardTextBinValue.h @@ -0,0 +1,67 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef TEXTBINVALUE_H +#define TEXTBINVALUE_H + +#include + +#include + +namespace VCARD +{ + +class TextBinValue : public Value +{ + +#include "TextBinValue-generated.h" + + TextBinValue *clone(); + + bool isBinary() { parse(); return mIsBinary_; } + QByteArray data() { parse(); return mData_; } + QString url() { parse(); return mUrl_; } + + void setData( const QByteArray &data ) + { + mData_ = data; + mIsBinary_ = true; + assembled_ = false; + } + + void setUrl( const QString &url ) + { + mUrl_ = url; + mIsBinary_ = false; + assembled_ = false; + } + + private: + int mIsBinary_; + QByteArray mData_; + QString mUrl_; +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardTextListValue.h b/kabc/vcard/include/VCardTextListValue.h new file mode 100644 index 0000000..8e47af5 --- a/dev/null +++ b/kabc/vcard/include/VCardTextListValue.h @@ -0,0 +1,51 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef TEXTLISTVALUE_H +#define TEXTLISTVALUE_H + +#include + +#include + +#include + +namespace VCARD +{ + +class TextListValue : public Value +{ + +#include "TextListValue-generated.h" + + unsigned int numValues(); + QCString value(unsigned int); + + private: + + QStrList valueList_; +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardTextParam.h b/kabc/vcard/include/VCardTextParam.h new file mode 100644 index 0000000..08b5f57 --- a/dev/null +++ b/kabc/vcard/include/VCardTextParam.h @@ -0,0 +1,44 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef TEXTPARAM_H +#define TEXTPARAM_H + +#include + +#include + +namespace VCARD +{ + +class TextParam : public Param +{ + +#include "TextParam-generated.h" + + private: +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardTextValue.h b/kabc/vcard/include/VCardTextValue.h new file mode 100644 index 0000000..afe8753 --- a/dev/null +++ b/kabc/vcard/include/VCardTextValue.h @@ -0,0 +1,41 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef TEXTVALUE_H +#define TEXTVALUE_H + +#include + +namespace VCARD +{ + +class TextValue : public Value +{ +#include "TextValue-generated.h" + + TextValue *clone(); +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardURIValue.h b/kabc/vcard/include/VCardURIValue.h new file mode 100644 index 0000000..5fd7184 --- a/dev/null +++ b/kabc/vcard/include/VCardURIValue.h @@ -0,0 +1,52 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef URIVALUE_H +#define URIVALUE_H + +#include + +namespace VCARD +{ + +class URIValue : public Value +{ +#include "URIValue-generated.h" + + URIValue(const QCString & scheme, const QCString & schemeSpecificPart); + + QCString scheme(); + QCString schemeSpecificPart(); + + void setScheme (const QCString &); + void setSchemeSpecificPart (const QCString &); + + private: + + QCString scheme_; + QCString schemeSpecificPart_; +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardUTCValue.h b/kabc/vcard/include/VCardUTCValue.h new file mode 100644 index 0000000..ff695e0 --- a/dev/null +++ b/kabc/vcard/include/VCardUTCValue.h @@ -0,0 +1,58 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef UTCVALUE_H +#define UTCVALUE_H + +#include + +#include + +namespace VCARD +{ + +class UTCValue : public Value +{ + +#include "UTCValue-generated.h" + + UTCValue *clone(); + + void setPositive( int p ) { positive_ = p; assembled_ = false; } + void setHour( int h ) { hour_ = h; assembled_ = false; } + void setMinute( int m ) { minute_ = m; assembled_ = false; } + + bool positive() { parse(); return positive_; } + unsigned int hour() { parse(); return hour_; } + unsigned int minute() { parse(); return minute_; } + + private: + + bool positive_; + unsigned int hour_; + unsigned int minute_; +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardVCard.h b/kabc/vcard/include/VCardVCard.h new file mode 100644 index 0000000..5dec166 --- a/dev/null +++ b/kabc/vcard/include/VCardVCard.h @@ -0,0 +1,63 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef VCARD_VCARD_H +#define VCARD_VCARD_H + +#include +#include + +#include +#include +#include + +namespace VCARD +{ + +class VCard : public Entity +{ + +#include "VCard-generated.h" + + bool has(EntityType); + bool has(const QCString &); + + void add(const ContentLine &); + void add(const QCString &); + + ContentLine * contentLine(EntityType); + ContentLine * contentLine(const QCString &); + + QCString group() { parse(); return group_; } + + QPtrList contentLineList() { parse(); return contentLineList_; } + + private: + + QCString group_; + QPtrList contentLineList_; +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardVCardEntity.h b/kabc/vcard/include/VCardVCardEntity.h new file mode 100644 index 0000000..47ba370 --- a/dev/null +++ b/kabc/vcard/include/VCardVCardEntity.h @@ -0,0 +1,56 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef VCARD_ENTITY_H +#define VCARD_ENTITY_H + +#include +#include + +#include +#include +#include + +namespace VCARD +{ + +typedef QPtrList VCardList; +typedef QPtrListIterator VCardListIterator; + +class VCardEntity : public Entity +{ + +#include "VCardEntity-generated.h" + + void setCardList(const VCardList & l); + VCardList & cardList(); + + private: + + VCardList cardList_; + +}; + +} + +#endif diff --git a/kabc/vcard/include/VCardValue.h b/kabc/vcard/include/VCardValue.h new file mode 100644 index 0000000..7cfe4a0 --- a/dev/null +++ b/kabc/vcard/include/VCardValue.h @@ -0,0 +1,46 @@ +/* + libvcard - vCard parsing library for vCard version 3.0 + + Copyright (C) 1999 Rik Hemsley rik@kde.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef VALUE_H +#define VALUE_H + +#include + +#include + +namespace VCARD +{ + +class Value : public Entity +{ +#include "Value-generated.h" + + virtual Value *clone() { return new Value( *this ); } +}; + +typedef QPtrList ValueList; +typedef QPtrListIterator ValueListIterator; + +} + +#endif diff --git a/kabc/vcard/include/generated/AdrParam-generated.h b/kabc/vcard/include/generated/AdrParam-generated.h new file mode 100644 index 0000000..3e265d8 --- a/dev/null +++ b/kabc/vcard/include/generated/AdrParam-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +AdrParam(); +AdrParam(const AdrParam&); +AdrParam(const QCString&); +AdrParam & operator = (AdrParam&); +AdrParam & operator = (const QCString&); +bool operator ==(AdrParam&); +bool operator !=(AdrParam& x) {return !(*this==x);} +bool operator ==(const QCString& s) {AdrParam a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~AdrParam(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "AdrParam"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/AdrValue-generated.h b/kabc/vcard/include/generated/AdrValue-generated.h new file mode 100644 index 0000000..e1d93e4 --- a/dev/null +++ b/kabc/vcard/include/generated/AdrValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +AdrValue(); +AdrValue(const AdrValue&); +AdrValue(const QCString&); +AdrValue & operator = (AdrValue&); +AdrValue & operator = (const QCString&); +bool operator ==(AdrValue&); +bool operator !=(AdrValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {AdrValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~AdrValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "AdrValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/AgentParam-generated.h b/kabc/vcard/include/generated/AgentParam-generated.h new file mode 100644 index 0000000..6423867 --- a/dev/null +++ b/kabc/vcard/include/generated/AgentParam-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +AgentParam(); +AgentParam(const AgentParam&); +AgentParam(const QCString&); +AgentParam & operator = (AgentParam&); +AgentParam & operator = (const QCString&); +bool operator ==(AgentParam&); +bool operator !=(AgentParam& x) {return !(*this==x);} +bool operator ==(const QCString& s) {AgentParam a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~AgentParam(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "AgentParam"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/AgentValue-generated.h b/kabc/vcard/include/generated/AgentValue-generated.h new file mode 100644 index 0000000..76bb81c --- a/dev/null +++ b/kabc/vcard/include/generated/AgentValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +AgentValue(); +AgentValue(const AgentValue&); +AgentValue(const QCString&); +AgentValue & operator = (AgentValue&); +AgentValue & operator = (const QCString&); +bool operator ==(AgentValue&); +bool operator !=(AgentValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {AgentValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~AgentValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "AgentValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/ClassValue-generated.h b/kabc/vcard/include/generated/ClassValue-generated.h new file mode 100644 index 0000000..df4ed5f --- a/dev/null +++ b/kabc/vcard/include/generated/ClassValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +ClassValue(); +ClassValue(const ClassValue&); +ClassValue(const QCString&); +ClassValue & operator = (ClassValue&); +ClassValue & operator = (const QCString&); +bool operator ==(ClassValue&); +bool operator !=(ClassValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {ClassValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~ClassValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "ClassValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/ContentLine-generated.h b/kabc/vcard/include/generated/ContentLine-generated.h new file mode 100644 index 0000000..9efe273 --- a/dev/null +++ b/kabc/vcard/include/generated/ContentLine-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +ContentLine(); +ContentLine(const ContentLine&); +ContentLine(const QCString&); +ContentLine & operator = (ContentLine&); +ContentLine & operator = (const QCString&); +bool operator ==(ContentLine&); +bool operator !=(ContentLine& x) {return !(*this==x);} +bool operator ==(const QCString& s) {ContentLine a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~ContentLine(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "ContentLine"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/DateParam-generated.h b/kabc/vcard/include/generated/DateParam-generated.h new file mode 100644 index 0000000..ff1da58 --- a/dev/null +++ b/kabc/vcard/include/generated/DateParam-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +DateParam(); +DateParam(const DateParam&); +DateParam(const QCString&); +DateParam & operator = (DateParam&); +DateParam & operator = (const QCString&); +bool operator ==(DateParam&); +bool operator !=(DateParam& x) {return !(*this==x);} +bool operator ==(const QCString& s) {DateParam a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~DateParam(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "DateParam"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/DateValue-generated.h b/kabc/vcard/include/generated/DateValue-generated.h new file mode 100644 index 0000000..a382823 --- a/dev/null +++ b/kabc/vcard/include/generated/DateValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +DateValue(); +DateValue(const DateValue&); +DateValue(const QCString&); +DateValue & operator = (DateValue&); +DateValue & operator = (const QCString&); +bool operator ==(DateValue&); +bool operator !=(DateValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {DateValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~DateValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "DateValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/EmailParam-generated.h b/kabc/vcard/include/generated/EmailParam-generated.h new file mode 100644 index 0000000..428a6fc --- a/dev/null +++ b/kabc/vcard/include/generated/EmailParam-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +EmailParam(); +EmailParam(const EmailParam&); +EmailParam(const QCString&); +EmailParam & operator = (EmailParam&); +EmailParam & operator = (const QCString&); +bool operator ==(EmailParam&); +bool operator !=(EmailParam& x) {return !(*this==x);} +bool operator ==(const QCString& s) {EmailParam a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~EmailParam(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "EmailParam"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/FloatValue-generated.h b/kabc/vcard/include/generated/FloatValue-generated.h new file mode 100644 index 0000000..cac55cf --- a/dev/null +++ b/kabc/vcard/include/generated/FloatValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +FloatValue(); +FloatValue(const FloatValue&); +FloatValue(const QCString&); +FloatValue & operator = (FloatValue&); +FloatValue & operator = (const QCString&); +bool operator ==(FloatValue&); +bool operator !=(FloatValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {FloatValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~FloatValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "FloatValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/GeoValue-generated.h b/kabc/vcard/include/generated/GeoValue-generated.h new file mode 100644 index 0000000..594f3ad --- a/dev/null +++ b/kabc/vcard/include/generated/GeoValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +GeoValue(); +GeoValue(const GeoValue&); +GeoValue(const QCString&); +GeoValue & operator = (GeoValue&); +GeoValue & operator = (const QCString&); +bool operator ==(GeoValue&); +bool operator !=(GeoValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {GeoValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~GeoValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "GeoValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/Group-generated.h b/kabc/vcard/include/generated/Group-generated.h new file mode 100644 index 0000000..f39302d --- a/dev/null +++ b/kabc/vcard/include/generated/Group-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +Group(); +Group(const Group&); +Group(const QCString&); +Group & operator = (Group&); +Group & operator = (const QCString&); +bool operator ==(Group&); +bool operator !=(Group& x) {return !(*this==x);} +bool operator ==(const QCString& s) {Group a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~Group(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "Group"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/ImageParam-generated.h b/kabc/vcard/include/generated/ImageParam-generated.h new file mode 100644 index 0000000..81edfd2 --- a/dev/null +++ b/kabc/vcard/include/generated/ImageParam-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +ImageParam(); +ImageParam(const ImageParam&); +ImageParam(const QCString&); +ImageParam & operator = (ImageParam&); +ImageParam & operator = (const QCString&); +bool operator ==(ImageParam&); +bool operator !=(ImageParam& x) {return !(*this==x);} +bool operator ==(const QCString& s) {ImageParam a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~ImageParam(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "ImageParam"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/ImageValue-generated.h b/kabc/vcard/include/generated/ImageValue-generated.h new file mode 100644 index 0000000..5a2c493 --- a/dev/null +++ b/kabc/vcard/include/generated/ImageValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +ImageValue(); +ImageValue(const ImageValue&); +ImageValue(const QCString&); +ImageValue & operator = (ImageValue&); +ImageValue & operator = (const QCString&); +bool operator ==(ImageValue&); +bool operator !=(ImageValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {ImageValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~ImageValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "ImageValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/ImgParam-generated.h b/kabc/vcard/include/generated/ImgParam-generated.h new file mode 100644 index 0000000..46a6ca0 --- a/dev/null +++ b/kabc/vcard/include/generated/ImgParam-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +ImgParam(); +ImgParam(const ImgParam&); +ImgParam(const QCString&); +ImgParam & operator = (ImgParam&); +ImgParam & operator = (const QCString&); +bool operator ==(ImgParam&); +bool operator !=(ImgParam& x) {return !(*this==x);} +bool operator ==(const QCString& s) {ImgParam a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~ImgParam(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +virtual const char * className() const { return "ImgParam"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/ImgValue-generated.h b/kabc/vcard/include/generated/ImgValue-generated.h new file mode 100644 index 0000000..d75d545 --- a/dev/null +++ b/kabc/vcard/include/generated/ImgValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +ImgValue(); +ImgValue(const ImgValue&); +ImgValue(const QCString&); +ImgValue & operator = (ImgValue&); +ImgValue & operator = (const QCString&); +bool operator ==(ImgValue&); +bool operator !=(ImgValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {ImgValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~ImgValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +virtual const char * className() const { return "ImgValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/LangValue-generated.h b/kabc/vcard/include/generated/LangValue-generated.h new file mode 100644 index 0000000..23e138b --- a/dev/null +++ b/kabc/vcard/include/generated/LangValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +LangValue(); +LangValue(const LangValue&); +LangValue(const QCString&); +LangValue & operator = (LangValue&); +LangValue & operator = (const QCString&); +bool operator ==(LangValue&); +bool operator !=(LangValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {LangValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~LangValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "LangValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/NValue-generated.h b/kabc/vcard/include/generated/NValue-generated.h new file mode 100644 index 0000000..082c253 --- a/dev/null +++ b/kabc/vcard/include/generated/NValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +NValue(); +NValue(const NValue&); +NValue(const QCString&); +NValue & operator = (NValue&); +NValue & operator = (const QCString&); +bool operator ==(NValue&); +bool operator !=(NValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {NValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~NValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "NValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/Name-generated.h b/kabc/vcard/include/generated/Name-generated.h new file mode 100644 index 0000000..0e69abd --- a/dev/null +++ b/kabc/vcard/include/generated/Name-generated.h @@ -0,0 +1,22 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +V_Name(); +V_Name(const V_Name&); +V_Name(const QCString&); +V_Name & operator = (V_Name&); +V_Name & operator = (const QCString&); +bool operator ==(V_Name&); +bool operator !=(V_Name& x) {return !(*this==x);} +bool operator ==(const QCString& s) {V_Name a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~V_Name(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/OrgValue-generated.h b/kabc/vcard/include/generated/OrgValue-generated.h new file mode 100644 index 0000000..51eb1b7 --- a/dev/null +++ b/kabc/vcard/include/generated/OrgValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +OrgValue(); +OrgValue(const OrgValue&); +OrgValue(const QCString&); +OrgValue & operator = (OrgValue&); +OrgValue & operator = (const QCString&); +bool operator ==(OrgValue&); +bool operator !=(OrgValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {OrgValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~OrgValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "OrgValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/Param-generated.h b/kabc/vcard/include/generated/Param-generated.h new file mode 100644 index 0000000..cf4666a --- a/dev/null +++ b/kabc/vcard/include/generated/Param-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +Param(); +Param(const Param&); +Param(const QCString&); +Param & operator = (Param&); +Param & operator = (const QCString&); +bool operator ==(Param&); +bool operator !=(Param& x) {return !(*this==x);} +bool operator ==(const QCString& s) {Param a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~Param(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "Param"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/ParamName-generated.h b/kabc/vcard/include/generated/ParamName-generated.h new file mode 100644 index 0000000..ef673c3 --- a/dev/null +++ b/kabc/vcard/include/generated/ParamName-generated.h @@ -0,0 +1,22 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +V_ParamName(); +V_ParamName(const V_ParamName&); +V_ParamName(const QCString&); +V_ParamName & operator = (V_ParamName&); +V_ParamName & operator = (const QCString&); +bool operator ==(V_ParamName&); +bool operator !=(V_ParamName& x) {return !(*this==x);} +bool operator ==(const QCString& s) {V_ParamName a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~V_ParamName(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/ParamValue-generated.h b/kabc/vcard/include/generated/ParamValue-generated.h new file mode 100644 index 0000000..e73500f --- a/dev/null +++ b/kabc/vcard/include/generated/ParamValue-generated.h @@ -0,0 +1,22 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +V_ParamValue(); +V_ParamValue(const V_ParamValue&); +V_ParamValue(const QCString&); +V_ParamValue & operator = (V_ParamValue&); +V_ParamValue & operator = (const QCString&); +bool operator ==(V_ParamValue&); +bool operator !=(V_ParamValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {V_ParamValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~V_ParamValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/PhoneNumberValue-generated.h b/kabc/vcard/include/generated/PhoneNumberValue-generated.h new file mode 100644 index 0000000..1320f18 --- a/dev/null +++ b/kabc/vcard/include/generated/PhoneNumberValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +PhoneNumberValue(); +PhoneNumberValue(const PhoneNumberValue&); +PhoneNumberValue(const QCString&); +PhoneNumberValue & operator = (PhoneNumberValue&); +PhoneNumberValue & operator = (const QCString&); +bool operator ==(PhoneNumberValue&); +bool operator !=(PhoneNumberValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {PhoneNumberValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~PhoneNumberValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "PhoneNumberValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/SoundValue-generated.h b/kabc/vcard/include/generated/SoundValue-generated.h new file mode 100644 index 0000000..a9ab2e8 --- a/dev/null +++ b/kabc/vcard/include/generated/SoundValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +SoundValue(); +SoundValue(const SoundValue&); +SoundValue(const QCString&); +SoundValue & operator = (SoundValue&); +SoundValue & operator = (const QCString&); +bool operator ==(SoundValue&); +bool operator !=(SoundValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {SoundValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~SoundValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "SoundValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/SourceParam-generated.h b/kabc/vcard/include/generated/SourceParam-generated.h new file mode 100644 index 0000000..75fefb8 --- a/dev/null +++ b/kabc/vcard/include/generated/SourceParam-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +SourceParam(); +SourceParam(const SourceParam&); +SourceParam(const QCString&); +SourceParam & operator = (SourceParam&); +SourceParam & operator = (const QCString&); +bool operator ==(SourceParam&); +bool operator !=(SourceParam& x) {return !(*this==x);} +bool operator ==(const QCString& s) {SourceParam a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~SourceParam(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "SourceParam"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/TelParam-generated.h b/kabc/vcard/include/generated/TelParam-generated.h new file mode 100644 index 0000000..3ee77cc --- a/dev/null +++ b/kabc/vcard/include/generated/TelParam-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +TelParam(); +TelParam(const TelParam&); +TelParam(const QCString&); +TelParam & operator = (TelParam&); +TelParam & operator = (const QCString&); +bool operator ==(TelParam&); +bool operator !=(TelParam& x) {return !(*this==x);} +bool operator ==(const QCString& s) {TelParam a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~TelParam(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "TelParam"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/TelValue-generated.h b/kabc/vcard/include/generated/TelValue-generated.h new file mode 100644 index 0000000..3213e1c --- a/dev/null +++ b/kabc/vcard/include/generated/TelValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +TelValue(); +TelValue(const TelValue&); +TelValue(const QCString&); +TelValue & operator = (TelValue&); +TelValue & operator = (const QCString&); +bool operator ==(TelValue&); +bool operator !=(TelValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {TelValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~TelValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "TelValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/TextBinParam-generated.h b/kabc/vcard/include/generated/TextBinParam-generated.h new file mode 100644 index 0000000..d075c10 --- a/dev/null +++ b/kabc/vcard/include/generated/TextBinParam-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +TextBinParam(); +TextBinParam(const TextBinParam&); +TextBinParam(const QCString&); +TextBinParam & operator = (TextBinParam&); +TextBinParam & operator = (const QCString&); +bool operator ==(TextBinParam&); +bool operator !=(TextBinParam& x) {return !(*this==x);} +bool operator ==(const QCString& s) {TextBinParam a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~TextBinParam(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "TextBinParam"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/TextBinValue-generated.h b/kabc/vcard/include/generated/TextBinValue-generated.h new file mode 100644 index 0000000..e9553ac --- a/dev/null +++ b/kabc/vcard/include/generated/TextBinValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +TextBinValue(); +TextBinValue(const TextBinValue&); +TextBinValue(const QCString&); +TextBinValue & operator = (TextBinValue&); +TextBinValue & operator = (const QCString&); +bool operator ==(TextBinValue&); +bool operator !=(TextBinValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {TextBinValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~TextBinValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "TextBinValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/TextListValue-generated.h b/kabc/vcard/include/generated/TextListValue-generated.h new file mode 100644 index 0000000..9f46124 --- a/dev/null +++ b/kabc/vcard/include/generated/TextListValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +TextListValue(); +TextListValue(const TextListValue&); +TextListValue(const QCString&); +TextListValue & operator = (TextListValue&); +TextListValue & operator = (const QCString&); +bool operator ==(TextListValue&); +bool operator !=(TextListValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {TextListValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~TextListValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "TextListValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/TextNSParam-generated.h b/kabc/vcard/include/generated/TextNSParam-generated.h new file mode 100644 index 0000000..d7f58ca --- a/dev/null +++ b/kabc/vcard/include/generated/TextNSParam-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +TextNSParam(); +TextNSParam(const TextNSParam&); +TextNSParam(const QCString&); +TextNSParam & operator = (TextNSParam&); +TextNSParam & operator = (const QCString&); +bool operator ==(TextNSParam&); +bool operator !=(TextNSParam& x) {return !(*this==x);} +bool operator ==(const QCString& s) {TextNSParam a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~TextNSParam(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "TextNSParam"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/TextParam-generated.h b/kabc/vcard/include/generated/TextParam-generated.h new file mode 100644 index 0000000..154e1bf --- a/dev/null +++ b/kabc/vcard/include/generated/TextParam-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +TextParam(); +TextParam(const TextParam&); +TextParam(const QCString&); +TextParam & operator = (TextParam&); +TextParam & operator = (const QCString&); +bool operator ==(TextParam&); +bool operator !=(TextParam& x) {return !(*this==x);} +bool operator ==(const QCString& s) {TextParam a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~TextParam(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "TextParam"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/TextValue-generated.h b/kabc/vcard/include/generated/TextValue-generated.h new file mode 100644 index 0000000..e1c4dcc --- a/dev/null +++ b/kabc/vcard/include/generated/TextValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +TextValue(); +TextValue(const TextValue&); +TextValue(const QCString&); +TextValue & operator = (TextValue&); +TextValue & operator = (const QCString&); +bool operator ==(TextValue&); +bool operator !=(TextValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {TextValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~TextValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "TextValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/URIValue-generated.h b/kabc/vcard/include/generated/URIValue-generated.h new file mode 100644 index 0000000..dbcb5c1 --- a/dev/null +++ b/kabc/vcard/include/generated/URIValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +URIValue(); +URIValue(const URIValue&); +URIValue(const QCString&); +URIValue & operator = (URIValue&); +URIValue & operator = (const QCString&); +bool operator ==(URIValue&); +bool operator !=(URIValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {URIValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~URIValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "URIValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/UTCValue-generated.h b/kabc/vcard/include/generated/UTCValue-generated.h new file mode 100644 index 0000000..46e447b --- a/dev/null +++ b/kabc/vcard/include/generated/UTCValue-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +UTCValue(); +UTCValue(const UTCValue&); +UTCValue(const QCString&); +UTCValue & operator = (UTCValue&); +UTCValue & operator = (const QCString&); +bool operator ==(UTCValue&); +bool operator !=(UTCValue& x) {return !(*this==x);} +bool operator ==(const QCString& s) {UTCValue a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~UTCValue(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "UTCValue"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/VCard-generated.h b/kabc/vcard/include/generated/VCard-generated.h new file mode 100644 index 0000000..4d7d96d --- a/dev/null +++ b/kabc/vcard/include/generated/VCard-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +VCard(); +VCard(const VCard&); +VCard(const QCString&); +VCard & operator = (VCard&); +VCard & operator = (const QCString&); +bool operator ==(VCard&); +bool operator !=(VCard& x) {return !(*this==x);} +bool operator ==(const QCString& s) {VCard a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~VCard(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "VCard"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/VCardEntity-generated.h b/kabc/vcard/include/generated/VCardEntity-generated.h new file mode 100644 index 0000000..9f2dfbc --- a/dev/null +++ b/kabc/vcard/include/generated/VCardEntity-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +VCardEntity(); +VCardEntity(const VCardEntity&); +VCardEntity(const QCString&); +VCardEntity & operator = (VCardEntity&); +VCardEntity & operator = (const QCString&); +bool operator ==(VCardEntity&); +bool operator !=(VCardEntity& x) {return !(*this==x);} +bool operator ==(const QCString& s) {VCardEntity a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~VCardEntity(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "VCardEntity"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/Value-generated.h b/kabc/vcard/include/generated/Value-generated.h new file mode 100644 index 0000000..7afac34 --- a/dev/null +++ b/kabc/vcard/include/generated/Value-generated.h @@ -0,0 +1,23 @@ +// XXX Automatically generated. DO NOT EDIT! XXX // + +public: +Value(); +Value(const Value&); +Value(const QCString&); +Value & operator = (Value&); +Value & operator = (const QCString&); +bool operator ==(Value&); +bool operator !=(Value& x) {return !(*this==x);} +bool operator ==(const QCString& s) {Value a(s);return(*this==a);} +bool operator != (const QCString& s) {return !(*this == s);} + +virtual ~Value(); +void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} + +void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} + +void _parse(); +void _assemble(); +const char * className() const { return "Value"; } + +// End of automatically generated code // diff --git a/kabc/vcard/include/generated/generate b/kabc/vcard/include/generated/generate new file mode 100644 index 0000000..926dbf1 --- a/dev/null +++ b/kabc/vcard/include/generated/generate @@ -0,0 +1,2 @@ +#!/bin/sh +cat headerBodies | awk -f generateHeaders.awk diff --git a/kabc/vcard/include/generated/generateHeaders.awk b/kabc/vcard/include/generated/generateHeaders.awk new file mode 100644 index 0000000..1053144 --- a/dev/null +++ b/kabc/vcard/include/generated/generateHeaders.awk @@ -0,0 +1,40 @@ +#!/bin/awk -f + +{ + outfile = $1 "-generated.h" + name = $1 + + OFS="" + + print "// XXX Automatically generated. DO NOT EDIT! XXX //\n" > outfile + + if ($2 == "v") { pre = "virtual " } else { pre = "" } + + print "public:" >> outfile + print name "();" >> outfile + print name "(const " name "&);" >> outfile + print name "(const QCString&);" >> outfile + print pre name " & operator = (" name "&);" >> outfile + print pre name " & operator = (const QCString&);" >> outfile + print pre "bool operator ==(" name "&);" >> outfile + print pre "bool operator !=(" name "& x) {return !(*this==x);}" \ + >> outfile + print pre "bool operator ==(const QCString& s) {" name " a(s);" \ + "return(*this==a);} " >> outfile + print pre "bool operator != (const QCString& s) {return !(*this == s);}\n" \ + >> outfile + print "virtual ~" name "();" >> outfile + print pre "void parse() " \ + "{if(!parsed_) _parse();parsed_=true;assembled_=false;}\n" \ + >> outfile + print pre "void assemble() " \ + "{if(assembled_) return;parse();_assemble();assembled_=true;}\n" \ + >> outfile + print pre "void _parse();" >> outfile + print pre "void _assemble();" >> outfile + print pre "const char * className() const { return \"" name "\"; }" \ + >> outfile + + print "\n// End of automatically generated code //" >> outfile +} + diff --git a/kabc/vcard/include/generated/headerBodies b/kabc/vcard/include/generated/headerBodies new file mode 100644 index 0000000..5e77b2b --- a/dev/null +++ b/kabc/vcard/include/generated/headerBodies @@ -0,0 +1,34 @@ +AdrParam Param +AdrValue Value +AgentParam Param +ContentLine Entity +DateParam Param +DateValue Value +EmailParam Param +GeoValue Value +Group Entity +ImageParam Param +ImageValue Value +LangValue Value +NValue Value +Param Entity +PhoneNumberValue Value +SourceParam Param +TelParam Param +TextParam Param +TextNSParam Param +TextValue Value +TextBinParam Param +URIValue Value +VCard Entity +VCardEntity Entity +Value Entity +SoundValue Value +AgentValue Value +TelValue Value +TextBinValue Value +OrgValue Value +UTCValue Value +ClassValue Value +FloatValue Value +TextListValue Value diff --git a/kabc/vcard/testread.cpp b/kabc/vcard/testread.cpp new file mode 100644 index 0000000..919c661 --- a/dev/null +++ b/kabc/vcard/testread.cpp @@ -0,0 +1,129 @@ +#include +#include +#include + +#include +#include + +#include + +using namespace std; + +int main(int argc, char * argv[]) +{ + if (argc != 2) { + cerr << "Usage: " << argv[0] << " " << endl; + exit(1); + } + + QFile f(argv[1]); + + QCString str; + + if (!f.open(IO_ReadOnly)) { + cerr << "Couldn't open file \"" << argv[1] << endl; + exit(1); + } + + QTextStream t(&f); + + while (!t.eof()) + str += t.readLine().utf8() + '\n'; + + using namespace VCARD; + + // Iterate through all vCards in the file. + + cout << "--------- begin ----------" << endl; + cout << str.data(); + cout << "--------- end ----------" << endl; + + VCardEntity e(str); + + VCardListIterator it(e.cardList()); + + for (; it.current(); ++it) { + + cerr << "****************** VCARD ********************" << endl; + + // Create a vcard using the string representation. + VCard & v (*it.current()); + + if (v.has(EntityEmail)) { + cerr << "Email parameter found" << endl; + + QCString s = v.contentLine(EntityEmail)->value()->asString(); + + cerr << "Email value == " << s << endl; + } + + if (v.has(EntityNickname)) { + cerr << "Nickname parameter found" << endl; + + cerr << "Nickname value == " << + v.contentLine(EntityNickname)->value()->asString() << + endl; + } + + if (v.has(EntityRevision)) { + + cerr << "Revision parameter found" << endl; + + DateValue * d = + (DateValue *) + v.contentLine(EntityRevision)->value(); + + assert(d != 0); + + cerr << "Revision date: " << endl; + cerr << "Day : " << d->day() << endl; + cerr << "Month : " << d->month() << endl; + cerr << "Year : " << d->year() << endl; + + if (d->hasTime()) { + cerr << "Revision date has a time component" << endl; + cerr << "Revision time: " << endl; + cerr << "Hour : " << d->hour() << endl; + cerr << "Minute : " << d->minute() << endl; + cerr << "Second : " << d->second() << endl; + + } + else cerr << "Revision date does NOT have a time component" << endl; + } + + if (v.has(EntityURL)) { + cerr << "URL Parameter found" << endl; + + cerr << "URL Value == " << + v.contentLine(EntityURL)->value()->asString() << + endl; + + URIValue * urlVal = + (URIValue *)v.contentLine(EntityURL)->value(); + + assert(urlVal != 0); + + cerr << "URL scheme == " << + urlVal->scheme() << endl; + + cerr << "URL scheme specific part == " << + urlVal->schemeSpecificPart() << endl; + } + + if (v.has(EntityN)) { + cerr << "N Parameter found" << endl; + + NValue * n = + (NValue *)(v.contentLine(EntityN)->value()); + + cerr << "Family name == " << n->family() << endl; + cerr << "Given name == " << n->given() << endl; + cerr << "Middle name == " << n->middle() << endl; + cerr << "Prefix == " << n->prefix() << endl; + cerr << "Suffix == " << n->suffix() << endl; + } + + cerr << "***************** END VCARD ******************" << endl; + } +} + diff --git a/kabc/vcard/testwrite.cpp b/kabc/vcard/testwrite.cpp new file mode 100644 index 0000000..e4bbe7b --- a/dev/null +++ b/kabc/vcard/testwrite.cpp @@ -0,0 +1,41 @@ +#include +#include +#include +#include +#include + +#include + +int main(int argc,char **argv) +{ + KAboutData aboutData("testwrite",I18N_NOOP("TestWritevCard"),"0.1"); + KCmdLineArgs::init(argc,argv,&aboutData); + + KApplication app; + + kdDebug() << "Test Write VCard" << endl; + + using namespace VCARD; + + VCard v; + + ContentLine cl1; + cl1.setName(EntityTypeToParamName(EntityName)); + cl1.setValue(new TextValue("Hans Wurst")); + v.add(cl1); + + ContentLine cl2; + cl2.setName(EntityTypeToParamName(EntityTelephone)); + cl2.setValue(new TelValue("12345")); + ParamList p; + p.append( new TelParam("home") ); + p.append( new TelParam("fax") ); + cl2.setParamList( p ); + v.add(cl2); + + QCString str = v.asString(); + + kdDebug() << "--- VCard begin ---" << endl + << str + << "--- VCard end ---" << endl; +} diff --git a/kabc/vcard/vCard-all.cpp b/kabc/vcard/vCard-all.cpp new file mode 100644 index 0000000..07bbcd2 --- a/dev/null +++ b/kabc/vcard/vCard-all.cpp @@ -0,0 +1,37 @@ +#include "AdrParam.cpp" +#include "AdrValue.cpp" +#include "AgentParam.cpp" +#include "AgentValue.cpp" +#include "ClassValue.cpp" +#include "ContentLine.cpp" +#include "DateParam.cpp" +#include "DateValue.cpp" +#include "EmailParam.cpp" +#include "Entity.cpp" +#include "Enum.cpp" +#include "FloatValue.cpp" +#include "GeoValue.cpp" +#include "ImageParam.cpp" +#include "ImageValue.cpp" +#include "ImgValue.cpp" +#include "LangValue.cpp" +#include "NValue.cpp" +#include "OrgValue.cpp" +#include "Param.cpp" +#include "PhoneNumberValue.cpp" +#include "RToken.cpp" +#include "SoundValue.cpp" +#include "SourceParam.cpp" +#include "TelParam.cpp" +#include "TelValue.cpp" +#include "TextBinParam.cpp" +#include "TextBinValue.cpp" +#include "TextListValue.cpp" +#include "TextParam.cpp" +#include "TextValue.cpp" +#include "URIValue.cpp" +#include "UTCValue.cpp" +#include "VCard.cpp" +#include "VCardEntity.cpp" +#include "Value.cpp" + -- cgit v0.9.0.2