147 return segments_.empty();
155 [[nodiscard]]
const std::vector<std::vector<std::string>> &
segments()
const
168 return canonical_ == other.canonical_;
179 return canonical_ <=> other.canonical_;
183 std::vector<std::vector<std::string>> segments_;
184 std::string canonical_;
187 void compute_canonical();
196[[nodiscard]] std::string
to_string(
const DynamicCasedName &value);
217 return std::hash<std::string>{}(name.canonical());
230 constexpr auto parse(std::format_parse_context &ctx)
A smart string wrapper that preserves word structure for lossless case format conversion.
static DynamicCasedName from_c_identifier(const std::string &input)
Constructs from a C identifier format string (PascalCase segments joined by underscores).
static DynamicCasedName from_flat_case(const std::string &input)
Constructs from a flatcase input string (all lowercase, no separators).
bool operator==(const DynamicCasedName &other) const
Equality comparison based on canonical form.
std::string to_snake_case() const
Outputs all words flattened and joined with underscores.
std::string to_pascal_case() const
Outputs all words flattened and joined in PascalCase (each word capitalized, no separators).
const std::string & canonical() const
Returns the canonical form (all words lowercase, no separators).
std::string to_c_identifier() const
Outputs PascalCase within each segment, with segments joined by underscores.
DynamicCasedName()=default
static DynamicCasedName from_pascal_case(const std::string &input)
Constructs from a PascalCase input string.
bool empty() const
Checks if this name is empty (has no segments/words).
std::string to_flat_case() const
Outputs all words joined with no separators, all lowercase.
const std::vector< std::vector< std::string > > & segments() const
Returns the internal two-level segment/word structure.
auto operator<=>(const DynamicCasedName &other) const
Three-way comparison based on canonical form.
static DynamicCasedName from_snake_case(const std::string &input)
Constructs from a snake_case input string.
std::ostream & operator<<(std::ostream &os, const PrimaryPairingMode m)
Stream insertion operator for PrimaryPairingMode.
std::string to_string(const PrimaryPairingMode m)
Converts a PrimaryPairingMode to its canonical string representation.
std::size_t operator()(const porytiles::DynamicCasedName &name) const noexcept