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

kio/kio

  • kio
  • kio
kmimemagic.h
1 /* This file is part of the KDE project
2  Copyright (C) 1998, 1999 Torben Weis <weis@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 /*
21  * KMimeMagic is inspired by the code of the
22  * Apache Web Server.
23  *
24  * Rewritten for KDE by Fritz Elfert
25  * fritz@kde.org
26  * Adaptations by Torben Weis <weis@kde.org>
27  * Fixes and documentation by David Faure <faure@kde.org>
28  */
29 
30 #ifndef KMIMEMAGIC_H
31 #define KMIMEMAGIC_H
32 
33 #include <tqstring.h>
34 #include <kdelibs_export.h>
35 
36 class KMimeMagic; // see below (read this one first)
37 
46 class KIO_EXPORT KMimeMagicResult
47 {
48 public:
49  KMimeMagicResult() { m_iAccuracy = 100; }
50  ~KMimeMagicResult() { }
51 
55  TQString mimeType() const { return m_strMimeType; }
59  int accuracy() const { return m_iAccuracy; }
63  bool isValid() const { return !m_strMimeType.isEmpty(); }
64 
66  // Internal functions only
68  void setMimeType( const TQString& _mime ) { m_strMimeType = _mime; }
69  void setAccuracy( int _accuracy ) { m_iAccuracy = _accuracy; }
70  void setInvalid() { m_strMimeType = TQString::null; }
71 
72 protected:
73  TQString m_strMimeType;
74  int m_iAccuracy;
75 };
76 
101 class KIO_EXPORT KMimeMagic
102 {
103 public:
109  KMimeMagic();
110 
114  KMimeMagic( const TQString & configFile );
115 
119  ~KMimeMagic();
120 
127  bool mergeConfig( const TQString & configFile );
128 
134  void setFollowLinks( bool _enable );
135 
148  KMimeMagicResult* findFileType( const TQString & _filename );
149 
162  KMimeMagicResult* findBufferType( const TQByteArray &p );
163 
178  KMimeMagicResult * findBufferFileType( const TQByteArray &, const TQString & filename );
179 
183  static KMimeMagic* self();
184 
185 protected:
189  KMimeMagicResult * magicResult;
190 
191  static void initStatic();
192  static KMimeMagic* s_pSelf;
193 
194 private:
195  void init( const TQString& configFile );
196 
197  bool bunused;
198  TQString sunused;
199 
200  int parse_line(char *line, int *rule, int lineno);
201  int parse(char *, int);
202  int buff_apprentice(char*buff);
203  int apprentice(const TQString &configFile);
204 
205  struct config_rec *conf; // this is also our "d pointer"
206  int iunused;
207 };
208 
209 #endif
210 

kio/kio

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

kio/kio

Skip menu "kio/kio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kio/kio by doxygen 1.8.1.2
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |