gimpmemsize

gimpmemsize — Functions to (de)serialize a given memory size.

Synopsis




gchar*      gimp_memsize_serialize          (guint64 memsize);
gboolean    gimp_memsize_deserialize        (const gchar *string,
                                             guint64 *memsize);
gchar*      gimp_memsize_to_string          (guint64 memsize);
#define     GIMP_TYPE_MEMSIZE
#define     GIMP_VALUE_HOLDS_MEMSIZE        (value)

Description

Functions to (de)serialize a given memory size.

Details

gimp_memsize_serialize ()

gchar*      gimp_memsize_serialize          (guint64 memsize);

Creates a string representation of a given memory size. This string can be parsed by gimp_memsize_deserialize() and can thus be used in config files. It should not be displayed to the user. If you need a nice human-readable string please use gimp_memsize_to_string().

memsize : memory size in bytes
Returns : A newly allocated string representation of memsize.

Since GIMP 2.2


gimp_memsize_deserialize ()

gboolean    gimp_memsize_deserialize        (const gchar *string,
                                             guint64 *memsize);

Parses a string representation of a memory size as returned by gimp_memsize_serialize().

string : a string as returned by gimp_memsize_serialize()
memsize : return location for memory size in bytes
Returns : TRUE if the string was successfully parsed and memsize has been set, FALSE otherwise.

Since GIMP 2.2


gimp_memsize_to_string ()

gchar*      gimp_memsize_to_string          (guint64 memsize);

This function returns a human readable, translated representation of the passed memsize. Large values are displayed using a reasonable memsize unit, e.g.: "345" becomes "345 Bytes", "4500" becomes "4.4 KB" and so on.

memsize : A memory size in bytes.
Returns : A newly allocated human-readable, translated string.

GIMP_TYPE_MEMSIZE

#define GIMP_TYPE_MEMSIZE               (gimp_memsize_get_type ())

GIMP_TYPE_MEMSIZE is a GType derived from G_TYPE_UINT64.


GIMP_VALUE_HOLDS_MEMSIZE()

#define GIMP_VALUE_HOLDS_MEMSIZE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_MEMSIZE))

value :