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

tdeio/tdeio

Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
KMimeMagic Class Reference

#include <kmimemagic.h>

Public Member Functions

 KMimeMagic ()
 
 KMimeMagic (const TQString &configFile)
 
 ~KMimeMagic ()
 
bool mergeConfig (const TQString &configFile)
 
void setFollowLinks (bool _enable)
 
KMimeMagicResult * findFileType (const TQString &_filename)
 
KMimeMagicResult * findBufferType (const TQByteArray &p)
 
KMimeMagicResult * findBufferFileType (const TQByteArray &, const TQString &filename)
 

Static Public Member Functions

static KMimeMagic * self ()
 

Static Protected Member Functions

static void initStatic ()
 

Protected Attributes

KMimeMagicResult * magicResult
 

Static Protected Attributes

static KMimeMagic * s_pSelf
 

Detailed Description

Deprecated:
Use KMimeType::findByContent() instead May be removed in KDE 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 $TDEDIR/share/mimelnk/magic for this purpose.

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 kmimemagic.cpp for a full discussion on this issue.

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.

Definition at line 101 of file kmimemagic.h.

Constructor & Destructor Documentation

KMimeMagic::KMimeMagic ( )

Create a parser and initialize it with the KDE-global data: the "magic" config file as well as the snippets from share/config/magic.

Since
3.1

Definition at line 216 of file kmimemagic.cpp.

KMimeMagic::KMimeMagic ( const TQString &  configFile)

Create a parser and initialize it with the given config file.

Definition at line 229 of file kmimemagic.cpp.

KMimeMagic::~KMimeMagic ( )

Destroy the parser.

Definition at line 254 of file kmimemagic.cpp.

Member Function Documentation

KMimeMagicResult * KMimeMagic::findBufferFileType ( const TQByteArray &  data,
const TQString &  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.

Definition at line 351 of file kmimemagic.cpp.

KMimeMagicResult * KMimeMagic::findBufferType ( const TQByteArray &  p)

Same functionality as above, except data is not read from a file.

Instead a buffer can be supplied which is examined.

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.

Definition at line 289 of file kmimemagic.cpp.

KMimeMagicResult * KMimeMagic::findFileType ( const TQString &  _filename)

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.

Definition at line 360 of file kmimemagic.cpp.

bool KMimeMagic::mergeConfig ( const TQString &  configFile)

Merge an existing parse table with the data from the given file.

Returns
true on success.

Definition at line 263 of file kmimemagic.cpp.

KMimeMagic * KMimeMagic::self ( )
static

Returns a pointer to the unique KMimeMagic instance in this process.

Definition at line 49 of file kmimemagic.cpp.

void KMimeMagic::setFollowLinks ( bool  _enable)

Enable/Disable follow-links.

(Default is disabled.)

Definition at line 285 of file kmimemagic.cpp.

Member Data Documentation

KMimeMagicResult* KMimeMagic::magicResult
protected

The result type.

Definition at line 189 of file kmimemagic.h.


The documentation for this class was generated from the following files:
  • kmimemagic.h
  • kmimemagic.cpp

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • Modules
  • 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
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.8.8
This website is maintained by Timothy Pearson.