summaryrefslogtreecommitdiff
path: root/src/csv.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/csv.cc')
-rw-r--r--src/csv.cc27
1 files changed, 6 insertions, 21 deletions
diff --git a/src/csv.cc b/src/csv.cc
index 4ee7ff60..632ec8d6 100644
--- a/src/csv.cc
+++ b/src/csv.cc
@@ -107,28 +107,13 @@ void csv_reader::read_index(std::istream& in)
string field = read_field(instr);
names.push_back(field);
- if (date_mask.match(field))
- index.push_back(FIELD_DATE);
- else if (date_aux_mask.match(field))
- index.push_back(FIELD_DATE_AUX);
- else if (code_mask.match(field))
- index.push_back(FIELD_CODE);
- else if (payee_mask.match(field))
- index.push_back(FIELD_PAYEE);
- else if (credit_mask.match(field))
- index.push_back(FIELD_CREDIT);
- else if (debit_mask.match(field))
- index.push_back(FIELD_DEBIT);
- else if (cost_mask.match(field))
- index.push_back(FIELD_COST);
- else if (total_mask.match(field))
- index.push_back(FIELD_TOTAL);
- else if (note_mask.match(field))
- index.push_back(FIELD_NOTE);
- else
- index.push_back(FIELD_UNKNOWN);
-
DEBUG("csv.parse", "Header field: " << field);
+ for (auto& mask : masks) {
+ if (mask.first.match(field)) {
+ index.push_back(mask.second);
+ break;
+ }
+ }
}
}