From: Ben Pfaff Date: Sun, 18 Aug 2024 23:53:05 +0000 (-0700) Subject: work X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c8a7ff09b38e52198daa1bc4816bb2eca12d43a;p=pspp work --- diff --git a/rust/src/output/pivot/mod.rs b/rust/src/output/pivot/mod.rs index 9336cc0bd4..fde78fbd81 100644 --- a/rust/src/output/pivot/mod.rs +++ b/rust/src/output/pivot/mod.rs @@ -460,13 +460,52 @@ pub struct Footnote { show: bool, } +/// The content of a single pivot table cell. +/// +/// A [Value] is also a pivot table's title, caption, footnote marker and +/// contents, and so on. +/// +/// A given [Value] is one of: +/// +/// 1. A number resulting from a calculation. +/// +/// A number has an associated display format (usually [F] or [Pct]). This +/// format can be set directly, but that is not usually the easiest way. +/// Instead, it is usually true that all of the values in a single category +/// should have the same format (e.g. all "Significance" values might use +/// format `F40.3`), so PSPP makes it easy to set the default format for a +/// category while creating the category. See pivot_dimension_create() for +/// more details. +/// +/// [F]: crate::format::Format::F +/// [Pct]: crate::format::Format::Pct +/// +/// 2. A numeric or string value obtained from data (PIVOT_VALUE_NUMERIC or +/// PIVOT_VALUE_STRING). If such a value corresponds to a variable, then the +/// variable's name can be attached to the pivot_value. If the value has a +/// value label, then that can also be attached. When a label is present, +/// the user can control whether to show the value or the label or both. +/// +/// 3. A variable name (PIVOT_VALUE_VARIABLE). The variable label, if any, can +/// be attached too, and again the user can control whether to show the value +/// or the label or both. +/// +/// 4. A text string (PIVOT_VALUE_TEXT). The value stores the string in English +/// and translated into the output language (localized). Use +/// pivot_value_new_text() or pivot_value_new_text_format() for those cases. +/// In some cases, only an English or a localized version is available for +/// one reason or another, although this is regrettable; in those cases, use +/// pivot_value_new_user_text() or pivot_value_new_user_text_nocopy(). +/// +/// 5. A template. PSPP doesn't create these itself yet, but it can read and +/// interpret those created by SPSS. pub struct Value { styling: Option>, inner: ValueInner, } pub enum ValueInner { - Numeric { + Number { show: ValueShow, format: Spec, honor_small: bool, @@ -506,5 +545,5 @@ pub struct ValueStyle { font_style: FontStyle, cell_style: CellStyle, subscripts: Vec, - footnote_indexes: Vec + footnote_indexes: Vec, }