Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qmimemagicrulematcher.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#define QT_NO_CAST_FROM_ASCII
5
7
8#include "qmimetype_p.h"
9
11
26 m_list(),
27 m_priority(thePriority),
28 m_mimetype(mime)
29{
30}
31
33{
34 return m_list == other.m_list &&
35 m_priority == other.m_priority;
36}
37
42
43void QMimeMagicRuleMatcher::addRules(const QList<QMimeMagicRule> &rules)
44{
45 m_list.append(rules);
46}
47
48QList<QMimeMagicRule> QMimeMagicRuleMatcher::magicRules() const
49{
50 return m_list;
51}
52
53// Check for a match on contents of a file
55{
56 for (const QMimeMagicRule &magicRule : m_list) {
57 if (magicRule.matches(data))
58 return true;
59 }
60
61 return false;
62}
63
64// Return a priority value from 1..100
66{
67 return m_priority;
68}
69
\inmodule QtCore
Definition qbytearray.h:57
void append(parameter_type t)
Definition qlist.h:458
The QMimeMagicRuleMatcher class checks a number of rules based on operator "or".
bool matches(const QByteArray &data) const
QList< QMimeMagicRule > magicRules() const
QMimeMagicRuleMatcher(const QString &mime, unsigned priority=65535)
void addRules(const QList< QMimeMagicRule > &rules)
bool operator==(const QMimeMagicRuleMatcher &other) const
void addRule(const QMimeMagicRule &rule)
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
DBusConnection const char * rule
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
application x qt windows mime
[2]
QSharedPointer< T > other(t)
[5]