summaryrefslogtreecommitdiffstats
path: root/src/corelib/mimetypes
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/mimetypes')
-rw-r--r--src/corelib/mimetypes/qmimeglobpattern_p.h10
-rw-r--r--src/corelib/mimetypes/qmimemagicrule_p.h15
-rw-r--r--src/corelib/mimetypes/qmimemagicrulematcher_p.h8
3 files changed, 31 insertions, 2 deletions
diff --git a/src/corelib/mimetypes/qmimeglobpattern_p.h b/src/corelib/mimetypes/qmimeglobpattern_p.h
index 0088931b5c..7b4ecd2f6a 100644
--- a/src/corelib/mimetypes/qmimeglobpattern_p.h
+++ b/src/corelib/mimetypes/qmimeglobpattern_p.h
@@ -88,7 +88,14 @@ public:
m_pattern = m_pattern.toLower();
}
}
- ~QMimeGlobPattern() {}
+
+ void swap(QMimeGlobPattern &other) Q_DECL_NOTHROW
+ {
+ qSwap(m_pattern, other.m_pattern);
+ qSwap(m_mimeType, other.m_mimeType);
+ qSwap(m_weight, other.m_weight);
+ qSwap(m_caseSensitivity, other.m_caseSensitivity);
+ }
bool matchFileName(const QString &filename) const;
@@ -103,6 +110,7 @@ private:
int m_weight;
Qt::CaseSensitivity m_caseSensitivity;
};
+Q_DECLARE_SHARED(QMimeGlobPattern)
class QMimeGlobPatternList : public QList<QMimeGlobPattern>
{
diff --git a/src/corelib/mimetypes/qmimemagicrule_p.h b/src/corelib/mimetypes/qmimemagicrule_p.h
index 1a6ca81e11..26f93d96cc 100644
--- a/src/corelib/mimetypes/qmimemagicrule_p.h
+++ b/src/corelib/mimetypes/qmimemagicrule_p.h
@@ -69,6 +69,19 @@ public:
QMimeMagicRule(const QString &typeStr, const QByteArray &value, const QString &offsets,
const QByteArray &mask, QString *errorString);
+ void swap(QMimeMagicRule &other) Q_DECL_NOTHROW
+ {
+ qSwap(m_type, other.m_type);
+ qSwap(m_value, other.m_value);
+ qSwap(m_startPos, other.m_startPos);
+ qSwap(m_endPos, other.m_endPos);
+ qSwap(m_mask, other.m_mask);
+ qSwap(m_pattern, other.m_pattern);
+ qSwap(m_number, other.m_number);
+ qSwap(m_numberMask, other.m_numberMask);
+ qSwap(m_matchFunction, other.m_matchFunction);
+ }
+
bool operator==(const QMimeMagicRule &other) const;
Type type() const { return m_type; }
@@ -108,7 +121,7 @@ private:
template <typename T>
bool matchNumber(const QByteArray &data) const;
};
-Q_DECLARE_TYPEINFO(QMimeMagicRule, Q_MOVABLE_TYPE);
+Q_DECLARE_SHARED(QMimeMagicRule)
QT_END_NAMESPACE
diff --git a/src/corelib/mimetypes/qmimemagicrulematcher_p.h b/src/corelib/mimetypes/qmimemagicrulematcher_p.h
index b2e171ec1f..5e3d5306c0 100644
--- a/src/corelib/mimetypes/qmimemagicrulematcher_p.h
+++ b/src/corelib/mimetypes/qmimemagicrulematcher_p.h
@@ -66,6 +66,13 @@ class QMimeMagicRuleMatcher
public:
explicit QMimeMagicRuleMatcher(const QString &mime, unsigned priority = 65535);
+ void swap(QMimeMagicRuleMatcher &other) Q_DECL_NOTHROW
+ {
+ qSwap(m_list, other.m_list);
+ qSwap(m_priority, other.m_priority);
+ qSwap(m_mimetype, other.m_mimetype);
+ }
+
bool operator==(const QMimeMagicRuleMatcher &other) const;
void addRule(const QMimeMagicRule &rule);
@@ -83,6 +90,7 @@ private:
unsigned m_priority;
QString m_mimetype;
};
+Q_DECLARE_SHARED(QMimeMagicRuleMatcher)
QT_END_NAMESPACE