accounts-qt  1.15
service-type.h
00001 /* vi: set et sw=4 ts=4 cino=t0,(0: */
00002 /*
00003  * This file is part of libaccounts-qt
00004  *
00005  * Copyright (C) 2011 Nokia Corporation.
00006  * Copyright (C) 2012-2016 Canonical Ltd.
00007  * Copyright (C) 2012 Intel Corporation.
00008  *
00009  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
00010  * Contact: Jussi Laako <jussi.laako@linux.intel.com>
00011  *
00012  * This library is free software; you can redistribute it and/or
00013  * modify it under the terms of the GNU Lesser General Public License
00014  * version 2.1 as published by the Free Software Foundation.
00015  *
00016  * This library is distributed in the hope that it will be useful, but
00017  * WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00019  * Lesser General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with this library; if not, write to the Free Software
00023  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00024  * 02110-1301 USA
00025  */
00031 #ifndef ACCOUNTS_SERVICE_TYPE_H
00032 #define ACCOUNTS_SERVICE_TYPE_H
00033 
00034 #include "Accounts/accountscommon.h"
00035 
00036 #include <QObject>
00037 #include <QSet>
00038 #include <QString>
00039 #include <QDomDocument>
00040 
00041 extern "C"
00042 {
00043     typedef struct _AgServiceType AgServiceType;
00044 }
00045 
00046 namespace Accounts
00047 {
00048 
00049 class ACCOUNTS_EXPORT ServiceType
00050 {
00051 public:
00052     ServiceType();
00053     ServiceType(const ServiceType &other);
00054     ServiceType &operator=(const ServiceType &other);
00055     ~ServiceType();
00056 
00057     bool isValid() const;
00058 
00059     QString name() const;
00060     QString displayName() const;
00061     QString trCatalog() const;
00062     QString iconName() const;
00063     bool hasTag(const QString &tag) const;
00064     QSet<QString> tags() const;
00065 
00066     const QDomDocument domDocument() const;
00067 
00068     friend inline bool operator==(const Accounts::ServiceType &s1,
00069                                   const Accounts::ServiceType &s2) {
00070         return s1.m_serviceType == s2.m_serviceType || s1.name() == s2.name();
00071     }
00072 
00073 private:
00074     // \cond
00075     friend class Manager;
00076     ServiceType(AgServiceType *serviceType, ReferenceMode mode = AddReference);
00077     AgServiceType *m_serviceType;
00078     mutable QSet<QString> *m_tags;
00079     // \endcond
00080 };
00081 
00082 } //namespace Accounts
00083 
00084 #endif // ACCOUNTS_SERVICE_TYPE_H