.TH "KMimeMagic" kde3 "11 Jun 2005" "Version Version 3.4.1" "kio Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KMimeMagic \- 
.SH SYNOPSIS
.br
.PP
\fC#include <kmimemagic.h>\fP
.PP
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKMimeMagic\fP ()"
.br
.ti -1c
.RI "\fBKMimeMagic\fP (const \fBQString\fP &configFile)"
.br
.ti -1c
.RI "\fB~KMimeMagic\fP ()"
.br
.ti -1c
.RI "bool \fBmergeConfig\fP (const \fBQString\fP &configFile)"
.br
.ti -1c
.RI "bool \fBmergeBufConfig\fP (char *)"
.br
.ti -1c
.RI "void \fBsetFollowLinks\fP (bool _enable)"
.br
.ti -1c
.RI "\fBKMimeMagicResult\fP * \fBfindFileType\fP (const \fBQString\fP &_filename)"
.br
.ti -1c
.RI "\fBKMimeMagicResult\fP * \fBfindBufferType\fP (const \fBQByteArray\fP &p)"
.br
.ti -1c
.RI "\fBKMimeMagicResult\fP * \fBfindBufferFileType\fP (const \fBQByteArray\fP &, const \fBQString\fP &filename)"
.br
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "static \fBKMimeMagic\fP * \fBself\fP ()"
.br
.in -1c
.SS "Static Protected Member Functions"

.in +1c
.ti -1c
.RI "static void \fBinitStatic\fP ()"
.br
.in -1c
.SS "Protected Attributes"

.in +1c
.ti -1c
.RI "\fBKMimeMagicResult\fP * \fBmagicResult\fP"
.br
.in -1c
.SS "Static Protected Attributes"

.in +1c
.ti -1c
.RI "static \fBKMimeMagic\fP * \fBs_pSelf\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
\fBDeprecated\fP
.RS 4
Use \fBKMimeType::findByContent()\fP instead May be removed in \fBKDE\fP 4.0. Determine auto-magically the type of file, not only by using its extension, but also by reading its contents. 
.RE
.PP
.PP
Unless specified otherwise, KMimeMagic uses $KDEDIR/share/mimelnk/magic for this purpose.
.PP
To make KMimeMagic restore the 'atime' of a file after it opened it, add its directory in kmimemagicrc like: [Settings] atimeDirs=/tmp,/var/tmp,/home/dfaure/tmp This isn't done by default because it changes the 'ctime'. See \fBkmimemagic.cpp\fP for a full discussion on this issue.
.PP
The basic usage of KMimeMagic is : 
.PD 0

.IP "\(bu" 2
Get a pointer to it, using \fBKMimeMagic::self()\fP. 
.IP "\(bu" 2
Use it for any file or buffer you want, using one of the three \fCfind\fP...Type() methods.
.PP
The result is contained in the class \fBKMimeMagicResult\fP. 
.PP
Definition at line 101 of file kmimemagic.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KMimeMagic::KMimeMagic ()"
.PP
Create a parser and initialize it with the KDE-global data: the 'magic' config file as well as the snippets from share/config/magic. 
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP

.PP
Definition at line 2113 of file kmimemagic.cpp.
.PP
References KGlobal::dirs(), endl(), KStandardDirs::findAllResources(), k_funcinfo, kdWarning(), locate(), and mergeConfig().
.SS "KMimeMagic::KMimeMagic (const \fBQString\fP & configFile)"
.PP
Create a parser and initialize it with the given config file. 
.PP
Definition at line 2125 of file kmimemagic.cpp.
.SS "KMimeMagic::~\fBKMimeMagic\fP ()"
.PP
Destroy the parser. 
.PP
Definition at line 2154 of file kmimemagic.cpp.
.PP
References magicResult.
.SH "Member Function Documentation"
.PP 
.SS "bool KMimeMagic::mergeConfig (const \fBQString\fP & configFile)"
.PP
Merge an existing parse table with the data from the given file. 
.PP
\fBReturns:\fP
.RS 4
\fCtrue\fP on success. 
.RE
.PP

.PP
Definition at line 2171 of file kmimemagic.cpp.
.PP
References endl(), k_funcinfo, and kdDebug().
.PP
Referenced by KMimeMagic().
.SS "bool KMimeMagic::mergeBufConfig (char *)"
.PP
Merge an existing parse table with the data from the given buffer. 
.PP
\fBReturns:\fP
.RS 4
\fCtrue\fP on success. 
.RE
.PP

.PP
Definition at line 2189 of file kmimemagic.cpp.
.SS "void KMimeMagic::setFollowLinks (bool _enable)"
.PP
Enable/Disable follow-links. 
.PP
(Default is disabled.) 
.PP
Definition at line 2206 of file kmimemagic.cpp.
.SS "\fBKMimeMagicResult\fP * KMimeMagic::findFileType (const \fBQString\fP & _filename)"
.PP
Try to find a MimeType for the given file. 
.PP
If no special MimeType is found, the default MimeType is returned. This function looks at the content of the file.
.PP
\fBReturns:\fP
.RS 4
A pointer to the result object. Do \fInot\fP delete the result object. After another call to KMimeMagic the returned result object changes its value since it is reused by KMimeMagic. 
.RE
.PP

.PP
Definition at line 2279 of file kmimemagic.cpp.
.PP
References KMimeMagicResult::accuracy(), endl(), kdDebug(), magicResult, KMimeMagicResult::setAccuracy(), KMimeMagicResult::setInvalid(), and KMimeMagicResult::setMimeType().
.PP
Referenced by KMimeType::findByFileContent(), and KMimeType::findByURL().
.SS "\fBKMimeMagicResult\fP * KMimeMagic::findBufferType (const \fBQByteArray\fP & p)"
.PP
Same functionality as above, except data is not read from a file. 
.PP
Instead a buffer can be supplied which is examined.
.PP
\fBReturns:\fP
.RS 4
A pointer to the result object. Do \fInot\fP delete the result object. After another call to KMimeMagic the returned result object changes its value since it is reused by KMimeMagic. 
.RE
.PP

.PP
Definition at line 2212 of file kmimemagic.cpp.
.PP
References KMimeMagicResult::accuracy(), magicResult, KMimeMagicResult::setAccuracy(), KMimeMagicResult::setInvalid(), and KMimeMagicResult::setMimeType().
.PP
Referenced by findBufferFileType(), and KMimeType::findByContent().
.SS "\fBKMimeMagicResult\fP * KMimeMagic::findBufferFileType (const \fBQByteArray\fP &, const \fBQString\fP & filename)"
.PP
Same functionality as \fBfindBufferType()\fP but with additional capability of distinguishing between C-headers and C-Source. 
.PP
For this purpose this function looks at the extension of the filename. This means that 'filename' can be a filename on some FTP server, too.
.PP
\fBReturns:\fP
.RS 4
A pointer to the result object. Do \fInot\fP delete the result object. After another call to KMimeMagic the returned result object changes its value since it is reused by KMimeMagic. 
.RE
.PP

.PP
Definition at line 2268 of file kmimemagic.cpp.
.PP
References findBufferType().
.SS "\fBKMimeMagic\fP * KMimeMagic::self ()\fC [static]\fP"
.PP
Returns a pointer to the unique KMimeMagic instance in this process. 
.PP
Definition at line 41 of file kmimemagic.cpp.
.PP
Referenced by KMimeType::findByContent(), KMimeType::findByFileContent(), and KMimeType::findByURL().
.SH "Member Data Documentation"
.PP 
.SS "\fBKMimeMagicResult\fP* \fBKMimeMagic::magicResult\fP\fC [protected]\fP"
.PP
The result type. 
.PP
Definition at line 197 of file kmimemagic.h.
.PP
Referenced by findBufferType(), findFileType(), and ~KMimeMagic().

.SH "Author"
.PP 
Generated automatically by Doxygen for kio Library from the source code.
