![]() |
![]() |
![]() |
massifg Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
gchar * massifg_utils_get_resource_file (const gchar *filename
); void massifg_utils_log_ignore (const gchar *log_domain
,GLogLevelFlags log_level
,const gchar *message
,gpointer user_data
); void massifg_utils_free_foreach (gpointer data
,gpointer user_data
); void massifg_utils_configure_debug_output (void
); gchar * massifg_str_copy_region (gchar *src
,gint start_idx
,gint stop_idx
); int massifg_str_count_char (gchar *str
,gchar c
); gchar * massifg_str_cut_region (gchar *src
,int cut_start
,int cut_end
);
gchar * massifg_utils_get_resource_file (const gchar *filename
);
Find a resource file
First checks ./data/ in case the program is running from the build dir.
Secondly, INSTALL_PREFIX/share in case of running from a non-system prefix.
Then, checks the system folders as given by g_get_system_data_dirs()
Note: Not suitable for use in other applications, hardcodes the application name to "massifg"
|
file to search for |
Returns : |
the path to the file as a newly allocated string (free with g_free() ), or NULL on failure
|
void massifg_utils_log_ignore (const gchar *log_domain
,GLogLevelFlags log_level
,const gchar *message
,gpointer user_data
);
Log function for use with glib logging facilities that just ignores input.
Can be used to silence messages of a certain type, see massifg_utils_configure_debug_output()
|
log_domain |
|
log_level |
|
message |
|
user_data |
void massifg_utils_free_foreach (gpointer data
,gpointer user_data
);
Utility function for freeing each element in a GList.
Elements freed using this function should have been allocated using g_alloc and derivatives. Meant to be used as a parameter to a g_(s)list_foreach call
|
data |
|
user_data |
void massifg_utils_configure_debug_output
(void
);
Checks for the environment variable MASSIFG_DEBUG, if it is not "enable" or "all", debug output will be ignored
gchar * massifg_str_copy_region (gchar *src
,gint start_idx
,gint stop_idx
);
Copy a region of a string
Indexes start at 0
|
String to copy from. Must be NULL terminated |
|
Index in src to start copying from.
|
|
Index in src to stop copying from. Must be smaller than the length of src
|
Returns : |
a newly allocated string. Free with g_free()
|
int massifg_str_count_char (gchar *str
,gchar c
);
Count the number of time a character appears in a string
|
String to search in. Must be NULL terminated. |
|
Character to count |
Returns : |
the number of occurrences of c in str
|
gchar * massifg_str_cut_region (gchar *src
,int cut_start
,int cut_end
);
Copy string, excluding a certain region
Indexes start at 0
|
String to copy from |
|
Index in src to start excluding
|
|
Index in src to stop excluding
|
Returns : |
a newly allocated string. Free with g_free()
|