lib/efreet_ini.c File Reference
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/mman.h>
#include <Ecore_File.h>
#include "Efreet.h"
#include "efreet_private.h"
Include dependency graph for efreet_ini.c:

Defines

#define EFREET_MODULE_LOG_DOM   _efreet_ini_log_dom

Functions

void * alloca (size_t)
EAPI unsigned int efreet_ini_boolean_get (Efreet_Ini *ini, const char *key)
 Retrieves the boolean value at key key from the ini ini.
EAPI void efreet_ini_boolean_set (Efreet_Ini *ini, const char *key, unsigned int value)
 Sets the value for the given key.
EAPI double efreet_ini_double_get (Efreet_Ini *ini, const char *key)
 Retrieves the value for the given key or -1 if none found.
EAPI void efreet_ini_double_set (Efreet_Ini *ini, const char *key, double value)
 Sets the value for the given key.
EAPI void efreet_ini_free (Efreet_Ini *ini)
 Frees the given Efree_Ini structure.
int efreet_ini_init (void)
EAPI int efreet_ini_int_get (Efreet_Ini *ini, const char *key)
 Retrieves the value for the given key or -1 if none found.
EAPI void efreet_ini_int_set (Efreet_Ini *ini, const char *key, int value)
 Sets the value for the given key.
EAPI void efreet_ini_key_unset (Efreet_Ini *ini, const char *key)
 Remove the given key from the ini struct.
EAPI const char * efreet_ini_localestring_get (Efreet_Ini *ini, const char *key)
 Retrieves the utf8 encoded string associated with key in the current locale or NULL if none found.
EAPI void efreet_ini_localestring_set (Efreet_Ini *ini, const char *key, const char *value)
 Sets the value for the given key.
EAPI Efreet_Iniefreet_ini_new (const char *file)
 Creates and initializes a new Ini structure with the contents of file, or NULL on failure.
EAPI int efreet_ini_save (Efreet_Ini *ini, const char *file)
 Saves the given Efree_Ini structure.
EAPI void efreet_ini_section_add (Efreet_Ini *ini, const char *section)
 Adds a new working section of the ini file to section.
EAPI int efreet_ini_section_set (Efreet_Ini *ini, const char *section)
 Sets the current working section of the ini file to section.
void efreet_ini_shutdown (void)
EAPI const char * efreet_ini_string_get (Efreet_Ini *ini, const char *key)
 Retrieves the value for the given key or NULL if none found.
EAPI void efreet_ini_string_set (Efreet_Ini *ini, const char *key, const char *value)
 Sets the value for the given key.

Define Documentation

#define EFREET_MODULE_LOG_DOM   _efreet_ini_log_dom

Function Documentation

void* alloca ( size_t  )
EAPI unsigned int efreet_ini_boolean_get ( Efreet_Ini ini,
const char *  key 
)

Retrieves the boolean value at key key from the ini ini.

Parameters:
iniThe ini struct to work with
keyThe key to search for
Returns:
Returns 1 if the boolean is true, 0 otherwise

References efreet_ini_string_get(), and Efreet_Ini::section.

EAPI void efreet_ini_boolean_set ( Efreet_Ini ini,
const char *  key,
unsigned int  value 
)

Sets the value for the given key.

Parameters:
iniThe ini struct to work with
keyThe key to use
valueThe value to set
Returns:
Returns no value

References efreet_ini_string_set(), and Efreet_Ini::section.

EAPI double efreet_ini_double_get ( Efreet_Ini ini,
const char *  key 
)

Retrieves the value for the given key or -1 if none found.

Parameters:
iniThe Efree_Ini to work with
keyThe key to lookup
Returns:
Returns the double associated with the given key or -1 if not found.

References efreet_ini_string_get(), and Efreet_Ini::section.

EAPI void efreet_ini_double_set ( Efreet_Ini ini,
const char *  key,
double  value 
)

Sets the value for the given key.

Parameters:
iniThe Efree_Ini to work with
keyThe key to use
valueThe value to set
Returns:
Returns no value

References efreet_ini_string_set(), and Efreet_Ini::section.

EAPI void efreet_ini_free ( Efreet_Ini ini)

Frees the given Efree_Ini structure.

Parameters:
iniThe Efreet_Ini to work with
Returns:
Returns no value

References Efreet_Ini::data, FREE, and IF_FREE_HASH.

Referenced by efreet_desktop_save().

EAPI int efreet_ini_int_get ( Efreet_Ini ini,
const char *  key 
)

Retrieves the value for the given key or -1 if none found.

Parameters:
iniThe Efree_Ini to work with
keyThe key to lookup
Returns:
Returns the integer associated with the given key or -1 if not found.

References efreet_ini_string_get(), and Efreet_Ini::section.

EAPI void efreet_ini_int_set ( Efreet_Ini ini,
const char *  key,
int  value 
)

Sets the value for the given key.

Parameters:
iniThe Efree_Ini to work with
keyThe key to use
valueThe value to set
Returns:
Returns no value

References efreet_ini_string_set(), and Efreet_Ini::section.

EAPI void efreet_ini_key_unset ( Efreet_Ini ini,
const char *  key 
)

Remove the given key from the ini struct.

Parameters:
iniThe ini struct to work with
keyThe key to remove
Returns:
Returns no value

References Efreet_Ini::section.

EAPI const char* efreet_ini_localestring_get ( Efreet_Ini ini,
const char *  key 
)

Retrieves the utf8 encoded string associated with key in the current locale or NULL if none found.

Parameters:
iniThe ini struct to work with
keyThe key to search for
Returns:
Returns the utf8 encoded string associated with key, or NULL if none found

References alloca(), efreet_ini_string_get(), efreet_lang_country_get(), efreet_lang_get(), efreet_lang_modifier_get(), and Efreet_Ini::section.

EAPI void efreet_ini_localestring_set ( Efreet_Ini ini,
const char *  key,
const char *  value 
)

Sets the value for the given key.

Parameters:
iniThe ini struct to work with
keyThe key to use
valueThe value to set
Returns:
Returns no value

References alloca(), efreet_ini_string_set(), efreet_lang_country_get(), efreet_lang_get(), efreet_lang_modifier_get(), and Efreet_Ini::section.

EAPI Efreet_Ini* efreet_ini_new ( const char *  file)

Creates and initializes a new Ini structure with the contents of file, or NULL on failure.

Parameters:
fileThe file to parse
Returns:
Returns a new Efreet_Ini structure initialized with the contents of file, or NULL on memory allocation failure

References Efreet_Ini::data, and NEW.

Referenced by efreet_desktop_save().

EAPI int efreet_ini_save ( Efreet_Ini ini,
const char *  file 
)

Saves the given Efree_Ini structure.

Parameters:
iniThe Efreet_Ini to work with
fileThe file to load
Returns:
Returns no value

References Efreet_Ini::data.

Referenced by efreet_desktop_save().

EAPI void efreet_ini_section_add ( Efreet_Ini ini,
const char *  section 
)

Adds a new working section of the ini file to section.

Parameters:
iniThe Efreet_Ini to work with
sectionThe section of the ini file we want to add
Returns:
Returns no value

References Efreet_Ini::data.

Referenced by efreet_desktop_save().

EAPI int efreet_ini_section_set ( Efreet_Ini ini,
const char *  section 
)

Sets the current working section of the ini file to section.

Parameters:
iniThe Efreet_Ini to work with
sectionThe section of the ini file we want to get values from
Returns:
Returns 1 if the section exists, otherwise 0

References Efreet_Ini::data, and Efreet_Ini::section.

Referenced by efreet_desktop_save().

EAPI const char* efreet_ini_string_get ( Efreet_Ini ini,
const char *  key 
)

Retrieves the value for the given key or NULL if none found.

Parameters:
iniThe Efree_Ini to work with
keyThe key to lookup
Returns:
Returns the string associated with the given key or NULL if not found.

References Efreet_Ini::section.

Referenced by efreet_ini_boolean_get(), efreet_ini_double_get(), efreet_ini_int_get(), and efreet_ini_localestring_get().

EAPI void efreet_ini_string_set ( Efreet_Ini ini,
const char *  key,
const char *  value 
)

Sets the value for the given key.

Parameters:
iniThe Efree_Ini to work with
keyThe key to use
valueThe value to set
Returns:
Returns no value

References Efreet_Ini::section.

Referenced by efreet_desktop_save(), efreet_ini_boolean_set(), efreet_ini_double_set(), efreet_ini_int_set(), and efreet_ini_localestring_set().