X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Foutput-item-provider.h;h=7517996119112faa2d683dde6d6522d01b492595;hb=afe3c5f8563dba738b2144ae0679834f4c366048;hp=aa2584bef4006d0221535ffbbd6d1f837eba5c04;hpb=ce219cff17ff1ed06eb9be84a220d870a1a80e80;p=pspp diff --git a/src/output/output-item-provider.h b/src/output/output-item-provider.h index aa2584bef4..7517996119 100644 --- a/src/output/output-item-provider.h +++ b/src/output/output-item-provider.h @@ -25,13 +25,22 @@ instance of output_item. */ struct output_item_class { - const char *name; + /* 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 */