File indexing completed on 2024-11-24 04:44:13
0001 /* 0002 * SPDX-FileCopyrightText: 2012 Sofia Balicka <balicka@kolabsys.com> 0003 * SPDX-FileCopyrightText: 2014 Christian Mollekopf <mollekopf@kolabsys.com> 0004 * 0005 * SPDX-License-Identifier: LGPL-3.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include "kolab_export.h" 0011 0012 #include "kolabdefinitions.h" 0013 #include <kolabformat.h> 0014 0015 #include <memory> 0016 0017 namespace Kolab 0018 { 0019 class MIMEObjectPrivate; 0020 0021 class KOLAB_EXPORT MIMEObject 0022 { 0023 public: 0024 MIMEObject(); 0025 ~MIMEObject(); 0026 0027 ObjectType parseMessage(const std::string &msg); 0028 0029 /** 0030 * Set to override the autodetected object type, before parsing the message. 0031 */ 0032 void setObjectType(ObjectType); 0033 0034 /** 0035 * Set to override the autodetected version, before parsing the message. 0036 */ 0037 void setVersion(Version); 0038 0039 /** 0040 * Returns the Object type of the parsed kolab object. 0041 */ 0042 ObjectType getType() const; 0043 0044 /** 0045 * Returns the kolab-format version of the parsed kolab object. 0046 */ 0047 Version getVersion() const; 0048 0049 Kolab::Event getEvent() const; 0050 Kolab::Todo getTodo() const; 0051 Kolab::Journal getJournal() const; 0052 Kolab::Note getNote() const; 0053 Kolab::Contact getContact() const; 0054 Kolab::DistList getDistlist() const; 0055 Kolab::Freebusy getFreebusy() const; 0056 Kolab::Configuration getConfiguration() const; 0057 0058 std::string writeEvent(const Kolab::Event &event, Version version, const std::string &productId = std::string()); 0059 Kolab::Event readEvent(const std::string &s); 0060 0061 std::string writeTodo(const Kolab::Todo &todo, Version version, const std::string &productId = std::string()); 0062 Kolab::Todo readTodo(const std::string &s); 0063 0064 std::string writeJournal(const Kolab::Journal &journal, Version version, const std::string &productId = std::string()); 0065 Kolab::Journal readJournal(const std::string &s); 0066 0067 std::string writeNote(const Kolab::Note ¬e, Version version, const std::string &productId = std::string()); 0068 Kolab::Note readNote(const std::string &s); 0069 0070 std::string writeContact(const Kolab::Contact &contact, Version version, const std::string &productId = std::string()); 0071 Kolab::Contact readContact(const std::string &s); 0072 0073 std::string writeDistlist(const Kolab::DistList &distlist, Version version, const std::string &productId = std::string()); 0074 Kolab::DistList readDistlist(const std::string &s); 0075 0076 std::string writeFreebusy(const Kolab::Freebusy &freebusy, Version version, const std::string &productId = std::string()); 0077 Kolab::Freebusy readFreebusy(const std::string &s); 0078 0079 std::string writeConfiguration(const Kolab::Configuration &freebusy, Version version, const std::string &productId = std::string()); 0080 Kolab::Configuration readConfiguration(const std::string &s); 0081 0082 private: 0083 //@cond PRIVATE 0084 MIMEObject(const MIMEObject &other) = delete; 0085 MIMEObject &operator=(const MIMEObject &rhs) = delete; 0086 0087 private: 0088 std::unique_ptr<MIMEObjectPrivate> const d; 0089 //@endcond 0090 }; 0091 }