![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Case-insensitive string helpers matching legacy SWMM name semantics. More...
#include <cstddef>#include <cstdint>#include <string_view>Go to the source code of this file.
Classes | |
| struct | openswmm::CiHash |
| Transparent case-insensitive hash (FNV-1a over the uppercase fold). More... | |
| struct | openswmm::CiEqual |
| Transparent case-insensitive equality for unordered containers. More... | |
Namespaces | |
| namespace | openswmm |
Functions | |
| constexpr char | openswmm::ci_upper (char c) noexcept |
| ASCII-only uppercase fold; mirrors legacy hash.c UCHAR exactly. | |
| bool | openswmm::ieq (std::string_view a, std::string_view b) noexcept |
| Case-insensitive equality (ASCII fold), matching legacy samestr(). | |
Case-insensitive string helpers matching legacy SWMM name semantics.
The legacy engine's hash table (src/legacy/engine/hash.c) compares and hashes object names case-insensitively via its UCHAR macro, which uppercases ASCII letters only. Every name lookup in the refactored engine that must be legacy-parity therefore folds case with the helpers here — ASCII-only, byte-for-byte the same fold as UCHAR — never with locale-dependent std::toupper.
CiHash/CiEqual are transparent (heterogeneous) functors so an unordered_map<std::string, T, CiHash, CiEqual> can be probed with a std::string_view without allocating a temporary key, while the stored keys keep their original spelling for faithful round-trip output.