File indexing completed on 2025-01-12 05:02:07
0001 #pragma once 0002 0003 /* 0004 * SPDX-FileCopyrightText: 2003-2009 Craig Drummond <craig@kde.org> 0005 * SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #include "kfontinst_export.h" 0009 #include <QDBusArgument> 0010 #include <QMetaType> 0011 #include <QSet> 0012 0013 class QDomElement; 0014 class QTextStream; 0015 0016 namespace KFI 0017 { 0018 class KFONTINST_EXPORT File 0019 { 0020 public: 0021 static bool equalIndex(int a, int b) 0022 { 0023 return a <= 1 && b <= 1; 0024 } 0025 0026 File(const QString &pth = QString(), const QString &fndry = QString(), int idx = 0) 0027 : m_path(pth) 0028 , m_foundry(fndry) 0029 , m_index(idx) 0030 { 0031 } 0032 File(const QDomElement &elem, bool disabled); 0033 0034 bool operator==(const File &o) const 0035 { 0036 return equalIndex(m_index, o.m_index) && m_path == o.m_path; 0037 } 0038 0039 QString toXml(bool disabledOnly) const; 0040 0041 const QString &path() const 0042 { 0043 return m_path; 0044 } 0045 const QString &foundry() const 0046 { 0047 return m_foundry; 0048 } 0049 int index() const 0050 { 0051 return m_index; 0052 } 0053 0054 private: 0055 QString m_path, m_foundry; 0056 int m_index; 0057 }; 0058 0059 typedef QSet<File> FileCont; 0060 0061 inline KFONTINST_EXPORT uint qHash(const File &key) 0062 { 0063 return qHash(key.path()); // +qHash(key.index()); 0064 } 0065 0066 } 0067 0068 KFONTINST_EXPORT QDBusArgument &operator<<(QDBusArgument &argument, const KFI::File &obj); 0069 KFONTINST_EXPORT const QDBusArgument &operator>>(const QDBusArgument &argument, KFI::File &obj);