.TH "KMimeMagic" 3 "28 Jan 2004" "kio Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KMimeMagic \- \fBThis class or method is obsolete, it is provided for compatibility only.\fP 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.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kmimemagic.h>\fP
.PP
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKMimeMagic\fP ()"
.br
.RI "\fICreate a parser and initialize it with the KDE-global data: the 'magic' config file as well as the snippets from share/config/magic. \fP"
.ti -1c
.RI "\fBKMimeMagic\fP (const  \fBQString\fP &configFile)"
.br
.RI "\fICreate a parser and initialize it with the given config file. \fP"
.ti -1c
.RI "\fB~KMimeMagic\fP ()"
.br
.RI "\fIDestroy the parser. \fP"
.ti -1c
.RI "bool \fBmergeConfig\fP (const  \fBQString\fP &configFile)"
.br
.RI "\fIMerge an existing parse table with the data from the given file. \fP"
.ti -1c
.RI "bool \fBmergeBufConfig\fP (char *)"
.br
.RI "\fIMerge an existing parse table with the data from the given buffer. \fP"
.ti -1c
.RI "void \fBsetFollowLinks\fP (bool _enable)"
.br
.RI "\fIEnable/Disable follow-links. \fP"
.ti -1c
.RI "\fBKMimeMagicResult\fP * \fBfindFileType\fP (const  \fBQString\fP &_filename)"
.br
.RI "\fITry to find a MimeType for the given file. \fP"
.ti -1c
.RI "\fBKMimeMagicResult\fP * \fBfindBufferType\fP (const  \fBQByteArray\fP &p)"
.br
.RI "\fISame functionality as above, except data is not read from a file. \fP"
.ti -1c
.RI "\fBKMimeMagicResult\fP * \fBfindBufferFileType\fP (const  \fBQByteArray\fP &, const  \fBQString\fP &filename)"
.br
.RI "\fISame functionality as \fBfindBufferType\fP() but with additional capability of distinguishing between C-headers and C-Source. \fP"
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKMimeMagic\fP * \fBself\fP ()"
.br
.RI "\fIReturns a pointer to the unique KMimeMagic instance in this process. \fP"
.in -1c
.SS "Static Protected Member Functions"

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

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

.in +1c
.ti -1c
.RI "\fBKMimeMagic\fP * \fBs_pSelf\fP = 0L"
.br
.in -1c
.SH "Detailed Description"
.PP 
\fBThis class or method is obsolete, it is provided for compatibility only.\fP 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. 

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 : 
.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 100 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. \fBSince:\fP
.RS 4
3.1 
.RE
.PP
Definition at line 2045 of file kmimemagic.cpp.
.PP
References KGlobal::dirs(), KStandardDirs::findAllResources(), locate(), and mergeConfig().
.SS "KMimeMagic::KMimeMagic (const \fBQString\fP & configFile)"
.PP
Create a parser and initialize it with the given config file. Definition at line 2057 of file kmimemagic.cpp.
.SS "KMimeMagic::~\fBKMimeMagic\fP ()"
.PP
Destroy the parser. Definition at line 2086 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. \fBReturns:\fP
.RS 4
\fCtrue\fP on success. 
.RE
.PP
Definition at line 2103 of file kmimemagic.cpp.
.PP
References QString::isEmpty().
.PP
Referenced by KMimeMagic().
.SS "bool KMimeMagic::mergeBufConfig (char *)"
.PP
Merge an existing parse table with the data from the given buffer. \fBReturns:\fP
.RS 4
\fCtrue\fP on success. 
.RE
.PP
Definition at line 2121 of file kmimemagic.cpp.
.SS "void KMimeMagic::setFollowLinks (bool _enable)"
.PP
Enable/Disable follow-links. (Default is disabled.) Definition at line 2138 of file kmimemagic.cpp.
.SS "\fBKMimeMagicResult\fP * KMimeMagic::findFileType (const \fBQString\fP & _filename)"
.PP
Try to find a MimeType for the given file. 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
Definition at line 2201 of file kmimemagic.cpp.
.PP
References magicResult, KMimeMagicResult::setAccuracy(), KMimeMagicResult::setInvalid(), KMimeMagicResult::setMimeType(), and QString::stripWhiteSpace().
.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. 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
Definition at line 2144 of file kmimemagic.cpp.
.PP
References magicResult, KMimeMagicResult::setAccuracy(), KMimeMagicResult::setInvalid(), KMimeMagicResult::setMimeType(), and QString::stripWhiteSpace().
.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. 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
Definition at line 2190 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. Definition at line 30 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. Definition at line 196 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.
