# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KFileMetaInfoGroup Class Reference

This is one group of meta information items about a file (see KFileMetaInfo). A group of meta information items about a file. More...

`#include <kfilemetainfo.h>`

List of all members.

## Public Member Functions

class | KFileMetaInfoGroup (const QString &name, const KFileMimeTypeInfo *info)
| KFileMetaInfoGroup (const KFileMetaInfoGroup &original)
const KFileMetaInfoGroup & | operator= (const KFileMetaInfoGroup &info)
| KFileMetaInfoGroup ()
bool | isValid () const
bool | isEmpty () const
bool | isModified () const
KFileMetaInfoItem | operator[] (const QString &key) const
KFileMetaInfoItem | item (const QString &key) const
KFileMetaInfoItem | item (uint hint) const
const QVariant | value (const QString &key) const
QStringList | supportedKeys () const
bool | supportsVariableKeys () const
bool | contains (const QString &key) const
QStringList | keys () const
QStringList | preferredKeys () const
KFileMetaInfoItem | addItem (const QString &key)
bool | removeItem (const QString &key)
QStringList | removedItems ()
QString | name () const
QString | translatedName () const
uint | attributes () const

## Protected Member Functions

void | setAdded ()
KFileMetaInfoItem | appendItem (const QString &key, const QVariant &value)
void | ref ()
void | deref ()

## Protected Attributes

Data * | d

## Friends

class | KFilePlugin
class | KFileMetaInfo
KIO_EXPORT friend QDataStream & | operator>> (QDataStream &s, KFileMetaInfoGroup &)
KIO_EXPORT friend QDataStream & | operator<< (QDataStream &s, const KFileMetaInfoGroup &)

## Detailed Description

This is one group of meta information items about a file (see KFileMetaInfo). A group of meta information items about a file.

Definition at line 664 of file kfilemetainfo.h.

## Constructor & Destructor Documentation

KFileMetaInfoGroup::KFileMetaInfoGroup | ( | const KFileMetaInfoGroup & | original | ) |

| Copy constructor. Definition at line 1168 of file kfilemetainfo.cpp.

KFileMetaInfoGroup::KFileMetaInfoGroup | ( |  | ) |

Default constructor.

This creates an "invalid" item

Since:
  3.1

Definition at line 1175 of file kfilemetainfo.cpp.

## Member Function Documentation

const KFileMetaInfoGroup & KFileMetaInfoGroup::operator= | ( | const KFileMetaInfoGroup & | info | ) |

The assignment operator, so you can do:

        KFileMetaInfoGroup group = info.group("Technical");

.

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 1185 of file kfilemetainfo.cpp.

References d.

bool KFileMetaInfoGroup::isValid | ( |  | ) | const

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

if it contains data, false if it's invalid (created with the default constructor and not been assigned anything), or if KFileMetaInfoGroup::item() didn't find your requested item).

Returns:
  true if valid, false if invalid

Definition at line 1198 of file kfilemetainfo.cpp.

Referenced by addItem(), attributes(), preferredKeys(), removeItem(), supportedKeys(), supportsVariableKeys(), and translatedName().

bool KFileMetaInfoGroup::isEmpty | ( |  | ) | const

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

An empty group is a group with no items (amazing, isn't it?).

Returns:
  true if empty, false otherwise

Definition at line 1204 of file kfilemetainfo.cpp.

bool KFileMetaInfoGroup::isModified | ( |  | ) | const

Returns true if an item as added or removed from the group.

Returns:
  true if an item was added or removed from the group, otherwise false.

Since:
  3.1

Definition at line 1314 of file kfilemetainfo.cpp.

KFileMetaInfoItem KFileMetaInfoGroup::operator[] | ( | const QString & | key | ) | const`[inline]`

| Operator for convenience. It does the same as item(), but you cannot specify a group to search in Definition at line 733 of file kfilemetainfo.h.

KFileMetaInfoItem KFileMetaInfoGroup::item | ( | const QString & | key | ) | const

This method searches for the specified item.

Parameters:

  | key | the key of the item to search

Returns:
  the specified item if found, an invalid item, if not

Definition at line 1278 of file kfilemetainfo.cpp.

References QMapIterator::data().

KFileMetaInfoItem KFileMetaInfoGroup::item | ( | uint | hint | ) | const

Returns the item with the given `hint`.

Parameters:

  | hint | the hint of the item

Returns:
  the item with the specified `hint`

Definition at line 1287 of file kfilemetainfo.cpp.

References QMapIterator::data().

const QVariant KFileMetaInfoGroup::value | ( | const QString & | key | ) | const`[inline]`

Convenience function.

Returns the value of the specified key. It does the same as item(key).value().

Parameters:

  | key | the key of the item to search

Returns:
  the value with the given key

Definition at line 757 of file kfilemetainfo.h.

References KFileMetaInfoItem::value().

QStringList KFileMetaInfoGroup::supportedKeys | ( |  | ) | const

Use this method to get a list of keys in the specified group that the plugin knows about.

No variable keys. For a group that doesn't support variable keys, all keys that this group may have are returned. For a group that does support them, the non-variable ones are returned. See KFileMetaInfo about variable keys

Returns:
  the list of keys supported for this mimetype

Definition at line 1261 of file kfilemetainfo.cpp.

References isValid().

bool KFileMetaInfoGroup::supportsVariableKeys | ( |  | ) | const

Returns true if this group supports adding or removing arbitrary keys, false if not.

Returns:
  true is variable keys are supported, false otherwise

Definition at line 1267 of file kfilemetainfo.cpp.

References isValid().

bool KFileMetaInfoGroup::contains | ( | const QString & | key | ) | const

Checks whether an item with the given `key` exists.

Returns:
  true if an item for this `key` exists.

Definition at line 1273 of file kfilemetainfo.cpp.

Referenced by KFileMetaInfo::contains().

QStringList KFileMetaInfoGroup::keys | ( |  | ) | const

Returns a list of all keys.

Returns:
  a list of all keys in the order they were inserted.

Definition at line 1237 of file kfilemetainfo.cpp.

References QMapConstIterator::data(), kdWarning(), and QMapConstIterator::key().

Referenced by preferredKeys().

QStringList KFileMetaInfoGroup::preferredKeys | ( |  | ) | const

Returns a list of all keys in preference order.

Returns:
  a list of all keys in preference order.

Definition at line 1209 of file kfilemetainfo.cpp.

References isValid(), keys(), and preferredKeys().

Referenced by preferredKeys().

KFileMetaInfoItem KFileMetaInfoGroup::addItem | ( | const QString & | key | ) |

Add an item to the info.

This is only possible if the specified `key` is in the supportedKeys list and not yet defined or if the group supports variable keys.

Parameters:

  | key | the key of the item

Returns:
  the KFileMetaInfoItem for the given `key`

Definition at line 1340 of file kfilemetainfo.cpp.

References QMapIterator::data(), isValid(), KFileMimeTypeInfo::ItemInfo::isVariableItem(), KFileMimeTypeInfo::GroupInfo::itemInfo(), KFileMetaInfoItem::setAdded(), and KFileMimeTypeInfo::GroupInfo::variableItemInfo().

Referenced by KFileMetaInfo::saveItem().

bool KFileMetaInfoGroup::removeItem | ( | const QString & | key | ) |

Remove this item from the meta info of the file.

You cannot query KFileMetaInfo for a removed object, but you can query for a list of removed items with removedItems() if you need to. If you re-add it, its value will be cleared.

Parameters:

  | key | the key of the removed item

Returns:
  true if successful, false otherwise

Definition at line 1374 of file kfilemetainfo.cpp.

References isValid(), and kdDebug().

QStringList KFileMetaInfoGroup::removedItems | ( |  | ) |

Returns a list of all removed items.

Returns:
  a list of all removed items

Definition at line 1402 of file kfilemetainfo.cpp.

QString KFileMetaInfoGroup::name | ( |  | ) | const

The name of this group.

Returns:
  the name of this group

Definition at line 1298 of file kfilemetainfo.cpp.

QString KFileMetaInfoGroup::translatedName | ( |  | ) | const

The translated name of this group.

Returns:
  the translated name of this group

Since:
  3.2

Definition at line 1255 of file kfilemetainfo.cpp.

References isValid().

uint KFileMetaInfoGroup::attributes | ( |  | ) | const

Returns the attributes of this item.

Returns:
  the attributes

Definition at line 1303 of file kfilemetainfo.cpp.

References isValid().

The documentation for this class was generated from the following files:

- kfilemetainfo.h
- kfilemetainfo.cpp

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:24:40 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003