2 commits - c++/lib c++/tests
Christian Mollekopf
mollekopf at kolabsys.com
Wed Mar 7 01:24:51 CET 2012
c++/lib/calendaring.cpp | 4 -
c++/lib/calendaring.h | 2
c++/lib/incidence_p.h | 12 +--
c++/lib/kolabcontact.cpp | 26 ++++----
c++/lib/kolabcontact.h | 16 ++--
c++/lib/kolabcontainers.cpp | 68 ++++++++++-----------
c++/lib/kolabcontainers.h | 26 ++++----
c++/lib/kolabevent.cpp | 34 +++++-----
c++/lib/kolabevent.h | 32 ++++-----
c++/lib/kolabformat.i | 5 -
c++/lib/kolabjournal.cpp | 12 +--
c++/lib/kolabjournal.h | 12 +--
c++/lib/kolabkcalconversion.cpp | 18 ++---
c++/lib/kolabkcalconversion.h | 4 -
c++/lib/kolabtodo.cpp | 34 +++++-----
c++/lib/kolabtodo.h | 32 ++++-----
c++/lib/python/test.py | 2
c++/lib/utils.cpp | 4 -
c++/lib/utils.h | 2
c++/lib/xcalconversions.h | 46 +++++++-------
c++/lib/xcardconversions.h | 38 ++++++-----
c++/tests/bindingstest.cpp | 26 ++++----
c++/tests/conversiontest.cpp | 59 +++++++++++++-----
c++/tests/conversiontest.h | 1
c++/tests/kcalconversiontest.cpp | 126 +++++++++++++++++++--------------------
c++/tests/serializers.h | 8 +-
26 files changed, 340 insertions(+), 309 deletions(-)
New commits:
commit dec7cef0d58938c0b1a67fe59995bddf449aae84
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Wed Mar 7 01:24:43 2012 +0100
Fix xcard date serialization + tests.
diff --git a/c++/lib/xcardconversions.h b/c++/lib/xcardconversions.h
index fd6f808..be129a0 100644
--- a/c++/lib/xcardconversions.h
+++ b/c++/lib/xcardconversions.h
@@ -120,7 +120,13 @@ std::string fromDate(const KoDateTime &dt)
WARNING("fromDate called on date time value");
}
std::stringstream s;
- s << dt.year() << dt.month() << dt.day();
+ s.fill('0');
+ s.width(4);
+ s << dt.year();
+ s.width(2);
+ s << dt.month();
+ s.width(2);
+ s << dt.day();
return s.str();
}
diff --git a/c++/tests/conversiontest.cpp b/c++/tests/conversiontest.cpp
index cc885aa..bc2ebcc 100644
--- a/c++/tests/conversiontest.cpp
+++ b/c++/tests/conversiontest.cpp
@@ -11,8 +11,16 @@
Q_DECLARE_METATYPE(Kolab::Duration);
Q_DECLARE_METATYPE(Kolab::DayPos);
Q_DECLARE_METATYPE(Kolab::KoDateTime);
+Q_DECLARE_METATYPE(Kolab::ErrorSeverity);
using namespace Kolab::XCAL;
+
+void ConversionTest::dateComparatorTest()
+{
+ QVERIFY( !(Kolab::KoDateTime(2001, 01, 02, 03, 04 ,05, false) == Kolab::KoDateTime()));
+ QVERIFY( Kolab::KoDateTime(2001, 01, 02, 03, 04 ,05, false) == Kolab::KoDateTime(2001, 01, 02, 03, 04 ,05, false));
+}
+
void ConversionTest::durationParserTest_data()
{
@@ -23,6 +31,7 @@ void ConversionTest::durationParserTest_data()
QTest::newRow("Day") << Kolab::Duration(1,2,3,4, false) << "+P1DT2H3M4S";
QTest::newRow("Week") << Kolab::Duration(1, false) << "+P1W";
QTest::newRow("Week Multidigit, negative") << Kolab::Duration(23, true) << "-P23W";
+ Kolab::Utils::clearErrors();
}
void ConversionTest::durationParserTest()
@@ -31,6 +40,7 @@ void ConversionTest::durationParserTest()
QFETCH(Kolab::Duration, expected);
const Kolab::Duration result = toDuration(string.toStdString());
QCOMPARE(result, expected);
+ QCOMPARE(Kolab::Utils::getError(), Kolab::NoError);
}
void ConversionTest::durationSerializerTest_data()
@@ -43,6 +53,7 @@ void ConversionTest::durationSerializerTest_data()
QTest::newRow("Week positive") << "P1W" << Kolab::Duration(1, false);
QTest::newRow("Week negative") << "-P3W" << Kolab::Duration(3, true);
QTest::newRow("Week Multidigit, negative") << "-P23W" << Kolab::Duration(23, true);
+ Kolab::Utils::clearErrors();
}
void ConversionTest::durationSerializerTest()
@@ -51,6 +62,7 @@ void ConversionTest::durationSerializerTest()
QFETCH(QString, expected);
const std::string result = fromDuration(duration);
QCOMPARE(QString::fromStdString(result), expected);
+ QCOMPARE(Kolab::Utils::getError(), Kolab::NoError);
}
@@ -63,6 +75,7 @@ void ConversionTest::dayPosParserTest_data()
QTest::newRow("positive with +") << Kolab::DayPos(15, Kolab::Wednesday) << "+15WE";
QTest::newRow("negative") << Kolab::DayPos(-15, Kolab::Wednesday) << "-15WE";
QTest::newRow("all occurrences") << Kolab::DayPos(0, Kolab::Wednesday) << "WE";
+ Kolab::Utils::clearErrors();
}
void ConversionTest::dayPosParserTest()
@@ -71,6 +84,7 @@ void ConversionTest::dayPosParserTest()
QFETCH(Kolab::DayPos, expected);
const Kolab::DayPos result = toDayPos(string.toStdString());
QCOMPARE(result, expected);
+ QCOMPARE(Kolab::Utils::getError(), Kolab::NoError);
}
void ConversionTest::dayPosSerializerTest_data()
@@ -81,6 +95,7 @@ void ConversionTest::dayPosSerializerTest_data()
QTest::newRow("pos") << "15WE" << Kolab::DayPos(15, Kolab::Wednesday);
QTest::newRow("negative") << "-15WE" << Kolab::DayPos(-15, Kolab::Wednesday);
QTest::newRow("all occurrences") << "WE" << Kolab::DayPos(0, Kolab::Wednesday);
+ Kolab::Utils::clearErrors();
}
@@ -90,19 +105,22 @@ void ConversionTest::dayPosSerializerTest()
QFETCH(QString, expected);
const std::string result = fromDayPos(daypos);
QCOMPARE(QString::fromStdString(result), expected);
+ QCOMPARE(Kolab::Utils::getError(), Kolab::NoError);
}
void ConversionTest::xcardDateParserTest_data()
{
QTest::addColumn<QString>("input");
QTest::addColumn<Kolab::KoDateTime>("expected");
-
- QTest::newRow("datetime local") << "20010102T030405" << Kolab::KoDateTime(2001, 01, 02, 03, 04 ,05, false);
- QTest::newRow("datetime utc") << "20010102T030405Z" << Kolab::KoDateTime(2001, 01, 02, 03, 04 ,05, true);
- QTest::newRow("date only") << "20010102" << Kolab::KoDateTime(2001, 01, 02);
- QTest::newRow("fail 1 short") << "20010102T03040" << Kolab::KoDateTime();
- QTest::newRow("fail non utc") << "20010102T030401s" << Kolab::KoDateTime();
- QTest::newRow("fail no time") << "20010102T" << Kolab::KoDateTime();
+ QTest::addColumn<Kolab::ErrorSeverity>("errorState");
+
+ QTest::newRow("datetime local") << "20010102T030405" << Kolab::KoDateTime(2001, 01, 02, 03, 04 ,05, false) << Kolab::NoError;
+ QTest::newRow("datetime utc") << "20010102T030405Z" << Kolab::KoDateTime(2001, 01, 02, 03, 04 ,05, true) << Kolab::NoError;
+ QTest::newRow("date only") << "20010102" << Kolab::KoDateTime(2001, 01, 02) << Kolab::NoError;
+ QTest::newRow("fail 1 short") << "20010102T03040" << Kolab::KoDateTime() << Kolab::Error;
+ QTest::newRow("fail non utc") << "20010102T030401s" << Kolab::KoDateTime() << Kolab::Error;
+ QTest::newRow("fail no time") << "20010102T" << Kolab::KoDateTime() << Kolab::Error;
+ Kolab::Utils::clearErrors();
}
@@ -110,8 +128,10 @@ void ConversionTest::xcardDateParserTest()
{
QFETCH(QString, input);
QFETCH(Kolab::KoDateTime, expected);
+ QFETCH(Kolab::ErrorSeverity, errorState);
const Kolab::KoDateTime &dt = Kolab::XCARD::toDateTime(input.toStdString());
QCOMPARE(dt, expected);
+ QCOMPARE(Kolab::Utils::getError(), errorState);
}
void ConversionTest::xCardSerializerTest_data()
@@ -122,6 +142,7 @@ void ConversionTest::xCardSerializerTest_data()
QTest::newRow("datetime local") << "20010102T030405" << Kolab::KoDateTime(2001, 01, 02, 03, 04 ,05, false);
QTest::newRow("datetime utc") << "20010102T030405Z" << Kolab::KoDateTime(2001, 01, 02, 03, 04 ,05, true);
QTest::newRow("dateonly") << "20010102" << Kolab::KoDateTime(2001, 01, 02);
+ Kolab::Utils::clearErrors();
}
void ConversionTest::xCardSerializerTest()
@@ -130,6 +151,11 @@ void ConversionTest::xCardSerializerTest()
QFETCH(Kolab::KoDateTime, dt);
const std::string &s = Kolab::XCARD::fromDateTime(dt);
QCOMPARE(QString::fromStdString(s), expected);
+ if (dt.isDateOnly()) {
+ const std::string &s2 = Kolab::XCARD::fromDate(dt);
+ QCOMPARE(QString::fromStdString(s2), expected);
+ }
+ QCOMPARE(Kolab::Utils::getError(), Kolab::NoError);
}
void ConversionTest::uriInlineEncodingTest()
@@ -140,6 +166,7 @@ void ConversionTest::uriInlineEncodingTest()
const std::string &d = Kolab::Utils::uriInlineDecoding(s, mimetype);
QCOMPARE(mimetype, std::string("mimetype/mime"));
QCOMPARE(d, std::string("data"));
+ QCOMPARE(Kolab::Utils::getError(), Kolab::NoError);
}
void threadF()
diff --git a/c++/tests/conversiontest.h b/c++/tests/conversiontest.h
index 41eda33..e99bf0c 100644
--- a/c++/tests/conversiontest.h
+++ b/c++/tests/conversiontest.h
@@ -8,6 +8,7 @@ class ConversionTest : public QObject
{
Q_OBJECT
private slots:
+ void dateComparatorTest();
void durationParserTest_data();
void durationParserTest();
commit 727619895b2c2ca4985731f4af9efc9205ba59c5
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Wed Mar 7 00:34:13 2012 +0100
Renamed DateTime to KoDateTime.
BUG: 618
diff --git a/c++/lib/calendaring.cpp b/c++/lib/calendaring.cpp
index 60e4355..66ca61a 100644
--- a/c++/lib/calendaring.cpp
+++ b/c++/lib/calendaring.cpp
@@ -39,11 +39,11 @@ namespace Kolab {
return true;
}
- std::vector<Kolab::DateTime> timeInInterval(const Kolab::Event &e, const Kolab::DateTime &start, const Kolab::DateTime &end)
+ std::vector<Kolab::KoDateTime> timeInInterval(const Kolab::Event &e, const Kolab::KoDateTime &start, const Kolab::KoDateTime &end)
{
KCalCore::Event::Ptr k = KCalConversion::toKCalCore(e);
KCalCore::DateTimeList list = k->recurrence()->timesInInterval(KCalConversion::toDate(start), KCalConversion::toDate(end));
- std::vector<Kolab::DateTime> dtList;
+ std::vector<Kolab::KoDateTime> dtList;
foreach(const KDateTime &dt, list) {
dtList.push_back(KCalConversion::fromDate(dt));
}
diff --git a/c++/lib/calendaring.h b/c++/lib/calendaring.h
index 7ee946c..aad7d25 100644
--- a/c++/lib/calendaring.h
+++ b/c++/lib/calendaring.h
@@ -28,7 +28,7 @@ namespace Kolab {
*/
bool conflicts(const Kolab::Event &, const Kolab::Event &);
- std::vector<Kolab::DateTime> timeInInterval(const Kolab::Event &, const Kolab::DateTime &start, const Kolab::DateTime &end);
+ std::vector<Kolab::KoDateTime> timeInInterval(const Kolab::Event &, const Kolab::KoDateTime &start, const Kolab::KoDateTime &end);
};
};
diff --git a/c++/lib/incidence_p.h b/c++/lib/incidence_p.h
index 3595c4b..0534d57 100644
--- a/c++/lib/incidence_p.h
+++ b/c++/lib/incidence_p.h
@@ -32,15 +32,15 @@ namespace Kolab {
status(StatusUndefined){}
std::string uid;
- DateTime created;
- DateTime lastModified;
+ KoDateTime created;
+ KoDateTime lastModified;
int sequence;
Classification classification;
std::vector< std::string > categories;
std::vector< std::string > relatedTo;
- DateTime start;
+ KoDateTime start;
- DateTime recurrenceID;
+ KoDateTime recurrenceID;
bool thisAndFuture;
std::string summary;
std::string description;
@@ -48,8 +48,8 @@ namespace Kolab {
int priority;
Status status;
RecurrenceRule rrule;
- std::vector< DateTime > recurrenceDates;
- std::vector< DateTime > exceptionDates;
+ std::vector< KoDateTime > recurrenceDates;
+ std::vector< KoDateTime > exceptionDates;
std::string organizerEmail;
std::string organizerName;
Duration duration;
diff --git a/c++/lib/kolabcontact.cpp b/c++/lib/kolabcontact.cpp
index b4ee445..fc99d83 100644
--- a/c++/lib/kolabcontact.cpp
+++ b/c++/lib/kolabcontact.cpp
@@ -24,7 +24,7 @@ struct DistList::Private
Private() {}
std::string uid;
- DateTime lastModified;
+ KoDateTime lastModified;
std::vector< std::string > categories;
std::string name;
@@ -69,12 +69,12 @@ std::string DistList::uid() const
return d->uid;
}
-void DistList::setLastModified(const Kolab::DateTime &dt)
+void DistList::setLastModified(const Kolab::KoDateTime &dt)
{
d->lastModified = dt;
}
-DateTime DistList::lastModified() const
+KoDateTime DistList::lastModified() const
{
return d->lastModified;
}
@@ -125,8 +125,8 @@ struct Contact::Private
{}
std::string uid;
- DateTime created;
- DateTime lastModified;
+ KoDateTime created;
+ KoDateTime lastModified;
std::vector< std::string > categories;
std::string name;
@@ -139,8 +139,8 @@ struct Contact::Private
int addressPreferredIndex;
std::vector<std::string> nickNames;
std::vector<Related> relateds;
- DateTime bDay;
- DateTime anniversary;
+ KoDateTime bDay;
+ KoDateTime anniversary;
std::string photo;
std::string photoMimetype;
Gender gender;
@@ -193,12 +193,12 @@ std::string Contact::uid() const
return d->uid;
}
-void Contact::setLastModified(const Kolab::DateTime &dt)
+void Contact::setLastModified(const Kolab::KoDateTime &dt)
{
d->lastModified = dt;
}
-DateTime Contact::lastModified() const
+KoDateTime Contact::lastModified() const
{
return d->lastModified;
}
@@ -315,22 +315,22 @@ std::vector< Related > Contact::relateds() const
return d->relateds;
}
-void Contact::setBDay(const Kolab::DateTime &bday)
+void Contact::setBDay(const Kolab::KoDateTime &bday)
{
d->bDay = bday;
}
-DateTime Contact::bDay() const
+KoDateTime Contact::bDay() const
{
return d->bDay;
}
-void Contact::setAnniversary(const Kolab::DateTime& dt)
+void Contact::setAnniversary(const Kolab::KoDateTime& dt)
{
d->anniversary = dt;
}
-DateTime Contact::anniversary() const
+KoDateTime Contact::anniversary() const
{
return d->anniversary;
}
diff --git a/c++/lib/kolabcontact.h b/c++/lib/kolabcontact.h
index 1c8800f..5c74f7e 100644
--- a/c++/lib/kolabcontact.h
+++ b/c++/lib/kolabcontact.h
@@ -196,8 +196,8 @@ public:
void setUid(const std::string &);
std::string uid() const;
- void setLastModified(const DateTime &);
- DateTime lastModified() const;
+ void setLastModified(const KoDateTime &);
+ KoDateTime lastModified() const;
void setName(const std::string &);
std::string name() const;
@@ -225,8 +225,8 @@ public:
void setUid(const std::string &);
std::string uid() const;
- void setLastModified(const DateTime &);
- DateTime lastModified() const;
+ void setLastModified(const KoDateTime &);
+ KoDateTime lastModified() const;
void setCategories(const std::vector<std::string> &);
void addCategory(const std::string &);
@@ -260,11 +260,11 @@ public:
void setRelateds(const std::vector<Related> &);
std::vector<Related> relateds() const;
- void setBDay(const DateTime &);
- DateTime bDay() const;
+ void setBDay(const KoDateTime &);
+ KoDateTime bDay() const;
- void setAnniversary(const DateTime &);
- DateTime anniversary() const;
+ void setAnniversary(const KoDateTime &);
+ KoDateTime anniversary() const;
void setPhoto(const std::string &data, const std::string &mimetype);
std::string photo() const;
diff --git a/c++/lib/kolabcontainers.cpp b/c++/lib/kolabcontainers.cpp
index b458f94..17e1e4d 100644
--- a/c++/lib/kolabcontainers.cpp
+++ b/c++/lib/kolabcontainers.cpp
@@ -20,7 +20,7 @@
namespace Kolab {
-struct DateTime::Private {
+struct KoDateTime::Private {
Private()
: year(-1),
month(-1),
@@ -40,14 +40,14 @@ struct DateTime::Private {
std::string timezone;
};
-DateTime::DateTime()
-: d(new DateTime::Private())
+KoDateTime::KoDateTime()
+: d(new KoDateTime::Private())
{
}
-DateTime::DateTime(int year, int month, int day, int hour, int minute, int second, bool isUtc)
-: d(new DateTime::Private())
+KoDateTime::KoDateTime(int year, int month, int day, int hour, int minute, int second, bool isUtc)
+: d(new KoDateTime::Private())
{
d->year = year;
d->month = month;
@@ -58,8 +58,8 @@ DateTime::DateTime(int year, int month, int day, int hour, int minute, int secon
d->isUtc = isUtc;
}
-DateTime::DateTime(const std::string& timezone, int year, int month, int day, int hour, int minute, int second)
-: d(new DateTime::Private())
+KoDateTime::KoDateTime(const std::string& timezone, int year, int month, int day, int hour, int minute, int second)
+: d(new KoDateTime::Private())
{
d->year = year;
d->month = month;
@@ -70,32 +70,32 @@ DateTime::DateTime(const std::string& timezone, int year, int month, int day, in
d->timezone = timezone;
}
-DateTime::DateTime(int year, int month, int day)
-: d(new DateTime::Private())
+KoDateTime::KoDateTime(int year, int month, int day)
+: d(new KoDateTime::Private())
{
d->year = year;
d->month = month;
d->day = day;
}
-DateTime::DateTime(const Kolab::DateTime &other)
-: d(new DateTime::Private())
+KoDateTime::KoDateTime(const Kolab::KoDateTime &other)
+: d(new KoDateTime::Private())
{
*d = *other.d;
}
-DateTime::~DateTime()
+KoDateTime::~KoDateTime()
{
}
-void DateTime::operator=(const Kolab::DateTime &other)
+void KoDateTime::operator=(const Kolab::KoDateTime &other)
{
*d = *other.d;
}
-bool DateTime::operator==(const Kolab::DateTime &other) const
+bool KoDateTime::operator==(const Kolab::KoDateTime &other) const
{
if ( d->year == other.year() &&
d->month == other.month() &&
@@ -112,37 +112,37 @@ bool DateTime::operator==(const Kolab::DateTime &other) const
-int DateTime::year() const
+int KoDateTime::year() const
{
return d->year;
}
-int DateTime::month() const
+int KoDateTime::month() const
{
return d->month;
}
-int DateTime::day() const
+int KoDateTime::day() const
{
return d->day;
}
-int DateTime::hour() const
+int KoDateTime::hour() const
{
return d->hour;
}
-int DateTime::minute() const
+int KoDateTime::minute() const
{
return d->minute;
}
-int DateTime::second() const
+int KoDateTime::second() const
{
return d->second;
}
-bool DateTime::isDateOnly() const
+bool KoDateTime::isDateOnly() const
{
if ((d->hour < 0) && (d->minute < 0) && (d->second < 0)) {
return true;
@@ -150,38 +150,38 @@ bool DateTime::isDateOnly() const
return false;
}
-void DateTime::setDate(int year, int month, int day)
+void KoDateTime::setDate(int year, int month, int day)
{
d->year = year;
d->month = month;
d->day = day;
}
-void DateTime::setTime(int hour, int minute, int second)
+void KoDateTime::setTime(int hour, int minute, int second)
{
d->hour = hour;
d->minute = minute;
d->second = second;
}
-void DateTime::setTimezone(const std::string &tz)
+void KoDateTime::setTimezone(const std::string &tz)
{
d->timezone = tz;
}
-void DateTime::setUTC(bool utc)
+void KoDateTime::setUTC(bool utc)
{
d->isUtc = utc;
}
-bool DateTime::isUTC() const
+bool KoDateTime::isUTC() const
{
return d->isUtc;
}
-std::string DateTime::timezone() const
+std::string KoDateTime::timezone() const
{
return d->timezone;
}
-bool DateTime::isValid() const
+bool KoDateTime::isValid() const
{
return (d->year >= 0 && d->month >= 0 && d->day >= 0);
}
@@ -196,7 +196,7 @@ struct RecurrenceRule::Private
Frequency freq;
Weekday weekstart;
- DateTime end;
+ KoDateTime end;
int count;
int interval;
std::vector<int> bysecond;
@@ -271,12 +271,12 @@ Kolab::Weekday RecurrenceRule::weekStart() const
return d->weekstart;
}
-void RecurrenceRule::setEnd(const Kolab::DateTime &end)
+void RecurrenceRule::setEnd(const Kolab::KoDateTime &end)
{
d->end = end;
}
-DateTime RecurrenceRule::end() const
+KoDateTime RecurrenceRule::end() const
{
return d->end;
}
@@ -599,7 +599,7 @@ struct Alarm::Private
Attachment audioFile;
std::string summary;
std::vector<std::string> attendees;
- DateTime start;
+ KoDateTime start;
Duration relativeDuration;
Relative relativeTo;
Duration duration;
@@ -692,12 +692,12 @@ std::vector< std::string > Alarm::attendees() const
return d->attendees;
}
-void Alarm::setStart(const Kolab::DateTime &start)
+void Alarm::setStart(const Kolab::KoDateTime &start)
{
d->start = start;
}
-DateTime Alarm::start() const
+KoDateTime Alarm::start() const
{
return d->start;
}
diff --git a/c++/lib/kolabcontainers.h b/c++/lib/kolabcontainers.h
index f55a78d..78f4014 100644
--- a/c++/lib/kolabcontainers.h
+++ b/c++/lib/kolabcontainers.h
@@ -23,16 +23,16 @@
namespace Kolab {
-class DateTime {
+class KoDateTime {
public:
- DateTime();
- DateTime(int year, int month, int day, int hour, int minute, int second, bool isUtc=true);
- DateTime(const std::string &timezone, int year, int month, int day, int hour, int minute, int second);
- DateTime(int year, int month, int day);
- ~DateTime();
- DateTime(const DateTime &);
- void operator=(const DateTime &);
- bool operator==(const DateTime &) const;
+ KoDateTime();
+ KoDateTime(int year, int month, int day, int hour, int minute, int second, bool isUtc=true);
+ KoDateTime(const std::string &timezone, int year, int month, int day, int hour, int minute, int second);
+ KoDateTime(int year, int month, int day);
+ ~KoDateTime();
+ KoDateTime(const KoDateTime &);
+ void operator=(const KoDateTime &);
+ bool operator==(const KoDateTime &) const;
void setDate(int year, int month, int day);
@@ -201,8 +201,8 @@ public:
Duration relativeStart() const;
Relative relativeTo() const;
- void setStart(const DateTime &);
- DateTime start() const;
+ void setStart(const KoDateTime &);
+ KoDateTime start() const;
void setDuration(const Duration &, int numrepeat);
Duration duration() const;
@@ -243,8 +243,8 @@ public:
void setWeekStart(Weekday);
Weekday weekStart() const;
- void setEnd(const DateTime &);
- DateTime end() const;
+ void setEnd(const KoDateTime &);
+ KoDateTime end() const;
void setCount(int count);
int count() const;
diff --git a/c++/lib/kolabevent.cpp b/c++/lib/kolabevent.cpp
index 85d06f5..f608773 100644
--- a/c++/lib/kolabevent.cpp
+++ b/c++/lib/kolabevent.cpp
@@ -26,7 +26,7 @@ struct Event::Private: public PrivateIncidence
: PrivateIncidence(),
isTransparent(false){}
- DateTime end;
+ KoDateTime end;
bool isTransparent;
Duration duration;
std::vector< Event > exceptions;
@@ -70,22 +70,22 @@ std::string Event::uid() const
return d->uid;
}
-void Event::setCreated(const Kolab::DateTime &created)
+void Event::setCreated(const Kolab::KoDateTime &created)
{
d->created = created;
}
-DateTime Event::created() const
+KoDateTime Event::created() const
{
return d->created;
}
-void Event::setLastModified(const Kolab::DateTime &lastMod)
+void Event::setLastModified(const Kolab::KoDateTime &lastMod)
{
d->lastModified = lastMod;
}
-DateTime Event::lastModified() const
+KoDateTime Event::lastModified() const
{
return d->lastModified;
}
@@ -125,22 +125,22 @@ std::vector< std::string > Event::categories() const
return d->categories;
}
-void Event::setStart(const Kolab::DateTime &start)
+void Event::setStart(const Kolab::KoDateTime &start)
{
d->start = start;
}
-DateTime Event::start() const
+KoDateTime Event::start() const
{
return d->start;
}
-void Event::setEnd(const Kolab::DateTime &end)
+void Event::setEnd(const Kolab::KoDateTime &end)
{
d->end = end;
}
-DateTime Event::end() const
+KoDateTime Event::end() const
{
return d->end;
}
@@ -156,13 +156,13 @@ Duration Event::duration() const
}
-void Event::setRecurrenceID(const Kolab::DateTime &rID, bool thisandfuture)
+void Event::setRecurrenceID(const Kolab::KoDateTime &rID, bool thisandfuture)
{
d->recurrenceID = rID;
d->thisAndFuture = thisandfuture;
}
-DateTime Event::recurrenceID() const
+KoDateTime Event::recurrenceID() const
{
return d->recurrenceID;
}
@@ -232,32 +232,32 @@ RecurrenceRule Event::recurrenceRule() const
return d->rrule;
}
-void Event::setRecurrenceDates(const std::vector< DateTime > &dates)
+void Event::setRecurrenceDates(const std::vector< KoDateTime > &dates)
{
d->recurrenceDates = dates;
}
-void Event::addRecurrenceDate(const Kolab::DateTime &dt)
+void Event::addRecurrenceDate(const Kolab::KoDateTime &dt)
{
d->recurrenceDates.push_back(dt);
}
-std::vector< DateTime > Event::recurrenceDates() const
+std::vector< KoDateTime > Event::recurrenceDates() const
{
return d->recurrenceDates;
}
-void Event::setExceptionDates(const std::vector< DateTime > &dates)
+void Event::setExceptionDates(const std::vector< KoDateTime > &dates)
{
d->exceptionDates = dates;
}
-void Event::addExceptionDate(const Kolab::DateTime &dt)
+void Event::addExceptionDate(const Kolab::KoDateTime &dt)
{
d->exceptionDates.push_back(dt);
}
-std::vector< DateTime > Event::exceptionDates() const
+std::vector< KoDateTime > Event::exceptionDates() const
{
return d->exceptionDates;
}
diff --git a/c++/lib/kolabevent.h b/c++/lib/kolabevent.h
index 2b7d267..5e5573b 100644
--- a/c++/lib/kolabevent.h
+++ b/c++/lib/kolabevent.h
@@ -36,11 +36,11 @@ public:
void setUid(const std::string &);
std::string uid() const;
- void setCreated(const DateTime &);
- DateTime created() const;
+ void setCreated(const KoDateTime &);
+ KoDateTime created() const;
- void setLastModified(const DateTime &);
- DateTime lastModified() const;
+ void setLastModified(const KoDateTime &);
+ KoDateTime lastModified() const;
void setSequence(int);
int sequence() const;
@@ -52,11 +52,11 @@ public:
void addCategory(const std::string &);
std::vector<std::string> categories() const;
- void setStart(const DateTime &);
- DateTime start() const;
+ void setStart(const KoDateTime &);
+ KoDateTime start() const;
- void setEnd(const DateTime &);
- DateTime end() const;
+ void setEnd(const KoDateTime &);
+ KoDateTime end() const;
void setDuration(const Duration &);
Duration duration() const;
@@ -67,16 +67,16 @@ public:
void setRecurrenceRule(const RecurrenceRule &);
RecurrenceRule recurrenceRule() const;
- void setRecurrenceDates(const std::vector<DateTime> &);
- void addRecurrenceDate(const DateTime &);
- std::vector<DateTime> recurrenceDates() const;
+ void setRecurrenceDates(const std::vector<KoDateTime> &);
+ void addRecurrenceDate(const KoDateTime &);
+ std::vector<KoDateTime> recurrenceDates() const;
- void setExceptionDates(const std::vector<DateTime> &);
- void addExceptionDate(const DateTime &);
- std::vector<DateTime> exceptionDates() const;
+ void setExceptionDates(const std::vector<KoDateTime> &);
+ void addExceptionDate(const KoDateTime &);
+ std::vector<KoDateTime> exceptionDates() const;
- void setRecurrenceID(const DateTime &, bool thisandfuture);
- DateTime recurrenceID() const;
+ void setRecurrenceID(const KoDateTime &, bool thisandfuture);
+ KoDateTime recurrenceID() const;
bool thisAndFuture() const;
void setSummary(const std::string &);
diff --git a/c++/lib/kolabformat.i b/c++/lib/kolabformat.i
index 48c4706..34187f8 100644
--- a/c++/lib/kolabformat.i
+++ b/c++/lib/kolabformat.i
@@ -29,12 +29,9 @@ namespace std {
%template(vectorattendee) vector<Kolab::Attendee>;
%template(vectorrelated) vector<Kolab::Related>;
%template(vectortelephone) vector<Kolab::Telephone>;
- %template(vectordatetime) vector<Kolab::DateTime>;
+ %template(vectordatetime) vector<Kolab::KoDateTime>;
};
-/* Avoid clashes with native php/python containers */
-%rename(KolabDateTime) Kolab::DateTime;
-
%include "global_definitions.h"
%include "kolabcontainers.h"
%include "kolabevent.h"
diff --git a/c++/lib/kolabjournal.cpp b/c++/lib/kolabjournal.cpp
index b4c441e..6b8dab4 100644
--- a/c++/lib/kolabjournal.cpp
+++ b/c++/lib/kolabjournal.cpp
@@ -61,22 +61,22 @@ std::string Journal::uid() const
return d->uid;
}
-void Journal::setCreated(const Kolab::DateTime &created)
+void Journal::setCreated(const Kolab::KoDateTime &created)
{
d->created = created;
}
-DateTime Journal::created() const
+KoDateTime Journal::created() const
{
return d->created;
}
-void Journal::setLastModified(const Kolab::DateTime &lastMod)
+void Journal::setLastModified(const Kolab::KoDateTime &lastMod)
{
d->lastModified = lastMod;
}
-DateTime Journal::lastModified() const
+KoDateTime Journal::lastModified() const
{
return d->lastModified;
}
@@ -116,12 +116,12 @@ std::vector< std::string > Journal::categories() const
return d->categories;
}
-void Journal::setStart(const Kolab::DateTime &start)
+void Journal::setStart(const Kolab::KoDateTime &start)
{
d->start = start;
}
-DateTime Journal::start() const
+KoDateTime Journal::start() const
{
return d->start;
}
diff --git a/c++/lib/kolabjournal.h b/c++/lib/kolabjournal.h
index dc887b1..35c5bac 100644
--- a/c++/lib/kolabjournal.h
+++ b/c++/lib/kolabjournal.h
@@ -36,11 +36,11 @@ public:
void setUid(const std::string &);
std::string uid() const;
- void setCreated(const DateTime &);
- DateTime created() const;
+ void setCreated(const KoDateTime &);
+ KoDateTime created() const;
- void setLastModified(const DateTime &);
- DateTime lastModified() const;
+ void setLastModified(const KoDateTime &);
+ KoDateTime lastModified() const;
void setSequence(int);
int sequence() const;
@@ -52,8 +52,8 @@ public:
void addCategory(const std::string &);
std::vector<std::string> categories() const;
- void setStart(const DateTime &);
- DateTime start() const;
+ void setStart(const KoDateTime &);
+ KoDateTime start() const;
void setSummary(const std::string &);
std::string summary() const;
diff --git a/c++/lib/kolabkcalconversion.cpp b/c++/lib/kolabkcalconversion.cpp
index f3efd02..59e765d 100644
--- a/c++/lib/kolabkcalconversion.cpp
+++ b/c++/lib/kolabkcalconversion.cpp
@@ -27,7 +27,7 @@
namespace Kolab {
namespace KCalConversion {
-KDateTime toDate(const Kolab::DateTime &dt)
+KDateTime toDate(const Kolab::KoDateTime &dt)
{
KDateTime date;
if (!dt.isValid()) {
@@ -61,13 +61,13 @@ KDateTime toDate(const Kolab::DateTime &dt)
return date;
}
-DateTime fromDate(const KDateTime &dt)
+KoDateTime fromDate(const KDateTime &dt)
{
if (!dt.isValid()) {
// qDebug() << "invalid datetime converted";
- return DateTime();
+ return KoDateTime();
}
- DateTime date;
+ KoDateTime date;
if (dt.isDateOnly()) { //Date only
const QDate &d = dt.date();
date.setDate(d.year(), d.month(), d.day());
@@ -83,7 +83,7 @@ DateTime fromDate(const KDateTime &dt)
date.setTimezone(dt.timeZone().name().toStdString()); //FIXME use system independent name according to spec
} else if (dt.timeType() != KDateTime::ClockTime) {
qWarning() << "invalid timespec, assuming floating time" << dt.timeType();
- return DateTime();
+ return KoDateTime();
}
}
Q_ASSERT(date.isValid());
@@ -559,7 +559,7 @@ void setRecurrence(KCalCore::Incidence &e, const T &event)
defaultRR->setByMonths(QVector<int>::fromStdVector(rrule.bymonth()).toList());
}
}
- foreach (const Kolab::DateTime &dt, event.recurrenceDates()) {
+ foreach (const Kolab::KoDateTime &dt, event.recurrenceDates()) {
const KDateTime &date = toDate(dt);
if (date.isDateOnly()) {
e.recurrence()->addRDate(date.date());
@@ -567,7 +567,7 @@ void setRecurrence(KCalCore::Incidence &e, const T &event)
e.recurrence()->addRDateTime(date);
}
}
- foreach (const Kolab::DateTime &dt, event.exceptionDates()) {
+ foreach (const Kolab::KoDateTime &dt, event.exceptionDates()) {
const KDateTime &date = toDate(dt);
if (date.isDateOnly()) {
e.recurrence()->addExDate(date.date());
@@ -621,7 +621,7 @@ void getRecurrence(T &i, const I &e)
rrule.setBymonth(defaultRR->byMonths().toVector().toStdVector());
i.setRecurrenceRule(rrule);
- std::vector<Kolab::DateTime> rdates;
+ std::vector<Kolab::KoDateTime> rdates;
foreach (const KDateTime &dt, rec->rDateTimes()) {
rdates.push_back(fromDate(dt));
}
@@ -630,7 +630,7 @@ void getRecurrence(T &i, const I &e)
}
i.setRecurrenceDates(rdates);
- std::vector<Kolab::DateTime> exdates;
+ std::vector<Kolab::KoDateTime> exdates;
foreach (const KDateTime &dt, rec->exDateTimes()) {
exdates.push_back(fromDate(dt));
}
diff --git a/c++/lib/kolabkcalconversion.h b/c++/lib/kolabkcalconversion.h
index b440840..416809a 100644
--- a/c++/lib/kolabkcalconversion.h
+++ b/c++/lib/kolabkcalconversion.h
@@ -42,8 +42,8 @@ namespace Kolab {
KCalCore::Journal::Ptr toKCalCore(const Kolab::Journal &);
Kolab::Journal fromKCalCore(const KCalCore::Journal &);
- KDateTime toDate(const Kolab::DateTime &dt);
- DateTime fromDate(const KDateTime &dt);
+ KDateTime toDate(const Kolab::KoDateTime &dt);
+ KoDateTime fromDate(const KDateTime &dt);
};
};
diff --git a/c++/lib/kolabtodo.cpp b/c++/lib/kolabtodo.cpp
index 1a5072c..fb45934 100644
--- a/c++/lib/kolabtodo.cpp
+++ b/c++/lib/kolabtodo.cpp
@@ -27,7 +27,7 @@ struct Todo::Private: public PrivateIncidence
: PrivateIncidence(),
percentComplete(0){}
- DateTime due;
+ KoDateTime due;
int percentComplete;
};
@@ -68,22 +68,22 @@ std::string Todo::uid() const
return d->uid;
}
-void Todo::setCreated(const Kolab::DateTime &created)
+void Todo::setCreated(const Kolab::KoDateTime &created)
{
d->created = created;
}
-DateTime Todo::created() const
+KoDateTime Todo::created() const
{
return d->created;
}
-void Todo::setLastModified(const Kolab::DateTime &lastMod)
+void Todo::setLastModified(const Kolab::KoDateTime &lastMod)
{
d->lastModified = lastMod;
}
-DateTime Todo::lastModified() const
+KoDateTime Todo::lastModified() const
{
return d->lastModified;
}
@@ -138,33 +138,33 @@ std::vector< std::string > Todo::relatedTo() const
return d->relatedTo;
}
-void Todo::setStart(const Kolab::DateTime &start)
+void Todo::setStart(const Kolab::KoDateTime &start)
{
d->start = start;
}
-DateTime Todo::start() const
+KoDateTime Todo::start() const
{
return d->start;
}
-void Todo::setDue(const Kolab::DateTime &due)
+void Todo::setDue(const Kolab::KoDateTime &due)
{
d->due = due;
}
-DateTime Todo::due() const
+KoDateTime Todo::due() const
{
return d->due;
}
-void Todo::setRecurrenceID(const Kolab::DateTime &rID, bool thisandfuture)
+void Todo::setRecurrenceID(const Kolab::KoDateTime &rID, bool thisandfuture)
{
d->recurrenceID = rID;
d->thisAndFuture = thisandfuture;
}
-DateTime Todo::recurrenceID() const
+KoDateTime Todo::recurrenceID() const
{
return d->recurrenceID;
}
@@ -244,32 +244,32 @@ RecurrenceRule Todo::recurrenceRule() const
return d->rrule;
}
-void Todo::setRecurrenceDates(const std::vector< DateTime > &dates)
+void Todo::setRecurrenceDates(const std::vector< KoDateTime > &dates)
{
d->recurrenceDates = dates;
}
-void Todo::addRecurrenceDate(const Kolab::DateTime &dt)
+void Todo::addRecurrenceDate(const Kolab::KoDateTime &dt)
{
d->recurrenceDates.push_back(dt);
}
-std::vector< DateTime > Todo::recurrenceDates() const
+std::vector< KoDateTime > Todo::recurrenceDates() const
{
return d->recurrenceDates;
}
-void Todo::setExceptionDates(const std::vector< DateTime > &dates)
+void Todo::setExceptionDates(const std::vector< KoDateTime > &dates)
{
d->exceptionDates = dates;
}
-void Todo::addExceptionDate(const Kolab::DateTime &dt)
+void Todo::addExceptionDate(const Kolab::KoDateTime &dt)
{
d->exceptionDates.push_back(dt);
}
-std::vector< DateTime > Todo::exceptionDates() const
+std::vector< KoDateTime > Todo::exceptionDates() const
{
return d->exceptionDates;
}
diff --git a/c++/lib/kolabtodo.h b/c++/lib/kolabtodo.h
index 4ef087c..6ca67ed 100644
--- a/c++/lib/kolabtodo.h
+++ b/c++/lib/kolabtodo.h
@@ -37,11 +37,11 @@ public:
void setUid(const std::string &);
std::string uid() const;
- void setCreated(const DateTime &);
- DateTime created() const;
+ void setCreated(const KoDateTime &);
+ KoDateTime created() const;
- void setLastModified(const DateTime &);
- DateTime lastModified() const;
+ void setLastModified(const KoDateTime &);
+ KoDateTime lastModified() const;
void setSequence(int);
int sequence() const;
@@ -57,25 +57,25 @@ public:
void addRelatedTo(const std::string &);
std::vector<std::string> relatedTo() const;
- void setStart(const DateTime &);
- DateTime start() const;
+ void setStart(const KoDateTime &);
+ KoDateTime start() const;
- void setDue(const DateTime &);
- DateTime due() const;
+ void setDue(const KoDateTime &);
+ KoDateTime due() const;
void setRecurrenceRule(const RecurrenceRule &);
RecurrenceRule recurrenceRule() const;
- void setRecurrenceDates(const std::vector<DateTime> &);
- void addRecurrenceDate(const DateTime &);
- std::vector<DateTime> recurrenceDates() const;
+ void setRecurrenceDates(const std::vector<KoDateTime> &);
+ void addRecurrenceDate(const KoDateTime &);
+ std::vector<KoDateTime> recurrenceDates() const;
- void setExceptionDates(const std::vector<DateTime> &);
- void addExceptionDate(const DateTime &);
- std::vector<DateTime> exceptionDates() const;
+ void setExceptionDates(const std::vector<KoDateTime> &);
+ void addExceptionDate(const KoDateTime &);
+ std::vector<KoDateTime> exceptionDates() const;
- void setRecurrenceID(const DateTime &, bool thisandfuture);
- DateTime recurrenceID() const;
+ void setRecurrenceID(const KoDateTime &, bool thisandfuture);
+ KoDateTime recurrenceID() const;
bool thisAndFuture() const;
void setSummary(const std::string &);
diff --git a/c++/lib/python/test.py b/c++/lib/python/test.py
index 5bc9799..d4113ac 100644
--- a/c++/lib/python/test.py
+++ b/c++/lib/python/test.py
@@ -3,7 +3,7 @@ e = kolabformat.Event()
ex = e.exceptionDates()
ex.size()
-ex.push_back(kolabformat.DateTime(1,1,1))
+ex.push_back(kolabformat.KoDateTime(1,1,1))
ex.size()
e.exceptionDates().size()
e.setExceptionDates(ex)
diff --git a/c++/lib/utils.cpp b/c++/lib/utils.cpp
index 8789f23..d476dfd 100644
--- a/c++/lib/utils.cpp
+++ b/c++/lib/utils.cpp
@@ -98,13 +98,13 @@ std::string getUID(const std::string &s)
return s;
}
-DateTime getCurrentTime()
+KoDateTime getCurrentTime()
{
time_t rawtime;
struct tm * ptm;
time(&rawtime);
ptm = gmtime(&rawtime);
- return DateTime(ptm->tm_year+1900, ptm->tm_mon+1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec, true);
+ return KoDateTime(ptm->tm_year+1900, ptm->tm_mon+1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec, true);
}
diff --git a/c++/lib/utils.h b/c++/lib/utils.h
index 9a6a868..b7b69ea 100644
--- a/c++/lib/utils.h
+++ b/c++/lib/utils.h
@@ -31,7 +31,7 @@ namespace Kolab {
*/
std::string getUID(const std::string & = std::string());
-DateTime getCurrentTime();
+KoDateTime getCurrentTime();
void logMessage(const std::string &,const std::string &, int, ErrorSeverity s);
diff --git a/c++/lib/xcalconversions.h b/c++/lib/xcalconversions.h
index 9ba9cb5..932b000 100644
--- a/c++/lib/xcalconversions.h
+++ b/c++/lib/xcalconversions.h
@@ -420,20 +420,20 @@ icalendar_2_0::AttachPropType fromAttachment(const Kolab::Attachment &a)
return attachment;
}
-//==== DateTime ====
+//==== KoDateTime ====
-typedef boost::shared_ptr<DateTime> DateTimePtr;
+typedef boost::shared_ptr<KoDateTime> KoDateTimePtr;
- static DateTimePtr toDate(const xml_schema::date &dt)
+ static KoDateTimePtr toDate(const xml_schema::date &dt)
{
- DateTimePtr date(new DateTime());
+ KoDateTimePtr date(new KoDateTime());
date->setDate(dt.year(), dt.month(), dt.day());
return date;
}
- static DateTimePtr toDate(const xml_schema::date_time &dt)
+ static KoDateTimePtr toDate(const xml_schema::date_time &dt)
{
- DateTimePtr date(new DateTime());
+ KoDateTimePtr date(new KoDateTime());
date->setDate(dt.year(), dt.month(), dt.day());
date->setTime(dt.hours(), dt.minutes(), dt.seconds());
if (dt.zone_present()) {
@@ -442,7 +442,7 @@ typedef boost::shared_ptr<DateTime> DateTimePtr;
return date;
}
- static xml_schema::date_time fromDateTime(const DateTime &d)
+ static xml_schema::date_time fromDateTime(const KoDateTime &d)
{
xml_schema::date_time date(d.year(), d.month(), d.day(), d.hour(), d.minute(), d.second());
if (d.isUTC()) {
@@ -453,7 +453,7 @@ typedef boost::shared_ptr<DateTime> DateTimePtr;
return date;
}
- static xml_schema::date fromDate(const DateTime &d)
+ static xml_schema::date fromDate(const KoDateTime &d)
{
xml_schema::date date(d.year(), d.month(), d.day());
return date;
@@ -474,9 +474,9 @@ typedef boost::shared_ptr<DateTime> DateTimePtr;
return std::string();
}
-DateTimePtr toDate(const icalendar_2_0::DateDatetimePropertyType &dtProperty)
+KoDateTimePtr toDate(const icalendar_2_0::DateDatetimePropertyType &dtProperty)
{
- DateTimePtr date;
+ KoDateTimePtr date;
if (dtProperty.date_time()) {
date = toDate(*dtProperty.date_time());
} else if (dtProperty.date()) {
@@ -493,13 +493,13 @@ DateTimePtr toDate(const icalendar_2_0::DateDatetimePropertyType &dtProperty)
}
-DateTimePtr toDate(const icalendar_2_0::UtcDatetimePropertyType &dtProperty)
+KoDateTimePtr toDate(const icalendar_2_0::UtcDatetimePropertyType &dtProperty)
{
- DateTimePtr date;
+ KoDateTimePtr date;
if (dtProperty.date_time()) {
date = toDate(*dtProperty.date_time());
} else { //The utc-date-time element shouldn't even exist
- date = DateTimePtr(new DateTime());
+ date = KoDateTimePtr(new KoDateTime());
ERROR("This element shouldn't even be existing");
//TODO Implement anyways?
return date;
@@ -509,7 +509,7 @@ DateTimePtr toDate(const icalendar_2_0::UtcDatetimePropertyType &dtProperty)
}
template <typename I>
-std::auto_ptr<I> fromDate(const DateTime &dt)
+std::auto_ptr<I> fromDate(const KoDateTime &dt)
{
std::auto_ptr<I> ptr(new I);
if (dt.isDateOnly()) {
@@ -532,9 +532,9 @@ std::auto_ptr<I> fromDate(const DateTime &dt)
template <typename I>
-std::vector<DateTime> toDateTimeList(I datelistProperty)
+std::vector<KoDateTime> toDateTimeList(I datelistProperty)
{
- std::vector<DateTime> list;
+ std::vector<KoDateTime> list;
std::string tzid;
if (datelistProperty.parameters()) {
@@ -546,7 +546,7 @@ std::vector<DateTime> toDateTimeList(I datelistProperty)
}
} else if (!datelistProperty.date_time().empty()) {
BOOST_FOREACH(const xml_schema::date_time &d, datelistProperty.date_time()) {
- DateTimePtr date = toDate(d);
+ KoDateTimePtr date = toDate(d);
if (tzid.size()) {
date->setTimezone(tzid);
}
@@ -557,11 +557,11 @@ std::vector<DateTime> toDateTimeList(I datelistProperty)
}
template <typename I>
-std::auto_ptr<I> fromDateTimeList(const std::vector<DateTime> &dtlist)
+std::auto_ptr<I> fromDateTimeList(const std::vector<KoDateTime> &dtlist)
{
std::auto_ptr<I> ptr(new I);
- BOOST_FOREACH(const DateTime &dt, dtlist) {
+ BOOST_FOREACH(const KoDateTime &dt, dtlist) {
if (dt.isDateOnly()) {
ptr->date().push_back(fromDate(dt));
} else {
@@ -588,7 +588,7 @@ std::auto_ptr<I> fromDateTimeList(const std::vector<DateTime> &dtlist)
-//---- DateTime ----
+//---- KoDateTime ----
@@ -781,7 +781,7 @@ RecurrencePtr toRRule(const icalendar_2_0::RecurType &rrule)
RecurrencePtr r(new RecurrenceRule());
r->setFrequency(mapRecurrenceFrequency(rrule.freq()));
if (rrule.until()) {
- DateTimePtr date;
+ KoDateTimePtr date;
if ((*rrule.until()).date_time()) {
date = toDate(*(*rrule.until()).date_time());
} else if ((*rrule.until()).date()) {
@@ -839,7 +839,7 @@ void setIncidenceProperties(I &inc, const T &prop)
}
if (prop.dtstart()) {
- const DateTimePtr date = toDate(*prop.dtstart());
+ const KoDateTimePtr date = toDate(*prop.dtstart());
inc.setStart(*date);
}
@@ -999,7 +999,7 @@ std::auto_ptr< icalendar_2_0::RrulePropType > recurrenceProperty(const Recurrenc
std::auto_ptr< RrulePropType > rruleProp(new RrulePropType(mapRecurrenceFrequency(r.frequency())));
RecurPropertyType::recur_type &recur = rruleProp->recur();
- const DateTime &endDate = r.end();
+ const KoDateTime &endDate = r.end();
if (endDate.isValid()) {
RecurPropertyType::recur_type::until_type until;
if (endDate.isDateOnly()) {
diff --git a/c++/lib/xcardconversions.h b/c++/lib/xcardconversions.h
index 5ef70bb..fd6f808 100644
--- a/c++/lib/xcardconversions.h
+++ b/c++/lib/xcardconversions.h
@@ -114,7 +114,7 @@ std::vector<std::string> toStringList(const ::xsd::cxx::tree::sequence< ::xml_sc
return d;
}
-std::string fromDate(const DateTime &dt)
+std::string fromDate(const KoDateTime &dt)
{
if (!dt.isDateOnly()) {
WARNING("fromDate called on date time value");
@@ -124,7 +124,7 @@ std::string fromDate(const DateTime &dt)
return s.str();
}
-std::string fromDateTime(const DateTime &dt)
+std::string fromDateTime(const KoDateTime &dt)
{
std::stringstream s;
s.fill('0');
@@ -152,7 +152,7 @@ std::string fromDateTime(const DateTime &dt)
return s.str();
}
-DateTime toDateTime(const std::string &input)
+KoDateTime toDateTime(const std::string &input)
{
int year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0;
bool isUtc = false;
@@ -163,7 +163,7 @@ DateTime toDateTime(const std::string &input)
if (input.size() >= 15) { //Minimum for time
if (input.at(8) != 'T') {
ERROR("Wrong demiliter");
- return DateTime();
+ return KoDateTime();
}
hour = boost::lexical_cast<int>(input.substr(9, 2));
minute = boost::lexical_cast<int>(input.substr(11, 2));
@@ -171,29 +171,29 @@ DateTime toDateTime(const std::string &input)
} else {
if (input.size() >= 9) {
ERROR("Invalid dt " + input);
- return DateTime();
+ return KoDateTime();
}
- return DateTime(year, month, day);
+ return KoDateTime(year, month, day);
}
if (input.size() >= 16) {
if (input.at(15) == 'Z') {
isUtc = true;
} else {
ERROR("wrong utc char? " + input.at(15));
- return DateTime();
+ return KoDateTime();
}
}
} catch (boost::bad_lexical_cast &c) {
ERROR("failed to convert: "+std::string(c.what()));
- return DateTime();
+ return KoDateTime();
} catch (...) {
ERROR("failed to convert: unkown exception");
- return DateTime();
+ return KoDateTime();
}
- return DateTime(year, month, day, hour, minute, second, isUtc);
+ return KoDateTime(year, month, day, hour, minute, second, isUtc);
}
-DateTime toDateTime(const vcard_4_0::DateDatetimePropertyType &prop)
+KoDateTime toDateTime(const vcard_4_0::DateDatetimePropertyType &prop)
{
if (prop.date_time()) {
return toDateTime(*prop.date_time());
@@ -201,11 +201,11 @@ DateTime toDateTime(const vcard_4_0::DateDatetimePropertyType &prop)
return toDateTime(*prop.date());
}
ERROR("no date and no datetime");
- return DateTime();
+ return KoDateTime();
}
template <typename T>
-T fromDateTime(const Kolab::DateTime &dt)
+T fromDateTime(const Kolab::KoDateTime &dt)
{
T prop;
@@ -340,7 +340,7 @@ void writeCard<Kolab::Contact>(vcard_4_0::vcard &vcard, const Kolab::Contact &co
}
if (contact.bDay().isValid()) {
- Kolab::DateTime dt = contact.bDay();
+ Kolab::KoDateTime dt = contact.bDay();
if (dt.isUTC() || !dt.timezone().empty()) {
WARNING("Must be local time, local time assumed");
dt.setUTC(false);
@@ -349,7 +349,7 @@ void writeCard<Kolab::Contact>(vcard_4_0::vcard &vcard, const Kolab::Contact &co
}
if (contact.anniversary().isValid()) {
- Kolab::DateTime dt = contact.anniversary();
+ Kolab::KoDateTime dt = contact.anniversary();
if (dt.isUTC() || !dt.timezone().empty()) {
WARNING("Must be local time, local time assumed");
dt.setUTC(false);
diff --git a/c++/tests/bindingstest.cpp b/c++/tests/bindingstest.cpp
index fcc109a..cb8e0dd 100644
--- a/c++/tests/bindingstest.cpp
+++ b/c++/tests/bindingstest.cpp
@@ -28,11 +28,11 @@ template <typename T>
void setIncidence(T &ev)
{
ev.setUid("UID");
- ev.setCreated(Kolab::DateTime(2006,1,6,12,0,0)); //UTC
+ ev.setCreated(Kolab::KoDateTime(2006,1,6,12,0,0)); //UTC
ev.setSequence(1);
ev.setClassification(Kolab::ClassConfidential);
ev.addCategory("Category");
- ev.setStart(Kolab::DateTime("Europe/Zurich", 2006,1,6,12,0,0));
+ ev.setStart(Kolab::KoDateTime("Europe/Zurich", 2006,1,6,12,0,0));
Kolab::RecurrenceRule rule;
rule.setFrequency(Kolab::RecurrenceRule::Daily);
@@ -54,9 +54,9 @@ void setIncidence(T &ev)
rule.setBymonth(list);
ev.setRecurrenceRule(rule);
- ev.addRecurrenceDate(Kolab::DateTime("Europe/Zurich", 2006,1,6,12,0,0));
- ev.addExceptionDate(Kolab::DateTime("Europe/Zurich", 2006,1,6,12,0,0));
- ev.setRecurrenceID(Kolab::DateTime("Europe/Zurich", 2006,1,6,12,0,0), true);
+ ev.addRecurrenceDate(Kolab::KoDateTime("Europe/Zurich", 2006,1,6,12,0,0));
+ ev.addExceptionDate(Kolab::KoDateTime("Europe/Zurich", 2006,1,6,12,0,0));
+ ev.setRecurrenceID(Kolab::KoDateTime("Europe/Zurich", 2006,1,6,12,0,0), true);
ev.setSummary("summary");
ev.setDescription("description");
ev.setPriority(3);
@@ -116,12 +116,12 @@ void setIncidence(T &ev)
att.push_back("attendee1");
att.push_back("attendee2");
Kolab::Alarm emailAlarm("ident", "value", att);
- emailAlarm.setStart(Kolab::DateTime(2003,2,3,2,3,4, true));
+ emailAlarm.setStart(Kolab::KoDateTime(2003,2,3,2,3,4, true));
alarms.push_back(emailAlarm);
Kolab::Attachment audiofile;
audiofile.setUri("ksdjlksdflj", "sdkljdfl");
Kolab::Alarm audio(audiofile);
- audio.setStart(Kolab::DateTime(2003,2,3,2,3,4, true));
+ audio.setStart(Kolab::KoDateTime(2003,2,3,2,3,4, true));
alarms.push_back(audio);
ev.setAlarms(alarms);
}
@@ -181,7 +181,7 @@ void BindingsTest::eventCompletness()
{
Kolab::Event ev;
setIncidence(ev);
- ev.setEnd(Kolab::DateTime("Europe/Zurich", 2006,1,8,12,0,0));
+ ev.setEnd(Kolab::KoDateTime("Europe/Zurich", 2006,1,8,12,0,0));
ev.setTransparency(true);
std::string result = Kolab::writeEvent(ev);
@@ -213,7 +213,7 @@ void BindingsTest::todoCompletness()
{
Kolab::Todo ev;
setIncidence(ev);
- ev.setDue(Kolab::DateTime("Europe/Zurich", 2006,1,8,12,0,0));
+ ev.setDue(Kolab::KoDateTime("Europe/Zurich", 2006,1,8,12,0,0));
ev.addRelatedTo("rel1");
ev.addRelatedTo("rel2");
ev.setPercentComplete(50);
@@ -235,11 +235,11 @@ void BindingsTest::journalCompletness()
ev.setUid("UID");
- ev.setCreated(Kolab::DateTime(2006,1,6,12,0,0)); //UTC
+ ev.setCreated(Kolab::KoDateTime(2006,1,6,12,0,0)); //UTC
ev.setSequence(1);
ev.setClassification(Kolab::ClassConfidential);
ev.addCategory("Category");
- ev.setStart(Kolab::DateTime("Europe/Zurich", 2006,1,6,12,0,0));
+ ev.setStart(Kolab::KoDateTime("Europe/Zurich", 2006,1,6,12,0,0));
Kolab::Attendee attendee("email");
attendee.setName("name");
attendee.setPartStat(Kolab::PartDelegated);
@@ -330,8 +330,8 @@ void BindingsTest::contactCompletness()
c.setFreeBusyUrl("freebusy");
c.setUrls(stringlist);
c.setNickNames(stringlist);
- c.setBDay(Kolab::DateTime(2001,12,10,12,12,12,false));
- c.setAnniversary(Kolab::DateTime(2001,3,2,1,1,1,false));
+ c.setBDay(Kolab::KoDateTime(2001,12,10,12,12,12,false));
+ c.setAnniversary(Kolab::KoDateTime(2001,3,2,1,1,1,false));
c.setPhoto("photo", "mimetype");
c.setGender(Kolab::Contact::Male);
c.setLanguages(stringlist);
diff --git a/c++/tests/conversiontest.cpp b/c++/tests/conversiontest.cpp
index 69352e6..cc885aa 100644
--- a/c++/tests/conversiontest.cpp
+++ b/c++/tests/conversiontest.cpp
@@ -10,7 +10,7 @@
Q_DECLARE_METATYPE(Kolab::Duration);
Q_DECLARE_METATYPE(Kolab::DayPos);
-Q_DECLARE_METATYPE(Kolab::DateTime);
+Q_DECLARE_METATYPE(Kolab::KoDateTime);
using namespace Kolab::XCAL;
@@ -95,39 +95,39 @@ void ConversionTest::dayPosSerializerTest()
void ConversionTest::xcardDateParserTest_data()
{
QTest::addColumn<QString>("input");
- QTest::addColumn<Kolab::DateTime>("expected");
-
- QTest::newRow("datetime local") << "20010102T030405" << Kolab::DateTime(2001, 01, 02, 03, 04 ,05, false);
- QTest::newRow("datetime utc") << "20010102T030405Z" << Kolab::DateTime(2001, 01, 02, 03, 04 ,05, true);
- QTest::newRow("date only") << "20010102" << Kolab::DateTime(2001, 01, 02);
- QTest::newRow("fail 1 short") << "20010102T03040" << Kolab::DateTime();
- QTest::newRow("fail non utc") << "20010102T030401s" << Kolab::DateTime();
- QTest::newRow("fail no time") << "20010102T" << Kolab::DateTime();
+ QTest::addColumn<Kolab::KoDateTime>("expected");
+
+ QTest::newRow("datetime local") << "20010102T030405" << Kolab::KoDateTime(2001, 01, 02, 03, 04 ,05, false);
+ QTest::newRow("datetime utc") << "20010102T030405Z" << Kolab::KoDateTime(2001, 01, 02, 03, 04 ,05, true);
+ QTest::newRow("date only") << "20010102" << Kolab::KoDateTime(2001, 01, 02);
+ QTest::newRow("fail 1 short") << "20010102T03040" << Kolab::KoDateTime();
+ QTest::newRow("fail non utc") << "20010102T030401s" << Kolab::KoDateTime();
+ QTest::newRow("fail no time") << "20010102T" << Kolab::KoDateTime();
}
void ConversionTest::xcardDateParserTest()
{
QFETCH(QString, input);
- QFETCH(Kolab::DateTime, expected);
- const Kolab::DateTime &dt = Kolab::XCARD::toDateTime(input.toStdString());
+ QFETCH(Kolab::KoDateTime, expected);
+ const Kolab::KoDateTime &dt = Kolab::XCARD::toDateTime(input.toStdString());
QCOMPARE(dt, expected);
}
void ConversionTest::xCardSerializerTest_data()
{
QTest::addColumn<QString>("expected");
- QTest::addColumn<Kolab::DateTime>("dt");
+ QTest::addColumn<Kolab::KoDateTime>("dt");
- QTest::newRow("datetime local") << "20010102T030405" << Kolab::DateTime(2001, 01, 02, 03, 04 ,05, false);
- QTest::newRow("datetime utc") << "20010102T030405Z" << Kolab::DateTime(2001, 01, 02, 03, 04 ,05, true);
- QTest::newRow("dateonly") << "20010102" << Kolab::DateTime(2001, 01, 02);
+ QTest::newRow("datetime local") << "20010102T030405" << Kolab::KoDateTime(2001, 01, 02, 03, 04 ,05, false);
+ QTest::newRow("datetime utc") << "20010102T030405Z" << Kolab::KoDateTime(2001, 01, 02, 03, 04 ,05, true);
+ QTest::newRow("dateonly") << "20010102" << Kolab::KoDateTime(2001, 01, 02);
}
void ConversionTest::xCardSerializerTest()
{
QFETCH(QString, expected);
- QFETCH(Kolab::DateTime, dt);
+ QFETCH(Kolab::KoDateTime, dt);
const std::string &s = Kolab::XCARD::fromDateTime(dt);
QCOMPARE(QString::fromStdString(s), expected);
}
diff --git a/c++/tests/kcalconversiontest.cpp b/c++/tests/kcalconversiontest.cpp
index fa80510..5dac8f0 100644
--- a/c++/tests/kcalconversiontest.cpp
+++ b/c++/tests/kcalconversiontest.cpp
@@ -14,11 +14,11 @@
using namespace Kolab::KCalConversion;
Q_DECLARE_METATYPE(Kolab::Duration);
-Q_DECLARE_METATYPE(Kolab::DateTime);
+Q_DECLARE_METATYPE(Kolab::KoDateTime);
Q_DECLARE_METATYPE(Kolab::Event);
Q_DECLARE_METATYPE(Kolab::Todo);
Q_DECLARE_METATYPE(Kolab::Journal);
-Q_DECLARE_METATYPE(std::vector<Kolab::DateTime>);
+Q_DECLARE_METATYPE(std::vector<Kolab::KoDateTime>);
Q_DECLARE_METATYPE(KCalCore::Event);
Q_DECLARE_METATYPE(KCalCore::Todo);
Q_DECLARE_METATYPE(KCalCore::Journal);
@@ -180,25 +180,25 @@ void comparePointerVectors(const QVector<T> &list, const QVector<T> &other)
void KCalConversionTest::testDate_data()
{
- QTest::addColumn<Kolab::DateTime>( "input" );
+ QTest::addColumn<Kolab::KoDateTime>( "input" );
QTest::addColumn<KDateTime>( "result" );
- QTest::newRow( "datetime with tz" ) << Kolab::DateTime("Europe/Zurich",2006,1,8,12,0,0) << KDateTime(QDate(2006, 1, 8), QTime(12, 0, 0), KSystemTimeZones::zone("Europe/Zurich"));
- QTest::newRow( "floating datetime" ) << Kolab::DateTime(2006,1,8,12,0,0, false) << KDateTime(QDate(2006, 1, 8), QTime(12, 0, 0), KDateTime::Spec(KDateTime::ClockTime));
- QTest::newRow( "utc datetime" ) << Kolab::DateTime(2006,1,8,12,0,0, true) << KDateTime(KDateTime(QDate(2006, 1, 8), QTime(12, 0, 0), KDateTime::UTC));
- QTest::newRow( "date only" ) << Kolab::DateTime(2006,1,8) << KDateTime(QDate(2006, 1, 8));
+ QTest::newRow( "datetime with tz" ) << Kolab::KoDateTime("Europe/Zurich",2006,1,8,12,0,0) << KDateTime(QDate(2006, 1, 8), QTime(12, 0, 0), KSystemTimeZones::zone("Europe/Zurich"));
+ QTest::newRow( "floating datetime" ) << Kolab::KoDateTime(2006,1,8,12,0,0, false) << KDateTime(QDate(2006, 1, 8), QTime(12, 0, 0), KDateTime::Spec(KDateTime::ClockTime));
+ QTest::newRow( "utc datetime" ) << Kolab::KoDateTime(2006,1,8,12,0,0, true) << KDateTime(KDateTime(QDate(2006, 1, 8), QTime(12, 0, 0), KDateTime::UTC));
+ QTest::newRow( "date only" ) << Kolab::KoDateTime(2006,1,8) << KDateTime(QDate(2006, 1, 8));
}
void KCalConversionTest::testDate()
{
- QFETCH(Kolab::DateTime, input);
+ QFETCH(Kolab::KoDateTime, input);
QFETCH(KDateTime, result);
const KDateTime &r = Kolab::KCalConversion::toDate(input);
QCOMPARE(r, result);
- const Kolab::DateTime &r2 = Kolab::KCalConversion::fromDate(result);
+ const Kolab::KoDateTime &r2 = Kolab::KCalConversion::fromDate(result);
QCOMPARE(r2, input);
}
@@ -233,16 +233,16 @@ void KCalConversionTest::testDuration()
void KCalConversionTest::testDateTZ_data()
{
- QTest::addColumn<Kolab::DateTime>( "input" );
+ QTest::addColumn<Kolab::KoDateTime>( "input" );
QTest::addColumn<KDateTime>( "result" );
QTest::addColumn<int>( "offset" );
- QTest::newRow( "berlin" ) << Kolab::DateTime("Europe/Berlin",2006,1,8,12,0,0) << KDateTime(QDate(2006, 1, 8), QTime(12, 0, 0), KSystemTimeZones::zone("Europe/Berlin")) << 3600;
+ QTest::newRow( "berlin" ) << Kolab::KoDateTime("Europe/Berlin",2006,1,8,12,0,0) << KDateTime(QDate(2006, 1, 8), QTime(12, 0, 0), KSystemTimeZones::zone("Europe/Berlin")) << 3600;
}
void KCalConversionTest::testDateTZ()
{
- QFETCH(Kolab::DateTime, input);
+ QFETCH(Kolab::KoDateTime, input);
QFETCH(KDateTime, result);
QFETCH(int, offset);
@@ -250,7 +250,7 @@ void KCalConversionTest::testDateTZ()
QCOMPARE(result.timeZone().name(), QString::fromStdString(input.timezone()));
QCOMPARE(r.timeZone().currentOffset(), offset);
- const Kolab::DateTime &r2 = Kolab::KCalConversion::fromDate(result);
+ const Kolab::KoDateTime &r2 = Kolab::KCalConversion::fromDate(result);
QCOMPARE(QString::fromStdString(r2.timezone()), result.timeZone().name());
}
@@ -260,9 +260,9 @@ void KCalConversionTest::testConversion_data()
QTest::addColumn<KCalCore::Event>( "kcal" );
QTest::addColumn<Kolab::Event>( "kolab" );
- Kolab::DateTime date(2011,2,2,12,11,10);
- Kolab::DateTime date2(2011,2,2,12,12,10);
- Kolab::DateTime date3(2012,2,2,12,12,10);
+ Kolab::KoDateTime date(2011,2,2,12,11,10);
+ Kolab::KoDateTime date2(2011,2,2,12,12,10);
+ Kolab::KoDateTime date3(2012,2,2,12,12,10);
std::vector<int> intVector;
intVector.push_back(1);
intVector.push_back(-3);
@@ -346,8 +346,8 @@ void KCalConversionTest::testConversion_data()
kolab.setRecurrenceRule(rrule);
kolab.setRecurrenceID(date2, true);
- kolab.setRecurrenceDates(std::vector<Kolab::DateTime>() << date2 << Kolab::DateTime(date2.year(), date2.month(), date2.day()));
- kolab.setExceptionDates(std::vector<Kolab::DateTime>() << date3 << Kolab::DateTime(date3.year(), date3.month(), date3.day()));
+ kolab.setRecurrenceDates(std::vector<Kolab::KoDateTime>() << date2 << Kolab::KoDateTime(date2.year(), date2.month(), date2.day()));
+ kolab.setExceptionDates(std::vector<Kolab::KoDateTime>() << date3 << Kolab::KoDateTime(date3.year(), date3.month(), date3.day()));
kolab.setSummary("summary");
kolab.setDescription("description");
@@ -399,8 +399,8 @@ void KCalConversionTest::testConversion_data()
QTest::newRow("with duration and recurrence endDate") << kcal << kolab;
}
{
- Kolab::DateTime start(2011,1,1);
- Kolab::DateTime end(2011,1,3);
+ Kolab::KoDateTime start(2011,1,1);
+ Kolab::KoDateTime end(2011,1,3);
KCalCore::Event kcal;
kcal.setUid("uid");
@@ -492,8 +492,8 @@ void KCalConversionTest::testTodoConversion_data()
QTest::addColumn<KCalCore::Todo>( "kcal" );
QTest::addColumn<Kolab::Todo>( "kolab" );
- Kolab::DateTime date(2011,2,2,12,11,10);
- Kolab::DateTime date2(2011,2,2,12,12,10);
+ Kolab::KoDateTime date(2011,2,2,12,11,10);
+ Kolab::KoDateTime date2(2011,2,2,12,12,10);
{
KCalCore::Todo kcal;
@@ -533,8 +533,8 @@ void KCalConversionTest::testJournalConversion_data()
QTest::addColumn<KCalCore::Journal>( "kcal" );
QTest::addColumn<Kolab::Journal>( "kolab" );
- Kolab::DateTime date(2011,2,2,12,11,10);
- Kolab::DateTime date2(2011,2,2,12,12,10);
+ Kolab::KoDateTime date(2011,2,2,12,11,10);
+ Kolab::KoDateTime date2(2011,2,2,12,12,10);
{
KCalCore::Journal kcal;
@@ -577,60 +577,60 @@ void KCalConversionTest::testEventConflict_data()
QTest::addColumn<bool>( "result" );
{
Kolab::Event e1;
- e1.setStart(Kolab::DateTime(2011,10,10,12,1,1));
- e1.setEnd(Kolab::DateTime(2011,10,11,12,1,1));
+ e1.setStart(Kolab::KoDateTime(2011,10,10,12,1,1));
+ e1.setEnd(Kolab::KoDateTime(2011,10,11,12,1,1));
Kolab::Event e2;
- e2.setStart(Kolab::DateTime(2011,11,10,12,1,1));
- e2.setEnd(Kolab::DateTime(2011,11,11,12,1,1));
+ e2.setStart(Kolab::KoDateTime(2011,11,10,12,1,1));
+ e2.setEnd(Kolab::KoDateTime(2011,11,11,12,1,1));
QTest::newRow( "after" ) << e1 << e2 << false;
}
{
Kolab::Event e1;
- e1.setStart(Kolab::DateTime(2011,10,10,12,1,1));
- e1.setEnd(Kolab::DateTime(2011,10,11,12,1,1));
+ e1.setStart(Kolab::KoDateTime(2011,10,10,12,1,1));
+ e1.setEnd(Kolab::KoDateTime(2011,10,11,12,1,1));
Kolab::Event e2;
- e2.setStart(Kolab::DateTime(2011,9,10,12,1,1));
- e2.setEnd(Kolab::DateTime(2011,9,11,12,1,1));
+ e2.setStart(Kolab::KoDateTime(2011,9,10,12,1,1));
+ e2.setEnd(Kolab::KoDateTime(2011,9,11,12,1,1));
QTest::newRow( "before" ) << e1 << e2 << false;
}
{
Kolab::Event e1;
- e1.setStart(Kolab::DateTime(2011,10,10,12,1,1));
- e1.setEnd(Kolab::DateTime(2011,10,11,12,1,1));
+ e1.setStart(Kolab::KoDateTime(2011,10,10,12,1,1));
+ e1.setEnd(Kolab::KoDateTime(2011,10,11,12,1,1));
Kolab::Event e2;
- e2.setStart(Kolab::DateTime(2011,10,10,12,1,1));
- e2.setEnd(Kolab::DateTime(2011,10,11,12,1,1));
+ e2.setStart(Kolab::KoDateTime(2011,10,10,12,1,1));
+ e2.setEnd(Kolab::KoDateTime(2011,10,11,12,1,1));
QTest::newRow( "conflict" ) << e1 << e2 << true;
}
{
Kolab::Event e1;
- e1.setStart(Kolab::DateTime("Europe/Zurich", 2011,10,10,6,1,1));
- e1.setEnd(Kolab::DateTime("Europe/Zurich", 2011,10,10,6,1,2));
+ e1.setStart(Kolab::KoDateTime("Europe/Zurich", 2011,10,10,6,1,1));
+ e1.setEnd(Kolab::KoDateTime("Europe/Zurich", 2011,10,10,6,1,2));
Kolab::Event e2;
- e2.setStart(Kolab::DateTime("Asia/Dubai",2011,10,10,6,1,1));
- e2.setEnd(Kolab::DateTime("Asia/Dubai",2011,10,10,6,1,2));
+ e2.setStart(Kolab::KoDateTime("Asia/Dubai",2011,10,10,6,1,1));
+ e2.setEnd(Kolab::KoDateTime("Asia/Dubai",2011,10,10,6,1,2));
QTest::newRow( "tz non-conflict" ) << e1 << e2 << false;
}
{
Kolab::Event e1;
- e1.setStart(Kolab::DateTime("Europe/Berlin", 2011,10,10,6,1,1));
- e1.setEnd(Kolab::DateTime("Europe/Berlin", 2011,10,10,6,1,2));
+ e1.setStart(Kolab::KoDateTime("Europe/Berlin", 2011,10,10,6,1,1));
+ e1.setEnd(Kolab::KoDateTime("Europe/Berlin", 2011,10,10,6,1,2));
Kolab::Event e2;
- e2.setStart(Kolab::DateTime("Europe/Zurich",2011,10,10,6,1,1));
- e2.setEnd(Kolab::DateTime("Europe/Zurich",2011,10,10,6,1,2));
+ e2.setStart(Kolab::KoDateTime("Europe/Zurich",2011,10,10,6,1,1));
+ e2.setEnd(Kolab::KoDateTime("Europe/Zurich",2011,10,10,6,1,2));
QTest::newRow( "tz conflict" ) << e1 << e2 << true;
}
@@ -649,27 +649,27 @@ void KCalConversionTest::testEventConflict()
void KCalConversionTest::testTimesInInterval_data()
{
QTest::addColumn<Kolab::Event>( "event" );
- QTest::addColumn<Kolab::DateTime>( "start" );
- QTest::addColumn<Kolab::DateTime>( "end" );
- QTest::addColumn< std::vector<Kolab::DateTime> >( "result" );
+ QTest::addColumn<Kolab::KoDateTime>( "start" );
+ QTest::addColumn<Kolab::KoDateTime>( "end" );
+ QTest::addColumn< std::vector<Kolab::KoDateTime> >( "result" );
{
{
Kolab::Event event;
- event.setStart(Kolab::DateTime(2011,1,1,1,1,1));
- event.setEnd(Kolab::DateTime(2011,1,1,2,1,1));
+ event.setStart(Kolab::KoDateTime(2011,1,1,1,1,1));
+ event.setEnd(Kolab::KoDateTime(2011,1,1,2,1,1));
Kolab::RecurrenceRule rrule;
rrule.setFrequency(Kolab::RecurrenceRule::Daily);
rrule.setInterval(1);
rrule.setCount(5);
event.setRecurrenceRule(rrule);
- std::vector<Kolab::DateTime> result;
- result.push_back(Kolab::DateTime(2011,1,1,1,1,1));
- result.push_back(Kolab::DateTime(2011,1,2,1,1,1));
- result.push_back(Kolab::DateTime(2011,1,3,1,1,1));
- result.push_back(Kolab::DateTime(2011,1,4,1,1,1));
- result.push_back(Kolab::DateTime(2011,1,5,1,1,1));
- QTest::newRow( "simple" ) << event << Kolab::DateTime(2011,1,1,1,1,1) << Kolab::DateTime(2011,1,5,1,1,1) << result;
+ std::vector<Kolab::KoDateTime> result;
+ result.push_back(Kolab::KoDateTime(2011,1,1,1,1,1));
+ result.push_back(Kolab::KoDateTime(2011,1,2,1,1,1));
+ result.push_back(Kolab::KoDateTime(2011,1,3,1,1,1));
+ result.push_back(Kolab::KoDateTime(2011,1,4,1,1,1));
+ result.push_back(Kolab::KoDateTime(2011,1,5,1,1,1));
+ QTest::newRow( "simple" ) << event << Kolab::KoDateTime(2011,1,1,1,1,1) << Kolab::KoDateTime(2011,1,5,1,1,1) << result;
}
}
}
@@ -677,17 +677,17 @@ void KCalConversionTest::testTimesInInterval_data()
void KCalConversionTest::testTimesInInterval()
{
QFETCH(Kolab::Event, event);
- QFETCH(Kolab::DateTime, start);
- QFETCH(Kolab::DateTime, end);
- QFETCH(std::vector<Kolab::DateTime>, result);
+ QFETCH(Kolab::KoDateTime, start);
+ QFETCH(Kolab::KoDateTime, end);
+ QFETCH(std::vector<Kolab::KoDateTime>, result);
QCOMPARE(Kolab::Calendaring::timeInInterval(event,start, end), result);
}
void KCalConversionTest::testTimesInIntervalBenchmark()
{
Kolab::Event event;
- event.setStart(Kolab::DateTime(2011,1,1,1,1,1));
- event.setEnd(Kolab::DateTime(2011,1,1,2,1,1));
+ event.setStart(Kolab::KoDateTime(2011,1,1,1,1,1));
+ event.setEnd(Kolab::KoDateTime(2011,1,1,2,1,1));
Kolab::RecurrenceRule rrule;
rrule.setFrequency(Kolab::RecurrenceRule::Daily);
rrule.setInterval(1);
@@ -695,9 +695,9 @@ void KCalConversionTest::testTimesInIntervalBenchmark()
event.setRecurrenceRule(rrule);
QBENCHMARK {
- Kolab::Calendaring::timeInInterval(event, Kolab::DateTime(2011,1,1,1,1,1), Kolab::DateTime(2013,1,1,1,1,1));
+ Kolab::Calendaring::timeInInterval(event, Kolab::KoDateTime(2011,1,1,1,1,1), Kolab::KoDateTime(2013,1,1,1,1,1));
}
- const std::vector<Kolab::DateTime> &result = Kolab::Calendaring::timeInInterval(event, Kolab::DateTime(2011,1,1,1,1,1), Kolab::DateTime(2013,1,1,1,1,1));
+ const std::vector<Kolab::KoDateTime> &result = Kolab::Calendaring::timeInInterval(event, Kolab::KoDateTime(2011,1,1,1,1,1), Kolab::KoDateTime(2013,1,1,1,1,1));
QVERIFY(result.size() == 500);
// qDebug() << QTest::toString(result);
}
diff --git a/c++/tests/serializers.h b/c++/tests/serializers.h
index f6bcae6..c92f577 100644
--- a/c++/tests/serializers.h
+++ b/c++/tests/serializers.h
@@ -7,9 +7,9 @@
namespace QTest {
template<>
- char *toString(const Kolab::DateTime &dt)
+ char *toString(const Kolab::KoDateTime &dt)
{
- QByteArray ba = "Kolab::DateTime(";
+ QByteArray ba = "Kolab::KoDateTime(";
ba += QByteArray::number(dt.year()) + ", " + QByteArray::number(dt.month())+ ", " + QByteArray::number(dt.day()) + ", ";
ba += QByteArray::number(dt.hour()) + ", " + QByteArray::number(dt.minute()) + ", " + QByteArray::number(dt.second())+ ", ";
ba += QString(dt.isUTC()?QString("UTC"):QString("TZ: "+QString::fromStdString(dt.timezone()))).toAscii();
@@ -18,9 +18,9 @@ namespace QTest {
}
template<>
- char *toString(const std::vector<Kolab::DateTime> &v)
+ char *toString(const std::vector<Kolab::KoDateTime> &v)
{
- QByteArray ba = "vector<Kolab::DateTime>(";
+ QByteArray ba = "vector<Kolab::KoDateTime>(";
for (int i = 0; i < v.size(); i++) {
ba += QByteArray(toString(v.at(i)))+ "\n";
}
More information about the commits
mailing list