• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdeio
 

tdeio/tdeio

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., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, 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 <tqstring.h>
00034 #include <tdelibs_export.h>
00035 
00036 class KMimeMagic; // see below (read this one first)
00037 
00046 class TDEIO_EXPORT KMimeMagicResult
00047 {
00048 public:
00049   KMimeMagicResult() { m_iAccuracy = 100; }
00050   ~KMimeMagicResult() { }
00051 
00055   TQString 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 TQString& _mime ) { m_strMimeType = _mime; }
00069   void setAccuracy( int _accuracy ) { m_iAccuracy = _accuracy; }
00070   void setInvalid() { m_strMimeType = TQString::null; }
00071 
00072 protected:
00073   TQString m_strMimeType;
00074   int m_iAccuracy;
00075 };
00076 
00101 class TDEIO_EXPORT KMimeMagic
00102 {
00103 public:
00109   KMimeMagic();
00110 
00114   KMimeMagic( const TQString & configFile );
00115 
00119   ~KMimeMagic();
00120 
00127   bool mergeConfig( const TQString & configFile );
00128 
00134   void setFollowLinks( bool _enable );
00135 
00148   KMimeMagicResult* findFileType( const TQString & _filename );
00149 
00162   KMimeMagicResult* findBufferType( const TQByteArray &p );
00163 
00178   KMimeMagicResult * findBufferFileType( const TQByteArray &, const TQString & filename );
00179 
00183   static KMimeMagic* self();
00184 
00185 protected:
00189   KMimeMagicResult * magicResult;
00190 
00191   static void initStatic();
00192   static KMimeMagic* s_pSelf;
00193 
00194 private:
00195   void init( const TQString& configFile );
00196 
00197   bool bunused;
00198   TQString sunused;
00199 
00200   int parse_line(char *line, int *rule, int lineno);
00201   int parse(char *, int);
00202   int buff_apprentice(char*buff);
00203   int apprentice(const TQString &configFile);
00204 
00205   struct config_rec *conf; // this is also our "d pointer"
00206   int iunused;
00207 };
00208 
00209 #endif
00210 

tdeio/tdeio

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

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.