utils

utils

Synopsis

gboolean            g_key_file_has_key_woe              (GKeyFile *key_file,
                                                         const gchar *group,
                                                         const gchar *key);
int                 g_strcmp0                           (const char *str1,
                                                         const char *str2);
gboolean            gebr_append_filename_extension      (GString *filename,
                                                         const gchar *extension);
gchar *             gebr_calculate_detailed_relative_time
                                                        (GTimeVal *time1,
                                                         GTimeVal *time2);
gint                gebr_calculate_number_of_processors (gint total_nprocs,
                                                         gint aggressive);
gchar *             gebr_calculate_relative_time        (GTimeVal *time1,
                                                         GTimeVal *time2);
gboolean            gebr_create_config_dirs             (void);
gchar *             gebr_date_get_localized             (const gchar *format,
                                                         const gchar *locale);
gboolean            gebr_dir_has_files                  (const gchar *dir_path);
#define             gebr_directory_foreach_file         (filename,
                                                         directory)
#define             gebr_directory_foreach_file_hyg     (filename,
                                                         directory,
                                                         hygid)
#define             gebr_foreach_gslist                 (element,
                                                         list)
#define             gebr_foreach_gslist_hyg             (element,
                                                         list,
                                                         hygid)
gboolean            gebr_g_key_file_has_key             (GKeyFile *key_file,
                                                         const gchar *group,
                                                         const gchar *key);
gboolean            gebr_g_key_file_load_boolean_key    (GKeyFile *key_file,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         gboolean default_value);
int                 gebr_g_key_file_load_int_key        (GKeyFile *key_file,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         int default_value);
GString *           gebr_g_key_file_load_string_key     (GKeyFile *key_file,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         const gchar *default_value);
gboolean            gebr_g_key_file_remove_key          (GKeyFile *key_file,
                                                         const gchar *group,
                                                         const gchar *key);
gboolean            gebr_g_string_ends_with             (GString *string,
                                                         const gchar *val);
void                gebr_g_string_replace               (GString *string,
                                                         const gchar *oldtext,
                                                         const gchar *newtext);
void                gebr_g_string_replace_first_ref     (GString *string,
                                                         const gchar *oldtext,
                                                         const gchar *newtext);
gboolean            gebr_g_string_starts_with           (GString *string,
                                                         const gchar *val);
#define             gebr_glist_foreach                  (element,
                                                         list)
#define             gebr_glist_foreach_hyg              (element,
                                                         list,
                                                         hygid)
int                 gebr_home_mode                      (void);
gchar *             gebr_id_random_create               (gssize bytes);
gchar *             gebr_locale_to_utf8                 (const gchar *string);
gchar *             gebr_lock_file                      (const gchar *pathname,
                                                         const gchar *new_lock_content,
                                                         gboolean symlink);
GString *           gebr_make_temp_filename             (const gchar *template);
GString *           gebr_make_unique_filename           (const gchar *template);
gboolean            gebr_path_is_at_home                (const gchar *path);
gboolean            gebr_path_resolve_home_variable     (GString *path);
void                gebr_path_set_to                    (GString *path,
                                                         gboolean relative);
gboolean            gebr_path_use_home_variable         (GString *path);
gboolean            gebr_realpath_equal                 (const gchar *path1,
                                                         const gchar *path2);
gboolean            gebr_str_canonical_var_name         (const gchar *keyword,
                                                         gchar **new_value,
                                                         GError **error);
gchar *             gebr_str_escape                     (const gchar *str);
gchar *             gebr_str_remove_trailing_zeros      (gchar *str);
gchar *             gebr_str_word_before_pos            (const gchar *str,
                                                         gint *pos);
gint                gebr_system                         (const gchar *cmd,
                                                         ...);
GString *           gebr_temp_directory_create          (void);
void                gebr_temp_directory_destroy         (GString *path);
gboolean            gebr_utf8_is_asc_alnum              (const gchar *str);
gchar *             gebr_utf8_strstr                    (const gchar *haystack,
                                                         const gchar *needle);
const gchar *       gebr_validate_float                 (const gchar *text_value,
                                                         const gchar *min,
                                                         const gchar *max);
const gchar *       gebr_validate_int                   (const gchar *text_value,
                                                         const gchar *min,
                                                         const gchar *max);

Description

Details

g_key_file_has_key_woe ()

gboolean            g_key_file_has_key_woe              (GKeyFile *key_file,
                                                         const gchar *group,
                                                         const gchar *key);

g_strcmp0 ()

int                 g_strcmp0                           (const char *str1,
                                                         const char *str2);

gebr_append_filename_extension ()

gboolean            gebr_append_filename_extension      (GString *filename,
                                                         const gchar *extension);

gebr_calculate_detailed_relative_time ()

gchar *             gebr_calculate_detailed_relative_time
                                                        (GTimeVal *time1,
                                                         GTimeVal *time2);

gebr_calculate_number_of_processors ()

gint                gebr_calculate_number_of_processors (gint total_nprocs,
                                                         gint aggressive);

Calculate real number of processors will be used

total_nprocs :

Number of processors of a server

aggressive :

Aggressive percentage (slider)

gebr_calculate_relative_time ()

gchar *             gebr_calculate_relative_time        (GTimeVal *time1,
                                                         GTimeVal *time2);

time1 :

The first date to compare

time2 :

The second date to compare

Returns :

A message (string) of the relative time and NULL if time2 is older than time1.

gebr_create_config_dirs ()

gboolean            gebr_create_config_dirs             (void);

gebr_date_get_localized ()

gchar *             gebr_date_get_localized             (const gchar *format,
                                                         const gchar *locale);

gebr_dir_has_files ()

gboolean            gebr_dir_has_files                  (const gchar *dir_path);

gebr_directory_foreach_file()

#define             gebr_directory_foreach_file(filename, directory)

gebr_directory_foreach_file_hyg()

#define             gebr_directory_foreach_file_hyg(filename, directory, hygid)

gebr_foreach_gslist()

#define             gebr_foreach_gslist(element, list)

gebr_foreach_gslist_hyg()

#define             gebr_foreach_gslist_hyg(element, list, hygid)

gebr_g_key_file_has_key ()

gboolean            gebr_g_key_file_has_key             (GKeyFile *key_file,
                                                         const gchar *group,
                                                         const gchar *key);

gebr_g_key_file_load_boolean_key ()

gboolean            gebr_g_key_file_load_boolean_key    (GKeyFile *key_file,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         gboolean default_value);

gebr_g_key_file_load_int_key ()

int                 gebr_g_key_file_load_int_key        (GKeyFile *key_file,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         int default_value);

gebr_g_key_file_load_string_key ()

GString *           gebr_g_key_file_load_string_key     (GKeyFile *key_file,
                                                         const gchar *group,
                                                         const gchar *key,
                                                         const gchar *default_value);

gebr_g_key_file_remove_key ()

gboolean            gebr_g_key_file_remove_key          (GKeyFile *key_file,
                                                         const gchar *group,
                                                         const gchar *key);

gebr_g_string_ends_with ()

gboolean            gebr_g_string_ends_with             (GString *string,
                                                         const gchar *val);

gebr_g_string_replace ()

void                gebr_g_string_replace               (GString *string,
                                                         const gchar *oldtext,
                                                         const gchar *newtext);

Replace each reference of oldtext in string with newtext. If newtext if NULL, then each reference of oldtext found is removed.

string :

The string to with the text.

oldtext :

The text to be replaced.

newtext :

The text to replace oldtext.

gebr_g_string_replace_first_ref ()

void                gebr_g_string_replace_first_ref     (GString *string,
                                                         const gchar *oldtext,
                                                         const gchar *newtext);

gebr_g_string_starts_with ()

gboolean            gebr_g_string_starts_with           (GString *string,
                                                         const gchar *val);

gebr_glist_foreach()

#define             gebr_glist_foreach(element, list)

gebr_glist_foreach_hyg()

#define             gebr_glist_foreach_hyg(element, list, hygid)

gebr_home_mode ()

int                 gebr_home_mode                      (void);

gebr_id_random_create ()

gchar *             gebr_id_random_create               (gssize bytes);

gebr_locale_to_utf8 ()

gchar *             gebr_locale_to_utf8                 (const gchar *string);

gebr_lock_file ()

gchar *             gebr_lock_file                      (const gchar *pathname,
                                                         const gchar *new_lock_content,
                                                         gboolean symlink);

gebr_make_temp_filename ()

GString *           gebr_make_temp_filename             (const gchar *template);

gebr_make_unique_filename ()

GString *           gebr_make_unique_filename           (const gchar *template);

gebr_path_is_at_home ()

gboolean            gebr_path_is_at_home                (const gchar *path);

gebr_path_resolve_home_variable ()

gboolean            gebr_path_resolve_home_variable     (GString *path);

gebr_path_set_to ()

void                gebr_path_set_to                    (GString *path,
                                                         gboolean relative);

gebr_path_use_home_variable ()

gboolean            gebr_path_use_home_variable         (GString *path);

gebr_realpath_equal ()

gboolean            gebr_realpath_equal                 (const gchar *path1,
                                                         const gchar *path2);

Compares if path1 and path2 resolves to the same file. The paths compared for equality by calling g_stat() on both of them and comparing their inode parameters are the same.

path1 :

the first path

path2 :

the second path

Returns :

TRUE if path1 points to the same file/directory as path2. FALSE otherwise, including if one or both of then does not exists in the file system.

gebr_str_canonical_var_name ()

gboolean            gebr_str_canonical_var_name         (const gchar *keyword,
                                                         gchar **new_value,
                                                         GError **error);

keyword :

The keyword to be canonized. (not modified)

new_value :

Returns a new alocated string with the canonized value of keyword.

error :

A GError (not used until now)

Returns :

TRUE if everthing is ok. False otherwise.

gebr_str_escape ()

gchar *             gebr_str_escape                     (const gchar *str);

Escapes all backslashes and quotes in a string. It is based on glib's g_strescape.

str :

the string to be escaped

Returns :

a newly allocated string.

gebr_str_remove_trailing_zeros ()

gchar *             gebr_str_remove_trailing_zeros      (gchar *str);

Modifies str inplace by removing trailing zeros.

Returns :

The same str, but modified.

gebr_str_word_before_pos ()

gchar *             gebr_str_word_before_pos            (const gchar *str,
                                                         gint *pos);

gebr_system ()

gint                gebr_system                         (const gchar *cmd,
                                                         ...);

gebr_temp_directory_create ()

GString *           gebr_temp_directory_create          (void);

gebr_temp_directory_destroy ()

void                gebr_temp_directory_destroy         (GString *path);

gebr_utf8_is_asc_alnum ()

gboolean            gebr_utf8_is_asc_alnum              (const gchar *str);

str :

The string to check

Returns :

TRUE if str is ASC and alpha-numerical.

gebr_utf8_strstr ()

gchar *             gebr_utf8_strstr                    (const gchar *haystack,
                                                         const gchar *needle);

Searches for needle in haystack and returns a pointer to the begging of the substring or NULL if it was not found.


gebr_validate_float ()

const gchar *       gebr_validate_float                 (const gchar *text_value,
                                                         const gchar *min,
                                                         const gchar *max);

gebr_validate_int ()

const gchar *       gebr_validate_int                   (const gchar *text_value,
                                                         const gchar *min,
                                                         const gchar *max);