• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • sources
  • kde-4.14
  • kdelibs
  • kdecore
  • services
kmimemagicrule_p.h
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  * Copyright 2007 David Faure <faure@kde.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB. If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef KMIMEMAGICRULE_H
21 #define KMIMEMAGICRULE_H
22 
23 #include <QList>
24 #include <QString>
25 class QIODevice;
26 
31 struct KMimeMagicMatch
32 {
33  bool match(QIODevice* device, qint64 deviceSize, QByteArray& availableData, const QString& mimeType) const;
34 
35  qint64 m_rangeStart;
36  qint64 m_rangeLength;
37  QByteArray m_data;
38  QByteArray m_mask;
39  QList<KMimeMagicMatch> m_subMatches;
40 };
41 
53 class KMimeMagicRule
54 {
55 public:
56  KMimeMagicRule(const QString& mimetype, int priority, const QList<KMimeMagicMatch>& matches)
57  : m_mimetype(mimetype), m_priority(priority), m_matches(matches) {}
58 
59  bool match(QIODevice* device, qint64 deviceSize, QByteArray& availableData) const;
60 
61  QString mimetype() const { return m_mimetype; }
62  int priority() const { return m_priority; }
63  // For unit test only
64  QList<KMimeMagicMatch> matches() const { return m_matches; }
65 
66 private:
67  QString m_mimetype;
68  int m_priority;
69  QList<KMimeMagicMatch> m_matches;
70 };
71 
72 #endif /* KMIMEMAGICRULE_H */
QIODevice
KMimeMagicMatch::m_mask
QByteArray m_mask
Definition: kmimemagicrule_p.h:38
qint64
QByteArray
KMimeMagicRule
Definition: kmimemagicrule_p.h:53
KMimeMagicRule::KMimeMagicRule
KMimeMagicRule(const QString &mimetype, int priority, const QList< KMimeMagicMatch > &matches)
Definition: kmimemagicrule_p.h:56
KMimeMagicRule::match
bool match(QIODevice *device, qint64 deviceSize, QByteArray &availableData) const
Definition: kmimemagicrule.cpp:102
KMimeMagicRule::mimetype
QString mimetype() const
Definition: kmimemagicrule_p.h:61
KMimeMagicMatch::m_data
QByteArray m_data
Definition: kmimemagicrule_p.h:37
KMimeMagicRule::priority
int priority() const
Definition: kmimemagicrule_p.h:62
KMimeMagicMatch::match
bool match(QIODevice *device, qint64 deviceSize, QByteArray &availableData, const QString &mimeType) const
Definition: kmimemagicrule.cpp:107
QString
QList< KMimeMagicMatch >
KMimeMagicMatch::m_rangeLength
qint64 m_rangeLength
Definition: kmimemagicrule_p.h:36
KMimeMagicMatch::m_rangeStart
qint64 m_rangeStart
Definition: kmimemagicrule_p.h:35
KMimeMagicMatch::m_subMatches
QList< KMimeMagicMatch > m_subMatches
Definition: kmimemagicrule_p.h:39
KMimeMagicRule::matches
QList< KMimeMagicMatch > matches() const
Definition: kmimemagicrule_p.h:64
KMimeMagicMatch
Definition: kmimemagicrule_p.h:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal