kmimemagic.h
/* This file is part of the KDE project
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/*
* KMimeMagic is inspired by the code of the
* Apache Web Server.
*
* Rewritten for KDE by Fritz Elfert
* fritz@kde.org
* Adaptations by Torben Weis <weis@kde.org>
* Fixes and documentation by David Faure <faure@kde.org>
*/
#ifndef KMIMEMAGIC_H
#define KMIMEMAGIC_H
#include <qstring.h>
#include <kdelibs_export.h>
class KMimeMagic; // see below (read this one first)
class KIO_EXPORT_DEPRECATED KMimeMagicResult
{
public:
KMimeMagicResult() { m_iAccuracy = 100; }
~KMimeMagicResult() { }
QString mimeType() const { return m_strMimeType; }
int accuracy() const { return m_iAccuracy; }
bool isValid() const { return !m_strMimeType.isEmpty(); }
// Internal functions only
void setMimeType( const QString& _mime ) { m_strMimeType = _mime; }
void setAccuracy( int _accuracy ) { m_iAccuracy = _accuracy; }
void setInvalid() { m_strMimeType = QString::null; }
protected:
QString m_strMimeType;
int m_iAccuracy;
};
class KIO_EXPORT_DEPRECATED KMimeMagic
{
public:
KMimeMagic();
KMimeMagic( const QString & configFile );
~KMimeMagic();
bool mergeConfig( const QString & configFile );
bool mergeBufConfig(char *);
void setFollowLinks( bool _enable );
KMimeMagicResult* findFileType( const QString & _filename );
KMimeMagicResult* findBufferType( const QByteArray &p );
KMimeMagicResult * findBufferFileType( const QByteArray &, const QString & filename );
static KMimeMagic* self();
protected:
KMimeMagicResult * magicResult;
static void initStatic();
static KMimeMagic* s_pSelf;
private:
void init( const QString& configFile );
bool bunused;
QString sunused;
int parse_line(char *line, int *rule, int lineno);
int parse(char *, int);
int buff_apprentice(char*buff);
int apprentice(const QString &configFile);
struct config_rec *conf; // this is also our "d pointer"
int iunused;
};
#endif
KMimeMagic::magicResult
KMimeMagicResult * magicResult
The result type.
Definition: kmimemagic.h:197
KMimeMagicResult::accuracy
int accuracy() const
Retrieve the accuracy of the matching.
Definition: kmimemagic.h:59
KMimeMagicResult
Definition: kmimemagic.h:46
KMimeMagicResult::isValid
bool isValid() const
Returns whether the result is valid (i.e.
Definition: kmimemagic.h:63
KMimeMagicResult::mimeType
QString mimeType() const
Retrieve the mimetype (e.g.
Definition: kmimemagic.h:55
KMimeMagic
Definition: kmimemagic.h:101

KDE Home | KDE Accessibility Home | Description of Access Keys