Home · All Classes · All Namespaces · Modules · Functions · Files

KeyFile Class Reference

#include <TelepathyQt4/KeyFile>

List of all members.

Public Types

Public Member Functions


Detailed Description

The KeyFile class provides an easy way to read key-pair files such as INI style files and .desktop files.

It follows the rules regarding string escaping as defined in http://standards.freedesktop.org/desktop-entry-spec/latest/index.html


Member Enumeration Documentation

enum Status

Enumerator:
None 
NoError 
NotFoundError 
AccessError 
FormatError 


Constructor & Destructor Documentation

KeyFile (  ) 

Create a KeyFile object used to read (key-pair) compliant files.

The status will be KeyFile::None

See also:
setFileName()

KeyFile ( const QString &  fileName  ) 

Create a KeyFile object used to read (key-pair) compliant files.

Parameters:
fileName Name of the file to be read.

~KeyFile (  ) 

Class destructor.


Member Function Documentation

void setFileName ( const QString &  fileName  ) 

Set the name of the file to be read.

Parameters:
fileName Name of the file to be read.

QString fileName (  )  const

Return the name of the file associated with this object.

Returns:
Name of the file associated with this object.

KeyFile::Status status (  )  const

Return a status code indicating the first error that was met by KeyFile, or KeyFile::NoError if no error occurred.

Make sure to use this method if you set the filename to be read using setFileName().

Returns:
Status code.
See also:
setFileName()

void setGroup ( const QString &  group  ) 

Set the current group to be used while reading keys.

Query functions such as keys(), contains() and value() are based on this group.

By default a empty group is used as the group for global keys and is used as the default group if none is set.

Parameters:
group Name of the group to be used.
See also:
group()

QString group (  )  const

Return the current group.

Returns:
Name of the current group.
See also:
setGroup()

QStringList allGroups (  )  const

Return all groups in the desktop file.

Global keys will be added to a empty group.

Returns:
List of all groups in the desktop file.

QStringList allKeys (  )  const

Return all keys described in the desktop file.

Returns:
List of all keys in the desktop file.

QStringList keys (  )  const

Return a list of keys in the current group.

Returns:
List of all keys in the current group.
See also:
group(), setGroup()

bool contains ( const QString &  key  )  const

Check if the current group contains a key named key.

Returns:
true if key exists, false otherwise.
See also:
group(), setGroup()

QString rawValue ( const QString &  key  )  const

Get the raw value for the key in the current group named key.

The raw value is the value as is in the key file.

Returns:
Value of key, empty string if not found.
See also:
group(), setGroup()

QString value ( const QString &  key  )  const

Get the value for the key in the current group named key.

Escape sequences in the value are interpreted as defined in: http://standards.freedesktop.org/desktop-entry-spec/latest/

Returns:
Value of key, empty string if not found or an error occurred.
See also:
group(), setGroup()

QStringList valueAsStringList ( const QString &  key  )  const

Get the value for the key in the current group named key as a list.

Return a list containing all strings on this key separated by ';'. Escape sequences in the value are interpreted as defined in: http://standards.freedesktop.org/desktop-entry-spec/latest/

Returns:
Value of key as a list, empty string list if not found or an error occurred.
See also:
group(), setGroup()


Copyright © 2009 Collabora Ltd. and Nokia Corporation
Telepathy-Qt4 0.1.10