SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
externalcolumnfile.h File Reference

Shared column enumeration + single-column reader for external multi-column series files (CSV / TSV / PCSWMM .tsf). More...

#include <QString>
#include <QStringList>
#include <QVector>
Include dependency graph for externalcolumnfile.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  openswmmvis::ui::ExternalSeriesPoint
 One parsed sample: SWMM DateTime (days since 1899-12-30) + value. More...
 

Namespaces

namespace  openswmmvis
 
namespace  openswmmvis::ui
 

Functions

QStringList openswmmvis::ui::readHeaders (const QString &path, QString *errorOut=nullptr, bool *fabricatedOut=nullptr)
 Enumerate the value-column names of path (time column excluded).
 
int openswmmvis::ui::readColumn (const QString &path, const QString &columnSelector, QVector< ExternalSeriesPoint > &pointsOut, QStringList *headersOut=nullptr, QString *errorOut=nullptr, bool *fabricatedOut=nullptr)
 Read one column of path into pointsOut.
 
QString openswmmvis::ui::reconcileColumnSelector (const QString &path, const QString &current)
 The column selector path should carry, given current.
 

Detailed Description

Shared column enumeration + single-column reader for external multi-column series files (CSV / TSV / PCSWMM .tsf).

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License\n GPL-3.0-or-later

Extracted from TimeseriesEditorDialog::loadExternalFileIntoProvider_'s inline header-vs-data probe so the timeseries dialog and the rain-gage editors share one implementation (spec §4 task 1, workplans/MULTICOLUMN_SERIES_SINGLE_READ_2026-08-17.md). Format detection mirrors the engine's MultiColumnSeriesFile.cpp:

  • TSF: first content line begins "IDs:" (case-insensitive) → tab delimited; line-1 tokens 1..N name the columns; lines 2 (parameter row) and 3 (units row) carry no data and are skipped.
  • CSV/TSV: delimiter sniffed from the header row (quoted regions skipped); when the first content line parses as a data row, "col_N" display names are fabricated — but that line is still spent as the header row, as the engine spends it, so the two agree on which rows are data. QtCore-only — safe for unit tests without widgets. The pure string / datetime rules live in externalcolumnfilecore.h.