Next: , Previous: Value Labels Properties, Up: Value Labels


2.4.3 Adding and Removing Labels

These functions add and remove value labels from a struct val_labs object. These functions apply only to numeric and short string sets of value labels. They have no effect on long string sets of value labels, since these sets are always empty.

— Function: bool val_labs_add (struct val_labs *val_labs, union value value, const char *label)

Adds label to in var_labs as a label for value, which must have the same width as the set of value labels. Returns true if successful, false if value already has a label or if val_labs has long string width.

— Function: void val_labs_replace (struct val_labs *val_labs, union value value, const char *label)

Adds label to in var_labs as a label for value, which must have the same width as the set of value labels. If value already has a label in var_labs, it is replaced. Has no effect if var_labs has long string width.

— Function: bool val_labs_remove (struct val_labs *val_labs, union value value)

Removes from val_labs any label for value, which must have the same width as the set of value labels. Returns true if a label was removed, false otherwise.