GwyStringList: Gwyddion Library Reference Manual

## GwyStringList GwyStringList — A string list object wrapper |

## Functions

GwyStringList * | gwy_string_list_new ()
void | gwy_string_list_append ()
void | gwy_string_list_append_take ()
guint | gwy_string_list_get_length ()
const gchar * | gwy_string_list_get ()
void | gwy_string_list_clear ()
GwyStringList * | gwy_string_list_copy ()
void | gwy_string_list_assign ()

## Signals

void | value-changed | Run First

## Types and Values

struct | GwyStringList
struct | GwyStringListClass

## Object Hierarchy

        GObject
        ╰── GwyStringList

## Implemented Interfaces

GwyStringList implements GwySerializable.

## Includes

    #include <libgwyddion/gwyddion.h>

## Description

GwyStringList object represents a reference-counted, serializable list of strings.

## Functions

### gwy_string_list_new()

    GwyStringList *
    gwy_string_list_new (void);

Creates a new string list.

#### Returns

A new empty string list.

### gwy_string_list_append()

    void
    gwy_string_list_append (GwyStringList *strlist,
                            const gchar *string);

Appends a string to the end of a string list.

#### Parameters

strlist | A string list. |
string | A string to add. |

### gwy_string_list_append_take()

    void
    gwy_string_list_append_take (GwyStringList *strlist,
                                 gchar *string);

Appends a string to the end of a string list, taking ownership of the string.

The string must be dynamically allocated and will be eventually freed with `g_free()`.

#### Parameters

strlist | A string list. |
string | A string to add. |

### gwy_string_list_get_length()

    guint
    gwy_string_list_get_length (GwyStringList *strlist);

Gets the number of strings in a string list.

#### Parameters

strlist | A string list. |

#### Returns

The number of strings in `strlist` .

### gwy_string_list_get()

    const gchar *
    gwy_string_list_get (GwyStringList *strlist,
                         guint i);

Gets a string from a string list by position.

#### Parameters

strlist | A string list. |
i | The position of string to get. |

#### Returns

The string, owned by `strlist` . It is valid only until `strlist` changes.

### gwy_string_list_clear()

    void
    gwy_string_list_clear (GwyStringList *strlist);

Clears the contents of a string list, removing all strings.

#### Parameters

strlist | A string list. |

### gwy_string_list_copy()

    GwyStringList *
    gwy_string_list_copy (GwyStringList *strlist);

Create a new string list as a copy of an existing one.

This function is a convenience `gwy_serializable_copy()` wrapper.

#### Parameters

strlist | A string list to duplicate. |

#### Returns

A copy of the string list.

[transfer full]

### gwy_string_list_assign()

    void
    gwy_string_list_assign (GwyStringList *destination,
                            GwyStringList *source);

Makes one string list equal to another.

This function is a convenience `gwy_serializable_assign()` wrapper.

#### Parameters

destination | Target string list. |
source | Source string list. |

## Types and Values

### struct GwyStringList

    struct GwyStringList;

### struct GwyStringListClass

    struct GwyStringListClass {
        GObjectClass parent_class;

        void (*value_changed)(GwyStringList *strlist);
    };

## Signal Details

### The `“value-changed”` signal

    void
    user_function (GwyStringList *gwystrlist,
                   gpointer       user_data)

The ::value-changed signal is emitted whenever a string list changes.

#### Parameters

gwystrlist | The GwyStringList which received the signal. |
user_data | user data set when the signal handler was connected. |

Flags: Run First