# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kmimemagic.h

    00001 /* This file is part of the KDE project
    00002    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
    00003
    00004    This library is free software; you can redistribute it and/or
    00005    modify it under the terms of the GNU Library General Public
    00006    License as published by the Free Software Foundation; either
    00007    version 2 of the License, or (at your option) any later version.
    00008
    00009    This library is distributed in the hope that it will be useful,
    00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012    Library General Public License for more details.
    00013
    00014    You should have received a copy of the GNU Library General Public License
    00015    along with this library; see the file COPYING.LIB.  If not, write to
    00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017    Boston, MA 02111-1307, USA.
    00018 */
    00019
    00020 /*
    00021  * KMimeMagic is inspired by the code of the
    00022  * Apache Web Server.
    00023  *
    00024  * Rewritten for KDE by Fritz Elfert
    00025  * fritz@kde.org
    00026  * Adaptations by Torben Weis <weis@kde.org>
    00027  * Fixes and documentation by David Faure <faure@kde.org>
    00028  */
    00029
    00030 #ifndef KMIMEMAGIC_H
    00031 #define KMIMEMAGIC_H
    00032
    00033 #include <qstring.h>
    00034 #include <kdelibs_export.h>
    00035
    00036 class KMimeMagic; // see below (read this one first)
    00037
    00046 class KIO_EXPORT_DEPRECATED KMimeMagicResult
    00047 {
    00048 public:
    00049   KMimeMagicResult() { m_iAccuracy = 100; }
    00050   ~KMimeMagicResult() { }
    00051
    00055   QString mimeType() const { return m_strMimeType; }
    00059   int accuracy() const { return m_iAccuracy; }
    00063   bool isValid() const { return !m_strMimeType.isEmpty(); }
    00064
    00066   // Internal functions only
    00068   void setMimeType( const QString& _mime ) { m_strMimeType = _mime; }
    00069   void setAccuracy( int _accuracy ) { m_iAccuracy = _accuracy; }
    00070   void setInvalid() { m_strMimeType = QString::null; }
    00071
    00072 protected:
    00073   QString m_strMimeType;
    00074   int m_iAccuracy;
    00075 };
    00076
    00101 class KIO_EXPORT_DEPRECATED KMimeMagic
    00102 {
    00103 public:
    00109   KMimeMagic();
    00110
    00114   KMimeMagic( const QString & configFile );
    00115
    00119   ~KMimeMagic();
    00120
    00127   bool mergeConfig( const QString & configFile );
    00128
    00135   bool mergeBufConfig(char *);
    00136
    00142   void setFollowLinks( bool _enable );
    00143
    00156   KMimeMagicResult* findFileType( const QString & _filename );
    00157
    00170   KMimeMagicResult* findBufferType( const QByteArray &p );
    00171
    00186   KMimeMagicResult * findBufferFileType( const QByteArray &, const QString & filename );
    00187
    00191   static KMimeMagic* self();
    00192
    00193 protected:
    00197   KMimeMagicResult * magicResult;
    00198
    00199   static void initStatic();
    00200   static KMimeMagic* s_pSelf;
    00201
    00202 private:
    00203   void init( const QString& configFile );
    00204
    00205   bool bunused;
    00206   QString sunused;
    00207
    00208   int parse_line(char *line, int *rule, int lineno);
    00209   int parse(char *, int);
    00210   int buff_apprentice(char*buff);
    00211   int apprentice(const QString &configFile);
    00212
    00213   struct config_rec *conf; // this is also our "d pointer"
    00214   int iunused;
    00215 };
    00216
    00217 #endif
    00218

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:24:00 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003