OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
InputParseUtils.hpp File Reference

Shared parsing utilities for input section handlers. More...

#include <string_view>
#include <string>
#include <vector>
#include <charconv>
#include "../core/charconv_compat.hpp"
#include "../core/DateTime.hpp"
#include "../core/ErrorCodes.hpp"
#include "../data/NameIndex.hpp"
Include dependency graph for InputParseUtils.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  openswmm
 
namespace  openswmm::input
 

Functions

double openswmm::input::to_double (std::string_view sv, double def=0.0) noexcept
 Parse a numeric prefix, retaining a supplied default when conversion fails.
 
bool openswmm::input::parse_double_strict (std::string_view sv, double &out) noexcept
 Parse a complete token while preserving the output on refusal.
 
int openswmm::input::to_int (std::string_view sv, int def=0) noexcept
 Parse a signed integer prefix using decimal from_chars.
 
double openswmm::input::parse_date (std::string_view sv)
 Parse month/day/year or month-day-year input into SWMM decimal days.
 
double openswmm::input::parse_time_seconds (std::string_view sv)
 Parse a duration as decimal seconds or permissive hour/minute/second fields.
 
double openswmm::input::parse_time_day_fraction (std::string_view sv)
 Parse decimal hours or permissive clock fields into elapsed days.
 
double openswmm::input::parse_datetime (std::string_view date_sv, std::string_view time_sv)
 Combine the permissive date and decimal-hour/clock parsers.
 
int openswmm::input::add_unique (NameIndex &reg, const std::string &name, std::vector< std::string > &errors)
 Register a one-definition object name or append a duplicate diagnostic.
 

Detailed Description

Shared parsing utilities for input section handlers.

Consolidates duplicated helper functions (to_double, to_int, parse_date, parse_time) that were previously defined as static functions in each handler .cpp file.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License
Apache-2.0