| Home · All Classes · All Namespaces · Modules · Functions · Files

message-content-part.h

    00001
    00023 #ifndef _TelepathyQt_message_content_part_h_HEADER_GUARD_
    00024 #define _TelepathyQt_message_content_part_h_HEADER_GUARD_
    00025
    00026 #ifndef IN_TP_QT_HEADER
    00027 #error IN_TP_QT_HEADER
    00028 #endif
    00029
    00030 #include <TelepathyQt/Constants>
    00031 #include <TelepathyQt/Types>
    00032
    00033 namespace Tp
    00034 {
    00035
    00036 class TP_QT_EXPORT MessageContentPart
    00037 {
    00038 public:
    00039     MessageContentPart();
    00040     MessageContentPart(const MessagePart &mp);
    00041     MessageContentPart(const MessageContentPart &other);
    00042     ~MessageContentPart();
    00043
    00044     bool isValid() const { return mPriv.constData() != 0; }
    00045
    00046     MessageContentPart &operator=(const MessageContentPart &other);
    00047     bool operator==(const MessageContentPart &other) const;
    00048
    00049     MessagePart barePart() const;
    00050
    00051 private:
    00052     struct Private;
    00053     friend struct Private;
    00054     QSharedDataPointer<Private> mPriv;
    00055 };
    00056
    00057 class TP_QT_EXPORT MessageContentPartList :
    00058                 public QList<MessageContentPart>
    00059 {
    00060 public:
    00061     MessageContentPartList() { }
    00062     MessageContentPartList(const MessagePart &mp)
    00063     {
    00064         append(MessageContentPart(mp));
    00065     }
    00066     MessageContentPartList(const MessagePartList &mps)
    00067     {
    00068         Q_FOREACH (const MessagePart &mp, mps) {
    00069             append(MessageContentPart(mp));
    00070         }
    00071     }
    00072     MessageContentPartList(const MessageContentPart &mcp)
    00073     {
    00074         append(mcp);
    00075     }
    00076     MessageContentPartList(const QList<MessageContentPart> &other)
    00077         : QList<MessageContentPart>(other)
    00078     {
    00079     }
    00080
    00081     MessagePartList bareParts() const
    00082     {
    00083         MessagePartList list;
    00084         Q_FOREACH (const MessageContentPart &mcp, *this) {
    00085             list.append(mcp.barePart());
    00086         }
    00087         return list;
    00088     }
    00089 };
    00090
    00091 } // Tp
    00092
    00093 Q_DECLARE_METATYPE(Tp::MessageContentPart);
    00094 Q_DECLARE_METATYPE(Tp::MessageContentPartList);
    00095
    00096 #endif