Classes | Typedefs | Functions

go-glib-extras.c File Reference

#include <goffice/goffice-config.h>
#include "go-glib-extras.h"
#include "go-locale.h"
#include <goffice/app/go-cmd-context.h>
#include <glib/gi18n-lib.h>
#include <gsf/gsf-impl-utils.h>
#include <libxml/encoding.h>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>

Classes

struct  _go_mem_chunk_freeblock
struct  _go_mem_chunk_block
struct  _GOMemChunk

Typedefs

typedef struct
_go_mem_chunk_freeblock 
go_mem_chunk_freeblock
typedef struct _go_mem_chunk_block go_mem_chunk_block

Functions

static void cb_hash_collect_keys (gpointer key, G_GNUC_UNUSED gpointer value, GSList **accum)
GSList * go_hash_keys (GHashTable *hash)
 go_hash_keys : : GHashTable
static void cb_hash_collect_values (G_GNUC_UNUSED gpointer key, gpointer value, GSList **accum)
GSList * go_hash_values (GHashTable *hash)
 go_hash_values : : GHashTable
void go_ptr_array_insert (GPtrArray *array, gpointer value, int index_)
GSList * go_slist_create (gpointer item1,...)
 go_slist_create: : itionally NULL : NULL terminated list of additional items
GSList * go_slist_map (GSList const *list, GOMapFunc map_func)
 go_slist_map: : list of some items : mapping function
void go_slist_free_custom (GSList *list, GFreeFunc free_func)
 go_slist_free_custom: : list of some items : function freeing list item
gint go_list_index_custom (GList *list, gpointer data, GCompareFunc cmp_func)
void go_list_free_custom (GList *list, GFreeFunc free_func)
 go_list_free_custom: : list of some items : function freeing list item
GSList * go_strsplit_to_slist (gchar const *string, gchar delimiter)
 go_strsplit_to_slist: : String to split : Token delimiter
gint go_utf8_collate_casefold (const char *a, const char *b)
gint go_ascii_strcase_equal (gconstpointer v1, gconstpointer v2)
guint go_ascii_strcase_hash (gconstpointer v)
void go_strescape (GString *target, char const *string)
const char * go_strunescape (GString *target, const char *string)
void go_string_append_gstring (GString *target, const GString *source)
void go_string_append_c_n (GString *target, char c, gsize n)
void go_string_replace (GString *target, gsize pos, gssize oldlen, const char *txt, gssize newlen)
char * go_utf8_strcapital (const char *p, gssize len)
 go_utf8_strcapital: : pointer to UTF-8 string : length in bytes, or -1.
GOMemChunkgo_mem_chunk_new (char const *name, size_t user_atom_size, size_t chunk_size)
void go_mem_chunk_destroy (GOMemChunk *chunk, gboolean expect_leaks)
gpointer go_mem_chunk_alloc (GOMemChunk *chunk)
gpointer go_mem_chunk_alloc0 (GOMemChunk *chunk)
void go_mem_chunk_free (GOMemChunk *chunk, gpointer mem)
void go_mem_chunk_foreach_leak (GOMemChunk *chunk, GFunc cb, gpointer user)
int go_str_compare (void const *x, void const *y)
const char * go_guess_encoding (const char *raw, size_t len, const char *user_guess, char **utf8_str)
char const * go_get_real_name (void)
 go_get_real_name :
void go_destroy_password (char *passwd)
 go_destroy_password : : The buffer to clear
void go_object_toggle (gpointer object, const gchar *property_name)
 go_object_toggle: : GObject : name
gboolean go_object_set_property (GObject *obj, const char *property_name, const char *user_prop_name, const char *value, GError **err, const char *error_template)
GSList * go_object_properties_collect (GObject *obj)
void go_object_properties_apply (GObject *obj, GSList *props, gboolean changed_only)
void go_object_properties_free (GSList *props)
gboolean go_parse_key_value (const char *options, GError **err, gboolean(*handler)(const char *name, const char *value, GError **err, gpointer user), gpointer user)
 go_parse_key_value: : Options string.

Typedef Documentation


Function Documentation

static void cb_hash_collect_keys ( gpointer  key,
G_GNUC_UNUSED gpointer  value,
GSList **  accum 
) [static]

Referenced by go_hash_keys().

static void cb_hash_collect_values ( G_GNUC_UNUSED gpointer  key,
gpointer  value,
GSList **  accum 
) [static]

Referenced by go_hash_values().

gint go_ascii_strcase_equal ( gconstpointer  v1,
gconstpointer  v2 
)
guint go_ascii_strcase_hash ( gconstpointer  v  ) 
void go_destroy_password ( char *  passwd  ) 

go_destroy_password : : The buffer to clear

Overwrite a string holding a password. This is a separate routine to ensure that the compiler does not try to outsmart us.

Note: this does not free the memory.

char const* go_get_real_name ( void   ) 

go_get_real_name :

Returns: a utf8 encoded string with the current user name. Caller should _NOT_ free the result.

const char* go_guess_encoding ( const char *  raw,
size_t  len,
const char *  user_guess,
char **  utf8_str 
)
GSList* go_hash_keys ( GHashTable *  hash  ) 

go_hash_keys : : GHashTable

Collects an unordered list of the keys in .

Returns: a list which the caller needs to free. The content has not additional references added

GSList* go_hash_values ( GHashTable *  hash  ) 

go_hash_values : : GHashTable

Collects an unordered list of the values in .

Returns: a list which the caller needs to free. The content has not additional references added

void go_list_free_custom ( GList *  list,
GFreeFunc  free_func 
)

go_list_free_custom: : list of some items : function freeing list item

Clears a list, calling for each list item.

gint go_list_index_custom ( GList *  list,
gpointer  data,
GCompareFunc  cmp_func 
)
gpointer go_mem_chunk_alloc ( GOMemChunk chunk  ) 

Referenced by go_mem_chunk_alloc0().

gpointer go_mem_chunk_alloc0 ( GOMemChunk chunk  ) 
void go_mem_chunk_destroy ( GOMemChunk chunk,
gboolean  expect_leaks 
)
void go_mem_chunk_foreach_leak ( GOMemChunk chunk,
GFunc  cb,
gpointer  user 
)
void go_mem_chunk_free ( GOMemChunk chunk,
gpointer  mem 
)
GOMemChunk* go_mem_chunk_new ( char const *  name,
size_t  user_atom_size,
size_t  chunk_size 
)
void go_object_properties_apply ( GObject *  obj,
GSList *  props,
gboolean  changed_only 
)
GSList* go_object_properties_collect ( GObject *  obj  ) 
void go_object_properties_free ( GSList *  props  ) 
gboolean go_object_set_property ( GObject *  obj,
const char *  property_name,
const char *  user_prop_name,
const char *  value,
GError **  err,
const char *  error_template 
)
void go_object_toggle ( gpointer  object,
const gchar *  property_name 
)

go_object_toggle: : GObject : name

Toggle a boolean object property.

gboolean go_parse_key_value ( const char *  options,
GError **  err,
gboolean(*)(const char *name, const char *value, GError **err, gpointer user)  handler,
gpointer  user 
)

go_parse_key_value: : Options string.

: Reference to store GError if parsing fails. : Handler to call for each key-value pair. : user pointer.

References _, go_error_invalid(), and go_strunescape().

void go_ptr_array_insert ( GPtrArray *  array,
gpointer  value,
int  index_ 
)
GSList* go_slist_create ( gpointer  item1,
  ... 
)

go_slist_create: : itionally NULL : NULL terminated list of additional items

Creates a GList from NULL-terminated list of arguments.

Returns: created list.

void go_slist_free_custom ( GSList *  list,
GFreeFunc  free_func 
)

go_slist_free_custom: : list of some items : function freeing list item

Clears a list, calling for each list item.

GSList* go_slist_map ( GSList const *  list,
GOMapFunc  map_func 
)

go_slist_map: : list of some items : mapping function

int go_str_compare ( void const *  x,
void const *  y 
)
void go_strescape ( GString *  target,
char const *  string 
)
void go_string_append_c_n ( GString *  target,
char  c,
gsize  n 
)
void go_string_append_gstring ( GString *  target,
const GString *  source 
)
void go_string_replace ( GString *  target,
gsize  pos,
gssize  oldlen,
const char *  txt,
gssize  newlen 
)
GSList* go_strsplit_to_slist ( gchar const *  string,
gchar  delimiter 
)

go_strsplit_to_slist: : String to split : Token delimiter

Splits up string into tokens at delim and returns a string list.

Returns: string list which you should free after use using function e_free_string_list().

References gchar.

const char* go_strunescape ( GString *  target,
const char *  string 
)

Referenced by go_parse_key_value().

gint go_utf8_collate_casefold ( const char *  a,
const char *  b 
)
char* go_utf8_strcapital ( const char *  p,
gssize  len 
)

go_utf8_strcapital: : pointer to UTF-8 string : length in bytes, or -1.

Similar to g_utf8_strup and g_utf8_strup, except that this function creates a string "Very Much Like: This, One".

Return value: newly allocated string.