X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Foutput-item-provider.h;h=7517996119112faa2d683dde6d6522d01b492595;hb=5f894a49a00de93333e64db483c193669c937a45;hp=1273f13419df8819c139f7fd07a60d60ff9dfd49;hpb=81579d9e9f994fb2908f50af41c3eb033d216e58;p=pspp diff --git a/src/output/output-item-provider.h b/src/output/output-item-provider.h index 1273f13419..7517996119 100644 --- a/src/output/output-item-provider.h +++ b/src/output/output-item-provider.h @@ -25,11 +25,22 @@ instance of output_item. */ struct output_item_class { + /* Returns the localized label to use for ITEM. This is only called when + ITEM does not have an explicitly set label, that is, when 'item->label' + is NULL. */ + const char *(*get_label) (const struct output_item *item); + /* Destroys and frees ITEM. Called when output_item_unref() drops ITEM's reference count to 0. */ void (*destroy) (struct output_item *item); }; -void output_item_init (struct output_item *, const struct output_item_class *); +#define OUTPUT_ITEM_INITIALIZER(CLASS) { .class = CLASS, .ref_cnt = 1 } +#define OUTPUT_ITEM_CLONE_INITIALIZER(SRC) \ + { \ + .class = (SRC)->class, \ + .ref_cnt = 1, \ + .label = (SRC)->label ? xstrdup ((SRC)->label) : NULL, \ + } #endif /* output/output-item-provider.h */