gimpmemsize: GIMP Base Library Reference Manual

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

## Functions

gchar * | gimp_memsize_serialize ()
gboolean | gimp_memsize_deserialize ()
gchar * | gimp_memsize_to_string ()
#define | GIMP_TYPE_MEMSIZE
#define | GIMP_TYPE_PARAM_MEMSIZE
#define | GIMP_IS_PARAM_SPEC_MEMSIZE()
GParamSpec * | gimp_param_spec_memsize ()
#define | GIMP_VALUE_HOLDS_MEMSIZE()

## Description

Functions to (de)serialize a given memory size.

## Functions

### 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 `g_format_size()`.

#### Parameters

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()`.

#### Parameters

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);

`gimp_memsize_to_string` is deprecated and should not be used in newly-written code.

This function is deprecated! Use `g_format_size()` instead.

#### Parameters

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_TYPE_PARAM_MEMSIZE

    #define GIMP_TYPE_PARAM_MEMSIZE           (gimp_param_memsize_get_type ())

`GIMP_TYPE_PARAM_MEMSIZE` is deprecated and should not be used in newly-written code.

### GIMP_IS_PARAM_SPEC_MEMSIZE()

    #define GIMP_IS_PARAM_SPEC_MEMSIZE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_MEMSIZE))

### gimp_param_spec_memsize ()

    GParamSpec *
    gimp_param_spec_memsize (const gchar *name,
                             const gchar *nick,
                             const gchar *blurb,
                             guint64 minimum,
                             guint64 maximum,
                             guint64 default_value,
                             GParamFlags flags);

Creates a param spec to hold a memory size value. See `g_param_spec_internal()` for more information.

#### Parameters

name | Canonical name of the param |
nick | Nickname of the param |
blurb | Brief desciption of param. |
minimum | Smallest allowed value of the parameter. |
maximum | Largest allowed value of the parameter. |
default_value | Value to use if none is assigned. |
flags | a combination of GParamFlags |

#### Returns

a newly allocated GParamSpec instance

Since: GIMP 2.4

### GIMP_VALUE_HOLDS_MEMSIZE()

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

## Types and Values