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

tdeio/tdeio

  • tdeio
  • tdeio
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 <tdelibs_export.h>
35
36class KMimeMagic; // see below (read this one first)
37
46class TDEIO_EXPORT KMimeMagicResult
47{
48public:
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
72protected:
73 TQString m_strMimeType;
74 int m_iAccuracy;
75};
76
101class TDEIO_EXPORT KMimeMagic
102{
103public:
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
185protected:
189 KMimeMagicResult * magicResult;
190
191 static void initStatic();
192 static KMimeMagic* s_pSelf;
193
194private:
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
KMimeMagicResult
Definition kmimemagic.h:47
KMimeMagicResult::mimeType
TQString mimeType() const
Retrieve the mimetype (e.g.
Definition kmimemagic.h:55
KMimeMagicResult::isValid
bool isValid() const
Returns whether the result is valid (i.e.
Definition kmimemagic.h:63
KMimeMagicResult::accuracy
int accuracy() const
Retrieve the accuracy of the matching.
Definition kmimemagic.h:59
KMimeMagic
Definition kmimemagic.h:102
KMimeMagic::magicResult
KMimeMagicResult * magicResult
The result type.
Definition kmimemagic.h:189

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • 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.9.8
This website is maintained by Timothy Pearson.