ToyGine2 26.2.0
Game Engine for retro consoles
Loading...
Searching...
No Matches
String Utilities

Classes and concepts for string manipulation and formatting. More...

Concepts

concept  toy::StringLike
 Concept satisfied when T exposes size() as size_t and c_str() as a pointer to null-terminated characters.

Classes

class  toy::CStringView
 Non-owning string view class for C-style strings. More...
class  toy::FixedString< allocatedSize >
 Template string class with fixed-size character buffer. More...
class  toy::FormatString< Args >
 Wrapper around a toy::CStringView pattern with consteval validation of placeholders. More...
class  toy::OStringStream< StringType >
 Output stream that appends formatted values into a toy::StringLike backend. More...
class  toy::StringFixedStorage< AllocatedSize >
 Fixed-size character storage with a tracked length and implicit null terminator at data()[size()]. More...

Enumerations

enum class  toy::FormatPatternValidationError {
  toy::FormatPatternValidationError::none , toy::FormatPatternValidationError::unmatchedBrace , toy::FormatPatternValidationError::invalidContent , toy::FormatPatternValidationError::mixedPlaceholders ,
  toy::FormatPatternValidationError::argCountMismatch , toy::FormatPatternValidationError::indexOutOfRange
}
 Result of validating a format pattern against an expected argument count. More...

Functions

constexpr FormatPatternValidationError toy::anonymous_namespace{format_pattern.inl}::validateFormatImpl (const CStringView &string, size_t argCount) noexcept
 Validates auto-indexed {} and positional {N} placeholders for argCount arguments.
constexpr FormatPatternValidationError toy::validateFormatPattern (const CStringView &string, size_t argCount) noexcept
 Validates auto-indexed {} and positional {N} placeholders for argCount arguments.

Detailed Description

Classes and concepts for string manipulation and formatting.

This group contains all string-related types and utilities in the core module:

Key Features

  • Zero or minimal dynamic allocation
  • Constexpr support where possible
  • Exception safety (noexcept operations)
  • Type safety through C++20 concepts
  • Cross-platform compatibility

Enumeration Type Documentation

◆ FormatPatternValidationError

Result of validating a format pattern against an expected argument count.

Enumerator
none 

Pattern is valid for the given argument count.

unmatchedBrace 

Stray or incomplete { / } (not {{, }}, {}, or {N}).

invalidContent 

Positional {N…} not closed by }, or disallowed characters after the index.

mixedPlaceholders 

Mixed auto {} and positional {N} in one pattern.

argCountMismatch 

Placeholder count vs expected argument count mismatch (including empty pattern with arguments).

indexOutOfRange 

Positional index out of range or overflow while parsing digits.

Function Documentation

◆ validateFormatImpl()

FormatPatternValidationError toy::anonymous_namespace{format_pattern.inl}::validateFormatImpl ( const CStringView & string,
size_t argCount )
nodiscardconstexprnoexcept

Validates auto-indexed {} and positional {N} placeholders for argCount arguments.

Parameters
stringPattern to scan.
argCountNumber of format arguments.
Returns
FormatPatternValidationError::none when the pattern is valid; otherwise the first validation error encountered.
Note
Internal implementation for validateFormatPattern; not part of the public API.

◆ validateFormatPattern()

FormatPatternValidationError toy::validateFormatPattern ( const CStringView & string,
size_t argCount )
nodiscardconstexprnoexcept

Validates auto-indexed {} and positional {N} placeholders for argCount arguments.

Parameters
stringPattern to scan.
argCountNumber of format arguments.
Returns
Error code; FormatPatternValidationError::none when the pattern is consistent with argCount.