3 commits - README src/DEVELOPMENT src/kolabformat.h tests/serializers.h

Christian Mollekopf mollekopf at kolabsys.com
Wed Dec 5 13:09:05 CET 2012


 README              |    8 ++++++++
 src/DEVELOPMENT     |    6 ++++--
 src/kolabformat.h   |   25 +++++++++++++++++++++++++
 tests/serializers.h |   18 +++++++++---------
 4 files changed, 46 insertions(+), 11 deletions(-)

New commits:
commit 0fdb8fa489bba1a5f1112f4bd7d792412dd38896
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Wed Dec 5 13:08:45 2012 +0100

    Some api documentation.

diff --git a/README b/README
index 194456e..4dc4350 100644
--- a/README
+++ b/README
@@ -3,6 +3,14 @@
 Libkolabxml is the reference implementation of the Kolab XML Format as defined in http://wiki.kolab.org/User:Mollekopf/Drafts/KEP:17.
 It provides serialization/deserialization from/to in-memory representations for all Kolab Objects, including input validation.
 
+= Bindings =
+
+Based on SWIG (www.swig.org) various language-bindings are provided.
+
+= Usage =
+
+For more information about the usage please see src/kolabformat.h
+
 = Building =
 
 Build with:
diff --git a/src/DEVELOPMENT b/src/DEVELOPMENT
index d6730e1..f1775d1 100644
--- a/src/DEVELOPMENT
+++ b/src/DEVELOPMENT
@@ -86,6 +86,10 @@ Alternatively one could control the lifetime from the bindings through an initia
 
 For further performance improvements read this: http://xerces.apache.org/xerces2-j/faq-performance.html
 
+== Thread safety ==
+
+Thread safety is achieved through thread-local storage, which was tested to work under C++ and Python.
+
 == Error Handling ==
 
 All exceptions which could be thrown are caught within the serializing functions. There shouldn't be any uncaught exceptions because the bindings code doesn't handle that.
@@ -93,8 +97,6 @@ If an error occurs a message is printed to the standard error output and a defau
 
 Writing doesn't provide any validation (as it is hardly useful for the reason that it's anyways not possible to correct the mistake). For debugging purposes the document can be parsed again after writing. Validity is only ensured by typesafety, but range errors are easily possible.
 
-
-
 === The XSD based development checklist ===
 -Don't forget to add an element for each attribute in the style off: <xs:element name="pref" type="xcard:prefParamType" substitutionGroup="xcard:baseParameter"/>
  Otherwise you won't get the serialization/deserialization code (or respectively just wrong code), which still compiles though and looks correct from the outside.
diff --git a/src/kolabformat.h b/src/kolabformat.h
index 3ed55e8..b3192ad 100644
--- a/src/kolabformat.h
+++ b/src/kolabformat.h
@@ -29,6 +29,29 @@
 #include "kolabfreebusy.h"
 #include "global_definitions.h"
 
+/**
+ * Kolab Format v3 Implementation
+ *
+ * Note that this code is threadsafe, as it uses thread-local storage.
+ * 
+ * Example:
+ *
+ * Kolab::Event event;
+ * event.setStart(Kolab::cDateTime("Europe/Zurich",2011,10,10,12,1,1));
+ * event.setEnd(Kolab::cDateTime("Europe/Zurich",2012,5,5,3,4,4));
+ * event.setLastModified(Kolab::cDateTime(2011,10,11,12,1,2,true));
+ * event.setCreated(Kolab::cDateTime(2011,10,11,12,1,3,true));
+ * std::string serialization = Kolab::writeEvent(ev, "Product ID");
+ * std::string serializedUID = Kolab::getSerializedUID(); //returns the UID of the just serialized event
+ * if (Kolab::error() != Kolab::NoError) {
+ *     std::cout << "Error on write " << Kolab::errorMessage();
+ * }
+ * Kolab::Event e = Kolab::readEvent(serialization, false);
+ * if (Kolab::error() != Kolab::NoError) {
+ *     std::cout << "Error on read " << Kolab::errorMessage();
+ * }
+ *
+ */
 namespace Kolab {
 
 /**
@@ -55,11 +78,13 @@ std::string errorMessage();
  * Updated during deserialization of object.
  */
 std::string productId();
+
 /**
  * Returns KolabFormat version of the last deserialized object.
  * Updated during deserialization of object.
  */
 std::string xKolabVersion();
+
 /**
  * Returns xCal version of the last deserialized xCal object.
  * Updated during deserialization of object.


commit bab0fd3186bad79c421abe90041c127f551bf8b3
Merge: a9832d4 e6c915b
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Fri Nov 2 15:24:04 2012 +0100

    Merge branch 'master' of ssh://git.kolab.org/git/libkolabxml



commit a9832d444e2b61f0e896e05ff07975bfa1b9c178
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Fri Nov 2 00:45:23 2012 +0100

    Fixed some warnings.

diff --git a/tests/serializers.h b/tests/serializers.h
index 978a67e..2168f43 100644
--- a/tests/serializers.h
+++ b/tests/serializers.h
@@ -21,7 +21,7 @@ namespace QTest {
     char *toString(const std::vector<Kolab::cDateTime> &v)
     {
         QByteArray ba = "vector<Kolab::cDateTime>(";
-        for (int i = 0; i < v.size(); i++) {
+        for (std::size_t i = 0; i < v.size(); i++) {
             ba += QByteArray(toString(v.at(i)))+ "\n";
         }
         ba += ")";
@@ -43,7 +43,7 @@ namespace QTest {
     char *toString(const std::vector<Kolab::Attendee> &v)
     {
         QByteArray ba = "vector<Kolab::Attendee>(";
-        for (int i = 0; i < v.size(); i++) {
+        for (std::size_t i = 0; i < v.size(); i++) {
             ba += QByteArray(toString(v.at(i)))+ ", ";
         }
         ba += ")";
@@ -63,7 +63,7 @@ namespace QTest {
     char *toString(const std::vector<std::string> &v)
     {
         QByteArray ba = "vector<std::string>(";
-        for (int i = 0; i < v.size(); i++) {
+        for (std::size_t i = 0; i < v.size(); i++) {
             ba += QByteArray(toString(v.at(i)))+ ", ";
         }
         ba += ")";
@@ -74,7 +74,7 @@ namespace QTest {
     char *toString(const std::vector<int> &v)
     {
         QByteArray ba = "vector<int>(";
-        for (int i = 0; i < v.size(); i++) {
+        for (std::size_t i = 0; i < v.size(); i++) {
             ba += QString::number(v.at(i)).toAscii()+ ", ";
         }
         ba += ")";
@@ -114,7 +114,7 @@ namespace QTest {
     char *toString(const std::vector<Kolab::Attachment> &v)
     {
         QByteArray ba = "vector<Kolab::Attachment>(";
-        for (int i = 0; i < v.size(); i++) {
+        for (std::size_t i = 0; i < v.size(); i++) {
             ba += QByteArray(toString(v.at(i)))+ "\n";
         }
         ba += ")";
@@ -136,7 +136,7 @@ namespace QTest {
     char *toString(const std::vector<Kolab::ContactReference> &v)
     {
         QByteArray ba = "vector<Kolab::ContactReference>(";
-        for (int i = 0; i < v.size(); i++) {
+        for (std::size_t i = 0; i < v.size(); i++) {
                 ba += QByteArray(toString(v.at(i)))+ "\n";
             }
             ba += ")";
@@ -158,7 +158,7 @@ namespace QTest {
     char *toString(const std::vector<Kolab::Alarm> &v)
     {
         QByteArray ba = "vector<Kolab::Alarm>(";
-        for (int i = 0; i < v.size(); i++) {
+        for (std::size_t i = 0; i < v.size(); i++) {
             ba += QByteArray(toString(v.at(i)))+ "\n";
         }
         ba += ")";
@@ -181,7 +181,7 @@ namespace QTest {
     char *toString(const std::vector<Kolab::Related> &v)
     {
         QByteArray ba = "vector<Kolab::Related>(";
-        for (int i = 0; i < v.size(); i++) {
+        for (std::size_t i = 0; i < v.size(); i++) {
             ba += QByteArray(toString(v.at(i)))+ "\n";
         }
         ba += ")";
@@ -203,7 +203,7 @@ namespace QTest {
     char *toString(const std::vector<Kolab::Affiliation> &v)
     {
         QByteArray ba = "vector<Kolab::Affiliation>(";
-        for (int i = 0; i < v.size(); i++) {
+        for (std::size_t i = 0; i < v.size(); i++) {
             ba += QByteArray(toString(v.at(i)))+ "\n";
         }
         ba += ")";





More information about the commits mailing list