self, Cases, DecodedRecord, DocumentRecord, EncodingRecord, Extension, FileAttributeRecord,
FloatInfoRecord, HeaderRecord, IntegerInfoRecord, LongNamesRecord,
LongStringMissingValueRecord, LongStringValueLabelRecord, MultipleResponseRecord,
- NumberOfCasesRecord, ProductInfoRecord, RawStr, ValueLabelRecord, VarDisplayRecord,
- VariableAttributeRecord, VariableRecord, VariableSetRecord, VeryLongStringsRecord, ZHeader,
- ZTrailer,
+ NumberOfCasesRecord, ProductInfoRecord, RawStr, ValueLabel, ValueLabelRecord,
+ VarDisplayRecord, VariableAttributeRecord, VariableRecord, VariableSetRecord,
+ VeryLongStringsRecord, ZHeader, ZTrailer,
},
};
use chrono::{NaiveDate, NaiveDateTime, NaiveTime};
variables: long_string_variables,
});
}
+
+ for dict_index in dict_indexes {
+ let mut variable = &dictionary.variables[dict_index];
+ for ValueLabel { value, label } in record.labels.iter().cloned() {
+
+ }
+ }
}
let metadata = Metadata::decode(&headers, warn);
/// replaced by LF.
///
/// (A product that identifies itself as VOXCO INTERVIEWER 4.3 produces system
-/// files that use CR-only line ends in the file label and extra product
-/// info.) */
+/// files that use CR-only line ends in the file label and extra product info.)
fn fix_line_ends(s: &str) -> String {
let mut out = String::with_capacity(s.len());
let mut s = s.chars().peekable();
Ok(Some(values))
}
- fn decode(self, decoder: &Decoder) -> Value<String> {
+ pub fn decode(self, decoder: &Decoder) -> Value<String> {
match self {
Self::Number(x) => Value::Number(x),
Self::String(s) => Value::String(decoder.decode_exact_length(&s.0).into()),
let start_offset = r.stream_position()?;
let width: i32 = endian.parse(read_bytes(r)?);
if !(-1..=255).contains(&width) {
- return Err(Error::BadVariableWidth { start_offset, width });
+ return Err(Error::BadVariableWidth {
+ start_offset,
+ width,
+ });
}
let code_offset = r.stream_position()?;
let has_variable_label: u32 = endian.parse(read_bytes(r)?);
n,
max: Self::MAX_INDEXES,
});
+ } else if n == 0 {
+ warn(Warning::NoVarIndexes {
+ offset: index_offset,
+ });
+ return Ok(None);
}
-
+
let index_offset = r.stream_position()?;
let mut dict_indexes = Vec::with_capacity(n as usize);
let mut invalid_indexes = Vec::new();
}
let Some(&first_index) = dict_indexes.first() else {
- warn(Warning::NoVarIndexes {
- offset: index_offset,
- });
return Ok(None);
};
let var_type = var_types[first_index as usize - 1];