Public Methods
- KMimeMagic ( const QString & configFile )
- ~ KMimeMagic ()
- bool mergeConfig ( const QString & configFile )
- bool mergeBufConfig (char *)
- void setFollowLinks ( bool _enable )
- KMimeMagicResult* findFileType ( const QString & _filename )
- KMimeMagicResult* findBufferType ( const QByteArray &p )
- KMimeMagicResult * findBufferFileType ( const QByteArray &, const QString & filename )
- void resultBufPrintf (char *, ...)
- int finishResult ()
- void process (const char *)
- void tryit (unsigned char *, int)
- int fsmagic (const char *, struct stat *)
- int match (unsigned char *, int)
- void mprint (union VALUETYPE *, struct magic *)
- int parse_line (char *line, int *rule, int lineno)
- int parse (char *, int)
- int buff_apprentice (char*buff)
- int apprentice ()
- int ascmagic (unsigned char *, int)
- int internatmagic (unsigned char *, int)
- int softmagic (unsigned char *, int)
Public Static Methods
Detailed Description
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.
The basic usage of KMimeMagic is :
- Get a pointer to it, using KMimeMagic::self().
- Use it for any file or buffer you want, using one of the three
find...Type()
methods.
The result is contained in the class KMimeMagicResult.
KMimeMagic ( const QString & configFile )
|
Create a parser and initialize it with the given config file.
Destroy the parser.
bool mergeConfig ( const QString & configFile )
|
Merge an existing parse table with the data from the
given file.
Returns: true
on success.
bool mergeBufConfig (char *)
|
Merge an existing parse table with the data from the
given buffer.
Returns: true
on success.
void setFollowLinks ( bool _enable )
|
Enable/Disable follow-links.
(Default is disabled.)
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.
Returns: A pointer to the result object. Do not delete the
result object. After another call to KMimeMagic
the returned result object changes its value
since it is reused by KMimeMagic.
Same functionality as above, except data is not
read from a file.
Instead a buffer can be supplied which
is examined. The integer parameter supplies the length of
the buffer.
Returns: A pointer to the result object. Do not delete the
result object. After another call to KMimeMagic
the returned result object changes its value
since it is reused by KMimeMagic.
KMimeMagicResult * findBufferFileType ( const QByteArray &, const QString & filename )
|
Same functionality as findBufferType() 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.
Returns: A pointer to the result object. Do not delete the
result object. After another call to KMimeMagic
the returned result object changes its value
since it is reused by KMimeMagic.
[static]
Returns a pointer to the unique KMimeMagic instance in this process.
[static]
void resultBufPrintf (char *, ...)
|
The current result buffer during inspection.
void process (const char *)
|
void tryit (unsigned char *, int)
|
int fsmagic (const char *, struct stat *)
|
int match (unsigned char *, int)
|
void mprint (union VALUETYPE *, struct magic *)
|
int parse_line (char *line, int *rule, int lineno)
|
int buff_apprentice (char*buff)
|
int ascmagic (unsigned char *, int)
|
int internatmagic (unsigned char *, int)
|
int softmagic (unsigned char *, int)
|