scol_glib_keyfile.c File Reference

all functions of this API More...

#include "../include/scol_glib_keyfile.h"
#include "main.h"
#include <glib/gstdio.h>

Functions

int GKF_VALUE_RAW (mmachine m)
 GKF_VALUE_RAW : I : flag used to load a key file. The raw value associated with key under group. The value can be escaped string.
int GKF_VALUE_STRING (mmachine m)
 GKF_VALUE_STRING : I : flag used to load a key file. The string value associated with key under group. Unlike GKF_VALUE_RAW, any escaped sequence are unescaped.
int GKF_VALUE_INTEGER (mmachine m)
 GKF_VALUE_INTEGER : Not implemented yet.
int GKF_VALUE_INTEGER64 (mmachine m)
 GKF_VALUE_INTEGER64 : Not implemented yet.
int GKF_VALUE_UINTEGER64 (mmachine m)
 GKF_VALUE_UINTEGER64 : Not implemented yet.
int GKF_VALUE_DOUBLE (mmachine m)
 GKF_VALUE_DOUBLE : Not implemented yet.
int GKF_VALUE_BOOLEAN (mmachine m)
 GKF_VALUE_BOOLEAN : Not implemented yet.
int SCOL_gkeyFileReadP (mmachine m)
 _gkeyFileReadP : read a key file fun [P S] [[S [[S S] r1]] r1]
int SCOL_gkeyFileLoadP (mmachine m)
 _gkeyFileLoadP : Loads a key file from any valid file
int SCOL_gkeyFileLoadS (mmachine m)
 _gkeyFileLoadS : Loads a key file from any valid data
int SCOL_gkeyFileSave (mmachine m)
 _gkeyFileSave : save a keyfile to a filename
int SCOL_gkeyFileDestroy (mmachine m)
 _gkeyFileDestroy : Destroys an object
int SCOL_gkeyFileGetContent (mmachine m)
 _gkeyFileGetContent : Returns the content of key file
int SCOL_gkeyFileGetDatas (mmachine m)
 _gkeyFileGetDatas : Return a list of the content
int SCOL_gkeyFileGetGroups (mmachine m)
 _gkeyFileGetGroups : Returns a list of all groups
int SCOL_gkeyFileGetNbGroups (mmachine m)
 _gkeyFileGetNbGroups : Returns the number of group
int SCOL_gkeyFileDataExist (mmachine m)
 _gkeyFileDataExist : Looks whether the key file has the datas
int SCOL_keyFileGetValue (mmachine m)
 _keyFileGetValue : Returns the value for any key in any group
int SCOL_keyFileGetLocaleValue (mmachine m)
 _keyFileGetLocaleValue : Returns the locale value for any key in any group
int SCOL_gkeyFileGetValueList (mmachine m)
 _gkeyFileGetValueList : Returns the values associated with key under group
int SCOL_gkeyFileGetValueLocaleList (mmachine m)
 _gkeyFileGetValueLocaleList : Returns the locales values associated with key under group
int SCOL_gkeyFileGetComment (mmachine m)
 _gkeyFileGetComment : Return a comment
int SCOL_gkeyFileSetValue (mmachine m)
 _gkeyFileSetValue : Associates a new value with key under group.
int SCOL_gkeyFileSetLocaleValue (mmachine m)
 _gkeyFileSetValue : Associates a new value with key under group.
int SCOL_gkeyFileSetValueList (mmachine m)
 _gkeyFileSetValueList : Associates a list of string for key under group.
int SCOL_gkeyFileSetLocaleValueList (mmachine m)
 _gkeyFileSetValueList : Associates a list of string for key under group.
int SCOL_gkeyFileSetComment (mmachine m)
 _gkeyFileSetComment : Comments a key, a group or the key file.
int SCOL_gkeyFileRemGroup (mmachine m)
 _gkeyFileRemGroup : Removes the specified group from the object.
int SCOL_gkeyFileRemKey (mmachine m)
 _gkeyFileRemKey : Removes the specified key in group from the object.
int SCOL_gkeyFileRemComment (mmachine m)
 _gkeyFileRemComment : Removes a comment above key from group.

Variables

mmachine mm
char * gkey_name [GKEYFILE_PKG_NB]
int(* gkey_fun [GKEYFILE_PKG_NB])(mmachine m)
int gkey_narg [GKEYFILE_PKG_NB]
char * gkey_type [GKEYFILE_PKG_NB]

Detailed Description

all functions of this API

Author:
Stephane Bisaro

Function Documentation

int SCOL_gkeyFileReadP ( mmachine  m  ) 

_gkeyFileReadP : read a key file fun [P S] [[S [[S S] r1]] r1]

Parameters:
P : any file (read reference only)
S : the list seperator, or nil (default ";")
Returns:
[[S [[S S] r1]] r1] : the list of datas : group names and for each group name, a list of tuple [key value]
int SCOL_gkeyFileLoadP ( mmachine  m  ) 

_gkeyFileLoadP : Loads a key file from any valid file

fun [Chn P S I] ObjKeyFile

Parameters:
Chn : the channel
P : any read referenced file
S : the list separator or nil (default ";"). One character only (if more, they are ignored)
I : flag : 0 -> No flags, default behaviour 1 -> Use this flag if you plan to write the (possibly modified) contents of the key file back to a file; otherwise all comments will be lost when the key file is written back. 2 -> Use this flag if you plan to write the (possibly modified) contents of the key file back to a file; otherwise only the translations for the current language will be written back. 3 -> 1 and 2
Returns:
ObjKeyFile : the new object, or nil if error

Importante note : if you want get/set any localized key, be sure set the flag to 2 (or 3) !

int SCOL_gkeyFileLoadS ( mmachine  m  ) 

_gkeyFileLoadS : Loads a key file from any valid data

fun [Chn P S I] ObjKeyFile

Parameters:
Chn : the channel
S : any valid content
S : the list separator or nil (default ";"). One character only (if more, they are ignored)
I : flag : 0 -> No flags, default behaviour 1 -> Use this flag if you plan to write the (possibly modified) contents of the key file back to a file; otherwise all comments will be lost when the key file is written back. 2 -> Use this flag if you plan to write the (possibly modified) contents of the key file back to a file; otherwise only the translations for the current language will be written back. 3 -> 1 and 2
Returns:
ObjKeyFile : the new object, or nil if error
int SCOL_gkeyFileSave ( mmachine  m  ) 

_gkeyFileSave : save a keyfile to a filename

fun [ObjKeyFile W] I

Parameters:
ObjKeyFile : a valid object
W : a Scol write referenced filename
Returns:
I : 0 if success or nil if error (see log message)
int SCOL_gkeyFileDestroy ( mmachine  m  ) 

_gkeyFileDestroy : Destroys an object

Parameters:
ObjKeyFile 
Returns:
I : O or nil if error
int SCOL_gkeyFileGetContent ( mmachine  m  ) 

_gkeyFileGetContent : Returns the content of key file

fun [ObjKeyFile] [S I]

Parameters:
ObjKeyFile : any valid object
Returns:
[S I] : a tuple : the content and its length or nil if error
int SCOL_gkeyFileGetDatas ( mmachine  m  ) 

_gkeyFileGetDatas : Return a list of the content

fun [ObjKeyFile] [[S [[S S] r1]] r1]

Parameters:
ObjKeyFile : an object already created
Returns:
[[S [[S S] r1]] r1] : a list of group names and for each group name, a list of tuple [key value] or nil if error
int SCOL_gkeyFileGetGroups ( mmachine  m  ) 

_gkeyFileGetGroups : Returns a list of all groups

fun [ObjKeyFile] [S r1]

Parameters:
ObjKeyFile : any object already created
Returns:
[S r1] : this list or nil if error
int SCOL_gkeyFileGetNbGroups ( mmachine  m  ) 

_gkeyFileGetNbGroups : Returns the number of group

fun [ObjKeyFile] I

Parameters:
ObjKeyFile : any object already created
Returns:
I : this number or nil if error
int SCOL_gkeyFileDataExist ( mmachine  m  ) 

_gkeyFileDataExist : Looks whether the key file has the datas

fun [ObjKeyFile S S] I

Parameters:
ObjKeyFile : any object already created
S : a group name or nil
S : a key name or nil
Returns:
I : the result (see below) or nil if error

If the group name and the key name are not nil, this function searches the key into the group. If found, 1 is returned, else 0 If the group name is nil, this function searches the key into all groups. The returned value is the number of this key, 0 if not found. If the key name is nil, this function searches the group into the keyfile. If found, 1 is returned, else 0. If the keyfile is nil or if the group and key names are nil, nil is returned.

int SCOL_keyFileGetValue ( mmachine  m  ) 

_keyFileGetValue : Returns the value for any key in any group

fun [ObjKeyFile S S I] S

Parameters:
ObjKeyFile : any valid object
S : any group name
S : any key name
I : flag : GKF_VALUE_RAW, GKF_VALUE_STRING, GKF_VALUE_INTEGER, GKF_VALUE_INTEGER64, GKF_VALUE_UINTEGER64, GKF_VALUE_DOUBLE, GKF_VALUE_BOOLEAN GKF_VALUE_RAW and GKF_VALUE_STRING have a difference, others always return a string
Returns:
S : the value or nil if error or not found
int SCOL_keyFileGetLocaleValue ( mmachine  m  ) 

_keyFileGetLocaleValue : Returns the locale value for any key in any group

fun [ObjKeyFile S S S] S

Parameters:
ObjKeyFile : any valid object
S : any group name
S : any key name
S : any locale identifier or nil
Returns:
S : the value or nil if error or not found

If locale is nil or not found, the value of the default key (without localization) will be returned When the ObjKeyFile has been created, if the flag is at 0 or 1, the current locale can be used only. In this last case, to get a value of an other locale, the flag should have set to 2 or 3.

int SCOL_gkeyFileGetValueList ( mmachine  m  ) 

_gkeyFileGetValueList : Returns the values associated with key under group

fun [ObjKeyFile S S] [S r1]

Parameters:
ObjKeyFile : any valid object
S : any group name
S : any key name
Returns:
[S r1] : the value or nil if error or not found
int SCOL_gkeyFileGetValueLocaleList ( mmachine  m  ) 

_gkeyFileGetValueLocaleList : Returns the locales values associated with key under group

fun [ObjKeyFile S S S] [S r1]

Parameters:
ObjKeyFile : any valid object
S : any group name
S : any key name
S : any locale identifier or nil
Returns:
[S r1] : the value or nil if error or not found

If locale is nil or not found, the values of the default key (without localization) will be returned When the ObjKeyFile has been created, if the flag is at 0 or 1, the current locale can be used only. In this last case, to get the values of an other locale, the flag should have set to 2 or 3.

int SCOL_gkeyFileGetComment ( mmachine  m  ) 

_gkeyFileGetComment : Return a comment

fun [ObjKeyFile S S] S

Parameters:
ObjKeyFile : an object
S : a group name
S : a key name
Returns:
S : the comment or nil if error or not found

Retrieves a comment above key name from group name. If key is NULL then comment will be read from above group name. If both key name and group name are NULL, then comment will be read from above the first group in the file.

int SCOL_gkeyFileSetValue ( mmachine  m  ) 

_gkeyFileSetValue : Associates a new value with key under group.

Fun [ObjKeyFile S S S I] ObjKeyFile If key cannot be found then it is created. If group cannot be found then it is created.

Parameters:
ObjKeyFile : a valid object
S : a group name
S : a key name
S : the new value
I : a flag : GKF_VALUE_RAW or GKF_VALUE_STRING (others flags aren't implemented yet)
Returns:
ObjKeyFile : the same object or nil if error

If key or group is nil, the command is ignored but a message is written to the log

int SCOL_gkeyFileSetLocaleValue ( mmachine  m  ) 

_gkeyFileSetValue : Associates a new value with key under group.

Fun [ObjKeyFile S S S I] ObjKeyFile If key cannot be found then it is created. If group cannot be found then it is created.

Parameters:
ObjKeyFile : a valid object
S : a group name
S : a key name
S : the new value
S : a locale identifier
Returns:
ObjKeyFile : the same object or nil if error

If key or group is nil, the command is ignored but a message is written to the log

int SCOL_gkeyFileSetValueList ( mmachine  m  ) 

_gkeyFileSetValueList : Associates a list of string for key under group.

fun [ObjKeyFile S S [S r1] ObjKeyFile If key cannot be found then it is created. If group cannot be found then it is created.

Parameters:
: ObjKeyFile : an object
: S : a group
: S : a key
[S r1] : a list of values
Returns:
ObjKeyFile : the same object or nil if error

If key or group is nil, the command is ignored but a message is written to the log

int SCOL_gkeyFileSetLocaleValueList ( mmachine  m  ) 

_gkeyFileSetValueList : Associates a list of string for key under group.

fun [ObjKeyFile S S S [S r1] ObjKeyFile If key cannot be found then it is created. If group cannot be found then it is created.

Parameters:
: ObjKeyFile : an object
: S : a group
: S : a key
: S : a locale identifier
[S r1] : a list of values
Returns:
ObjKeyFile : the same object or nil if error

If key or group is nil, the command is ignored but a message is written to the log

int SCOL_gkeyFileSetComment ( mmachine  m  ) 

_gkeyFileSetComment : Comments a key, a group or the key file.

fun [ObjKeyFile S S S] ObjKeyFile

Parameters:
ObjKeyFile : an object already created
S : a group
S : a key name
S : a comment
Returns:
ObjKeyFile : the same object or nil if error

See _gkeyFileGetComment too

int SCOL_gkeyFileRemGroup ( mmachine  m  ) 

_gkeyFileRemGroup : Removes the specified group from the object.

fun [ObjKeyFile S] ObjKeyFile

Parameters:
ObjKeyFile : an object already created
S : a group
Returns:
ObjKeyFile : the same object or nil if error
int SCOL_gkeyFileRemKey ( mmachine  m  ) 

_gkeyFileRemKey : Removes the specified key in group from the object.

fun [ObjKeyFile S S] ObjKeyFile

Parameters:
ObjKeyFile : an object already created
S : a group
S : a key
Returns:
ObjKeyFile : the same object or nil if error
int SCOL_gkeyFileRemComment ( mmachine  m  ) 

_gkeyFileRemComment : Removes a comment above key from group.

fun [ObjKeyFile S S] ObjKeyFile If key is NULL then comment will be removed above group. If both key and group are NULL, then comment will be removed above the first group in the file.

Parameters:
ObjKeyFile : an object already created
S : a group
S : a key
Returns:
ObjKeyFile : the same object or nil if error
Generated on Thu Mar 10 14:04:18 2011 for keyfile by  doxygen 1.6.3