/* 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
#ifndef OUTPUT_ITEM_PROVIDER_H
#define OUTPUT_ITEM_PROVIDER_H 1
-#include <output/output-item.h>
+#include "libpspp/str.h"
+#include "output/output-item.h"
/* Class structure for an output item.
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), \
+ .command_name = xstrdup_if_nonnull ((SRC)->command_name), \
+ }
#endif /* output/output-item-provider.h */