- An output item is an abstract class, that is, a plain output_item is not
- useful on its own. Thus, this function is normally called from the
- initialization function of some subclass of output_item. */
+/* Returns the label for ITEM, which the caller must not modify or free. */
+const char *
+output_item_get_label (const struct output_item *item)
+{
+ return item->label ? item->label : item->class->get_label (item);
+}
+
+/* Sets the label for ITEM to LABEL. The caller retains ownership of LABEL.
+ If LABEL is nonnull, it overrides any previously set label and the default
+ label. If LABEL is null, ITEM will now use its default label.
+
+ ITEM must not be shared. */
+void
+output_item_set_label (struct output_item *item, const char *label)
+{
+ output_item_set_label_nocopy (item, label ? xstrdup (label) : NULL);
+}
+
+/* Sets the label for ITEM to LABEL, transferring ownership of LABEL to ITEM.
+ If LABEL is nonnull, it overrides any previously set label and the default
+ label. If LABEL is null, ITEM will now use its default label.
+
+ ITEM must not be shared. */