X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Foutput-item-provider.h;h=552549cee9eaa54fee0288fd2b5dc9877f49c637;hb=cb08510bbbab7646bc1031427243489024d22a3b;hp=a810f97c7d2627ae60bc49631b4554c68e408ebe;hpb=d0b91eae59319ab2756d0d43b9cb15eb9cd3c234;p=pspp diff --git a/src/output/output-item-provider.h b/src/output/output-item-provider.h index a810f97c7d..552549cee9 100644 --- a/src/output/output-item-provider.h +++ b/src/output/output-item-provider.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,8 @@ #ifndef OUTPUT_ITEM_PROVIDER_H #define OUTPUT_ITEM_PROVIDER_H 1 -#include +#include "libpspp/str.h" +#include "output/output-item.h" /* Class structure for an output item. @@ -25,11 +26,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 = xstrdup_if_nonnull ((SRC)->label), \ + } #endif /* output/output-item-provider.h */