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

tdeio/tdeio

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
KFileMetaInfo Class Reference

#include <tdefilemetainfo.h>

Public Types

enum  What {
  Fastest = 0x1, DontCare = 0x2, TechnicalInfo = 0x4, ContentInfo = 0x8,
  ExtenedAttr = 0x10, Thumbnail = 0x20, Preferred = 0x40, Everything = 0xffff
}
 
typedef KFileMimeTypeInfo::Hint Hint
 
typedef KFileMimeTypeInfo::Unit Unit
 
typedef
KFileMimeTypeInfo::Attributes 
Attributes
 

Public Member Functions

 KFileMetaInfo (const TQString &path, const TQString &mimeType=TQString::null, uint what=Fastest)
 
 KFileMetaInfo (const KURL &url, const TQString &mimeType=TQString::null, uint what=Fastest)
 
 KFileMetaInfo ()
 
 KFileMetaInfo (const KFileMetaInfo &original)
 
const KFileMetaInfo & operator= (const KFileMetaInfo &info)
 
TQStringList groups () const
 
TQStringList supportedGroups () const
 
TQStringList preferredGroups () const
 
TQStringList preferredKeys () const
 
TQStringList supportedKeys () const
 
TQStringList editableGroups () const
 
KFileMetaInfoItem item (const TQString &key) const
 
KFileMetaInfoItem item (const KFileMetaInfoItem::Hint hint) const
 
KFileMetaInfoItem saveItem (const TQString &key, const TQString &preferredGroup=TQString::null, bool createGroup=true)
 
KFileMetaInfoGroup group (const TQString &key) const
 
KFileMetaInfoGroup operator[] (const TQString &key) const
 
bool addGroup (const TQString &name)
 
bool removeGroup (const TQString &name)
 
TQStringList removedGroups ()
 
bool applyChanges ()
 
bool applyChanges (const TQString &path)
 
bool contains (const TQString &key) const
 
bool containsGroup (const TQString &key) const
 
const TQVariant value (const TQString &key) const
 
bool isValid () const
 
bool isEmpty () const
 
TQString mimeType () const
 
TQString path () const
 
KURL url () const
 

Protected Member Functions

KFileMetaInfoGroup appendGroup (const TQString &name)
 
KFilePlugin * plugin () const
 
void ref ()
 
void deref ()
 

Protected Attributes

Data * d
 

Friends

class KFilePlugin
 
TDEIO_EXPORT friend TQDataStream & operator>> (TQDataStream &s, KFileMetaInfo &)
 
TDEIO_EXPORT friend TQDataStream & operator<< (TQDataStream &s, const KFileMetaInfo &)
 

Detailed Description

Meta Information about a file.

This is the class for objects that hold meta information about a file. The information is kept in form of a system of key/value pairs. See also KFileMetaInfoItem. This information is retrieved from the file through a plugin system, and this class is the main interface to it. If you want to write your own plugin, have a look at KFilePlugin. There are basically two different kinds of meta information: Fixed ones that the plugin knows about (e.g. an mp3 id3v1 tag has a well defined fixed list of fields), and variable keys that exist in mimetypes that support their own key/value system (comments in png files are of this type). Almost every file has fixed keys, but some also have variable keys.

The groups and the What enum are not yet supported, but already added to the interface so that adding support doesn't break compatibility.

Definition at line 926 of file tdefilemetainfo.h.

Member Enumeration Documentation

enum KFileMetaInfo::What

This is used to specify what a KFileMetaInfo object should read, so you can specify if you want to read "expensive" items or not.

Enumerator
Fastest 

do the fastest possible read and omit all items that might need a significantly longer time than the others

DontCare 

let the plugin decide what to read

TechnicalInfo 

extract technical details about the file, like e.g.

play time, resolution or a compressioni type

ContentInfo 

read information about the content of the file, like comments or id3 tags

ExtenedAttr 

read filesystem based extended attributes if they are supported for the filesystem

Thumbnail 

only read the file's thumbnail, if it contains one

Preferred 

get at least the preferred items

Everything 

read everything, even if it might take a while

Definition at line 938 of file tdefilemetainfo.h.

Constructor & Destructor Documentation

KFileMetaInfo::KFileMetaInfo ( const TQString &  path,
const TQString &  mimeType = TQString::null,
uint  what = Fastest 
)

The constructor.

creating a KFileMetaInfo item through this will autoload the plugin belonging to the mimetype and try to get meta information about the specified file.

If no info is available, you'll get an empty (not invalid) object. You can test for it with the isEmpty() method.

Parameters
pathThe file name. This must be the path to a local file.
mimeTypeThe name of the file's mimetype. If ommited, the mimetype is autodetected
whatone or more of the What enum values. It gives some hint to the plugin what information is desired. The plugin may still return more items.
Note
This version will only work for local (file:/) files.

Definition at line 297 of file tdefilemetainfo.cpp.

KFileMetaInfo::KFileMetaInfo ( const KURL &  url,
const TQString &  mimeType = TQString::null,
uint  what = Fastest 
)

Another constructor.

Similar to the above, but takes a URL so that meta-data may be retrieved over other protocols (ftp, etc.)

Definition at line 306 of file tdefilemetainfo.cpp.

KFileMetaInfo::KFileMetaInfo ( )

Default constructor.

This will create an invalid object (see isValid().

Definition at line 355 of file tdefilemetainfo.cpp.

KFileMetaInfo::KFileMetaInfo ( const KFileMetaInfo &  original)

Copy constructor.

This creates a copy of the original object, but that copy will point to the same data, so if you change the original, the copy will be changed, too. After all, they are referring to the same file.

Definition at line 348 of file tdefilemetainfo.cpp.

Member Function Documentation

bool KFileMetaInfo::addGroup ( const TQString &  name)

Try to add the specified group.

This will only succeed if it is in the list of editableGroups().

Note
that all non-variable items that belong to this group are automatically added as empty item.
Parameters
namethe name of the group to add
Returns
true if successful, false if not

Definition at line 450 of file tdefilemetainfo.cpp.

bool KFileMetaInfo::applyChanges ( )

This method writes all pending changes of the meta info back to the file.

If any items are marked as removed, they are really removed from the list. The info object as well as all items are updated.

Returns
true if successful, false if not

Definition at line 532 of file tdefilemetainfo.cpp.

bool KFileMetaInfo::applyChanges ( const TQString &  path)

This method writes all pending changes of the meta info to the file path.

If any items are marked as removed, they are really removed from the list. The info object as well as all items are updated.

Returns
true if successful, false if not

Definition at line 537 of file tdefilemetainfo.cpp.

bool KFileMetaInfo::contains ( const TQString &  key) const

Checks whether an item with the given key exists.

Parameters
keythe key to check
Returns
whether an item for this key exists.

Definition at line 598 of file tdefilemetainfo.cpp.

bool KFileMetaInfo::containsGroup ( const TQString &  key) const

Checks whether a group with the given key exists.

Parameters
keythe key to check
Returns
whether a group with this name exists.

Definition at line 609 of file tdefilemetainfo.cpp.

TQStringList KFileMetaInfo::editableGroups ( ) const

Returns the list of groups that you can add or remove from the file.

Returns
the groups can be added or removed

Definition at line 387 of file tdefilemetainfo.cpp.

KFileMetaInfoGroup KFileMetaInfo::group ( const TQString &  key) const

Returns the KFileMetaInfoGroup with the given key.

Parameters
keythe key of the item
Returns
the group. Invalid if there is no group with the given key.

Definition at line 441 of file tdefilemetainfo.cpp.

TQStringList KFileMetaInfo::groups ( ) const

Returns a list of all groups.

Returns
the keys of the groups that the file has.

Definition at line 377 of file tdefilemetainfo.cpp.

bool KFileMetaInfo::isEmpty ( ) const

Returns false if the object contains data, true if it's empty.

You'll get an empty object if no plugin for the file could be found.

Returns
true if empty, false otherwise

Definition at line 523 of file tdefilemetainfo.cpp.

bool KFileMetaInfo::isValid ( ) const

Returns true if the item is valid, i.e.

if actually represents the info about a file, false if the object is uninitialized.

Returns
true if valid, false otherwise

Definition at line 517 of file tdefilemetainfo.cpp.

KFileMetaInfoItem KFileMetaInfo::item ( const TQString &  key) const

Returns the KFileMetaInfoItem with the given key.

Parameters
keythe key of the item
Returns
the item. Invalid if there is no item with the given key.

Definition at line 614 of file tdefilemetainfo.cpp.

KFileMetaInfoItem KFileMetaInfo::item ( const KFileMetaInfoItem::Hint  hint) const

Returns the KFileMetaInfoItem with the given hint.

Parameters
hintthe hint of the item
Returns
the item. Invalid if there is no item with the given hint.

Definition at line 625 of file tdefilemetainfo.cpp.

TQString KFileMetaInfo::mimeType ( ) const

Returns the mime type of file.

Returns
the file's mime type

Definition at line 592 of file tdefilemetainfo.cpp.

const KFileMetaInfo & KFileMetaInfo::operator= ( const KFileMetaInfo &  info)

The assignment operator, so you can do e.g.

:

KFileMetaInfo info;
if (something) info = KFileMetaInfo("/the/file");

This will create a shared copy of the object. The actual data is automatically deleted if all copies go out of scope.

Definition at line 504 of file tdefilemetainfo.cpp.

KFileMetaInfoGroup KFileMetaInfo::operator[] ( const TQString &  key) const
inline

Returns the KFileMetaInfoGroup with the given key.

Parameters
keythe key of the item
Returns
the group. Invalid if there is no group with the given key.

Definition at line 1108 of file tdefilemetainfo.h.

TQString KFileMetaInfo::path ( ) const

Returns the path of file - or TQString::null if file is non-local.

Returns
the file's path - or TQString::null if file is non-local

Definition at line 734 of file tdefilemetainfo.cpp.

KFilePlugin * KFileMetaInfo::plugin ( ) const
protected
Returns
a pointer to the plugin that belogs to this object's mimetype. It will be auto-loaded if it's currently not loaded

Definition at line 585 of file tdefilemetainfo.cpp.

TQStringList KFileMetaInfo::preferredGroups ( ) const

Returns a list of the preferred groups.

Returns
the keys of the preferred groups that the file has.

Definition at line 402 of file tdefilemetainfo.cpp.

TQStringList KFileMetaInfo::preferredKeys ( ) const

Returns a list of all preferred keys.

Returns
a list of all preferred keys.

Definition at line 428 of file tdefilemetainfo.cpp.

TQStringList KFileMetaInfo::removedGroups ( )

Returns a list of removed groups.

Returns
a list of removed groups.

Definition at line 499 of file tdefilemetainfo.cpp.

bool KFileMetaInfo::removeGroup ( const TQString &  name)

Remove the specified group.

This will only succeed if it is in the list of editableGroups(). Beware that this also removes all the items in that group, so always ask the user before removing it!

Parameters
namethe name of the group to remove
Returns
true if successful, false if not

Definition at line 487 of file tdefilemetainfo.cpp.

KFileMetaInfoItem KFileMetaInfo::saveItem ( const TQString &  key,
const TQString &  preferredGroup = TQString::null,
bool  createGroup = true 
)

Saves the item with the given key.

Parameters
keythe key of the item
preferredGroupthe preferred group, or TQString::null
createGrouptrue to create the group if necessary
Returns
the saved item

Definition at line 637 of file tdefilemetainfo.cpp.

TQStringList KFileMetaInfo::supportedGroups ( ) const

Returns a list of all supported groups.

Returns
the supported keys of the groups that the file has.

Definition at line 365 of file tdefilemetainfo.cpp.

TQStringList KFileMetaInfo::supportedKeys ( ) const

Returns a list of supported keys.

Returns
a list of supported keys

Definition at line 371 of file tdefilemetainfo.cpp.

KURL KFileMetaInfo::url ( ) const

Returns the url of file.

Returns
the file's url

Definition at line 739 of file tdefilemetainfo.cpp.

const TQVariant KFileMetaInfo::value ( const TQString &  key) const
inline

Returns the value with the given key.

Parameters
keythe key to retrieve
Returns
the value. Invalid if it does not exist

Definition at line 1183 of file tdefilemetainfo.h.


The documentation for this class was generated from the following files:
  • tdefilemetainfo.h
  • tdefilemetainfo.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.