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
openswmmvis::ui::extcol Namespace Reference

Classes

struct  DateTimeParts
 Calendar components produced by parseSeriesDateTime(). More...
 

Functions

std::string cellTrim (const std::string &s)
 Trim ASCII whitespace and one surrounding pair of double quotes. Mirrors the engine's cell_trim.
 
std::vector< std::string > splitCells (const std::string &line, char delim)
 Quote-aware split on a single-character delimiter (engine cell_split).
 
bool iequals (const std::string &a, const std::string &b)
 Case-insensitive equality (engine csv_iequals).
 
void normalizeLine (std::string &line, bool firstLine)
 Strip a UTF-8 BOM (first line only) and a trailing '\r'.
 
bool isBlankOrComment (const std::string &line)
 True for empty/all-whitespace lines and ';'/'#' comment lines.
 
bool isTsfHeader (const std::string &line)
 True when the (normalized) line starts a PCSWMM .tsf header — case-insensitive "IDs:" prefix, per the engine's format sniff.
 
char sniffDelimiter (const std::string &headerLine)
 Sniff the cell delimiter from the header row. The engine rule is "tab when tabs > 0 and tabs >= commas, else comma"; the GUI additionally recognizes semicolon-delimited files (io::guessDelimiter), so that extension is preserved here — the two agree on every engine-loadable file.
 
int trailingMeridiem (const std::string &cell)
 0 = none, 1 = AM, 2 = PM — from the cell's trailing token (engine trailing_meridiem).
 
bool parseSeriesDateTime (const std::string &cell, DateTimeParts &out)
 Parse a series timestamp cell into calendar components.
 
void splitPathColumn (const std::string &token, std::string &pathOut, std::string &columnOut)
 Split a "path[:column]" token into its parts.
 
std::string composePathColumn (const std::string &path, const std::string &column)
 Compose the "path:column" token (empty column → bare path). The GUI always builds this token itself — the user never types the colon.
 
int findColumn (const std::vector< std::string > &valueHeaders, const std::string &name)
 Resolve a column selector against a value-column name list (0-based, time column excluded). Case-insensitive, mirroring the engine's find_column. Returns -1 when name matches nothing.
 
std::string fabricatedColumnName (std::size_t oneBasedIndex)
 Display name the GUI shows for value column oneBasedIndex of a headerless file. Single definition of the convention.
 

Function Documentation

◆ cellTrim()

std::string openswmmvis::ui::extcol::cellTrim ( const std::string &  s)
inline

Trim ASCII whitespace and one surrounding pair of double quotes. Mirrors the engine's cell_trim.

Here is the caller graph for this function:

◆ composePathColumn()

std::string openswmmvis::ui::extcol::composePathColumn ( const std::string &  path,
const std::string &  column 
)
inline

Compose the "path:column" token (empty column → bare path). The GUI always builds this token itself — the user never types the colon.

Here is the caller graph for this function:

◆ fabricatedColumnName()

std::string openswmmvis::ui::extcol::fabricatedColumnName ( std::size_t  oneBasedIndex)
inline

Display name the GUI shows for value column oneBasedIndex of a headerless file. Single definition of the convention.

These names exist only in the GUI preview: the engine has no header-vs-data probe (it always spends the first content line as the header row), so a fabricated name can never be resolved by find_column and must never reach a persisted "path:col" token (review B-4). Callers learn that a header list is fabricated from readHeaders()/readColumn()'s fabricatedOut flag — never by pattern-matching this string, which a real file is free to use as a genuine header.

◆ findColumn()

int openswmmvis::ui::extcol::findColumn ( const std::vector< std::string > &  valueHeaders,
const std::string &  name 
)
inline

Resolve a column selector against a value-column name list (0-based, time column excluded). Case-insensitive, mirroring the engine's find_column. Returns -1 when name matches nothing.

Here is the call graph for this function:

◆ iequals()

bool openswmmvis::ui::extcol::iequals ( const std::string &  a,
const std::string &  b 
)
inline

Case-insensitive equality (engine csv_iequals).

Here is the caller graph for this function:

◆ isBlankOrComment()

bool openswmmvis::ui::extcol::isBlankOrComment ( const std::string &  line)
inline

True for empty/all-whitespace lines and ';'/'#' comment lines.

◆ isTsfHeader()

bool openswmmvis::ui::extcol::isTsfHeader ( const std::string &  line)
inline

True when the (normalized) line starts a PCSWMM .tsf header — case-insensitive "IDs:" prefix, per the engine's format sniff.

Here is the call graph for this function:

◆ normalizeLine()

void openswmmvis::ui::extcol::normalizeLine ( std::string &  line,
bool  firstLine 
)
inline

Strip a UTF-8 BOM (first line only) and a trailing '\r'.

◆ parseSeriesDateTime()

bool openswmmvis::ui::extcol::parseSeriesDateTime ( const std::string &  cell,
DateTimeParts out 
)
inline

Parse a series timestamp cell into calendar components.

Mirrors the engine's parse_series_datetime exactly:

  • ISO-8601: YYYY-MM-DD[ T]HH:MM[:SS]
  • US: M/D/YYYY [H:MM[:SS]] with an optional trailing AM/PM token (the PCSWMM .tsf form; 12:xx AM → 00:xx, h PM → h+12) Component validity (real calendar date, hour range) is the caller's concern — the engine defers that to its date encoder, the Qt wrapper defers it to QDate/QTime.
Here is the call graph for this function:

◆ sniffDelimiter()

char openswmmvis::ui::extcol::sniffDelimiter ( const std::string &  headerLine)
inline

Sniff the cell delimiter from the header row. The engine rule is "tab when tabs > 0 and tabs >= commas, else comma"; the GUI additionally recognizes semicolon-delimited files (io::guessDelimiter), so that extension is preserved here — the two agree on every engine-loadable file.

Delimiters inside a quoted cell are NOT counted (review B-8): a tab-delimited header like Date<TAB>"a,b,c" used to sniff as comma and then mis-split every row. Quote handling now matches splitCells().

◆ splitCells()

std::vector< std::string > openswmmvis::ui::extcol::splitCells ( const std::string &  line,
char  delim 
)
inline

Quote-aware split on a single-character delimiter (engine cell_split).

Here is the call graph for this function:

◆ splitPathColumn()

void openswmmvis::ui::extcol::splitPathColumn ( const std::string &  token,
std::string &  pathOut,
std::string &  columnOut 
)
inline

Split a "path[:column]" token into its parts.

Unified rule, shared with both engine readers (review B-2 — the engine's gage reader used first-colon-after-drive-letter while its timeseries reader used rfind(':'), so a path containing a colon produced two different cache keys):

  1. Consider the LAST ':' in the token.
  2. Ignore it when it is a Windows drive-letter colon (index 1 with an alphabetic index 0), e.g. "C:\rain.csv".
  3. Treat it as the column separator only when the suffix after it holds no path separator ('/' or '\'); otherwise the colon belongs to a directory name (POSIX/macOS allow it, e.g. "/x/Data:2024/f.csv"). No separator → the whole token is the path and the column is empty.
Here is the caller graph for this function:

◆ trailingMeridiem()

int openswmmvis::ui::extcol::trailingMeridiem ( const std::string &  cell)
inline

0 = none, 1 = AM, 2 = PM — from the cell's trailing token (engine trailing_meridiem).

Here is the caller graph for this function: