Sese Framework  3.0.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::text Namespace Reference

Namespaces

namespace  overload
 

Classes

class  AbstractStringBuffer
 String buffer class. More...
 
class  DateTimeFormatter
 Date time formatter class. More...
 
class  DateTimeParser
 Date parser. More...
 
struct  FmtCtx
 
struct  FormatOption
 
class  Number
 Number to String Utility. More...
 
class  StringBuffer
 Thread-safe string buffer class. More...
 
class  StringBuilder
 Non-thread-safe string buffer class. More...
 
class  TextReader
 Text reader class. More...
 

Typedefs

using Char = sstr::SChar
 
using String = sstr::SString
 
using StringView = sstr::SStringView
 

Enumerations

enum class  Align { LEFT , CENTER , RIGHT }
 

Functions

bool FormatOption_StringParse (FormatOption &opt, const std::string &opt_str)
 
void FormatOption_StringFormat (FmtCtx &ctx, FormatOption &opt, const std::string &value)
 
bool FormatOption_NumberParse (FormatOption &opt, const std::string &opt_str)
 
template<typename T >
SESE_ALWAYS_INLINE void FormatOption_NumberFormatAlgin (FmtCtx &ctx, FormatOption &opt, T number, int radix, bool upper_case)
 
template<typename T >
void FormatOption_NumberFormat (FmtCtx &ctx, FormatOption &opt, T number)
 
template<typename T >
void FormatOption_FloatNumberFormat (FmtCtx &ctx, FormatOption &opt, T number)
 
template<typename C , std::enable_if_t<!is_pair< typename C::value_type >::value, int > = 0>
std::string for_each (const C &container)
 
constexpr size_t FormatParameterCounter (const char *pattern)
 
template<typename T >
void Format (FmtCtx &ctx, T &&arg)
 
template<typename T , typename... ARGS>
void Format (FmtCtx &ctx, T &&arg, ARGS &&...args)
 
template<typename... ARGS, std::enable_if_t< sizeof...(ARGS)==0, int > = 0>
std::string fmt (std::string_view pattern, ARGS &&...)
 
template<typename... ARGS, std::enable_if_t< sizeof...(ARGS) !=0, int > = 0>
std::string fmt (std::string_view pattern, ARGS &&...args)
 
int snprintf (char *buf, size_t buf_size, const char *pattern,...)
 

Typedef Documentation

◆ Char

◆ String

◆ StringView

Enumeration Type Documentation

◆ Align

enum class sese::text::Align
strong
Enumerator
LEFT 
CENTER 
RIGHT 

Function Documentation

◆ fmt() [1/2]

template<typename... ARGS, std::enable_if_t< sizeof...(ARGS)==0, int > = 0>
std::string sese::text::fmt ( std::string_view pattern,
ARGS && ... )

String formatting

Template Parameters
ARGSTemplate parameters
Parameters
patternMatch pattern
Returns
Formatted string

References FormatParameterCounter().

Referenced by sese::log::Logger::debug(), sese::log::Logger::error(), sese::log::Logger::info(), and sese::log::Logger::warn().

◆ fmt() [2/2]

template<typename... ARGS, std::enable_if_t< sizeof...(ARGS) !=0, int > = 0>
std::string sese::text::fmt ( std::string_view pattern,
ARGS &&... args )

String formatting

Template Parameters
ARGSTemplate parameters
Parameters
patternMatch pattern
argsArguments
Returns
Formatted string

References sese::text::FmtCtx::builder, Format(), FormatParameterCounter(), and sese::text::AbstractStringBuffer::toString().

◆ for_each()

template<typename C , std::enable_if_t<!is_pair< typename C::value_type >::value, int > = 0>
std::string sese::text::for_each ( const C & container)

◆ Format() [1/2]

template<typename T >
void sese::text::Format ( FmtCtx & ctx,
T && arg )

◆ Format() [2/2]

template<typename T , typename... ARGS>
void sese::text::Format ( FmtCtx & ctx,
T && arg,
ARGS &&... args )

◆ FormatOption_FloatNumberFormat()

template<typename T >
void sese::text::FormatOption_FloatNumberFormat ( FmtCtx & ctx,
FormatOption & opt,
T number )

◆ FormatOption_NumberFormat()

template<typename T >
void sese::text::FormatOption_NumberFormat ( FmtCtx & ctx,
FormatOption & opt,
T number )

Format string according to integer formatting standards, including alignment

Template Parameters
TInteger type
Parameters
ctxFormatting context
optOptions
numberInteger

References sese::text::FormatOption::ext_type, and FormatOption_NumberFormatAlgin().

Referenced by sese::text::overload::Formatter< VALUE, std::enable_if_t< std::is_integral_v< VALUE > > >::format().

◆ FormatOption_NumberFormatAlgin()

template<typename T >
SESE_ALWAYS_INLINE void sese::text::FormatOption_NumberFormatAlgin ( FmtCtx & ctx,
FormatOption & opt,
T number,
int radix,
bool upper_case )

◆ FormatOption_NumberParse()

bool sese::text::FormatOption_NumberParse ( FormatOption & opt,
const std::string & opt_str )

◆ FormatOption_StringFormat()

void sese::text::FormatOption_StringFormat ( FmtCtx & ctx,
FormatOption & opt,
const std::string & value )

◆ FormatOption_StringParse()

bool sese::text::FormatOption_StringParse ( FormatOption & opt,
const std::string & opt_str )

Parse and validate string formatting options

Parameters
optOption
opt_strOption string
Returns
Whether the parsing was successful

References sese::text::FormatOption::ext_type, sese::text::FormatOption::float_placeholder, and sese::text::FormatOption::parse().

Referenced by sese::text::overload::Formatter< const char * >::parse(), and sese::text::overload::Formatter< std::string >::parse().

◆ FormatParameterCounter()

size_t sese::text::FormatParameterCounter ( const char * pattern)
constexpr

References count().

Referenced by fmt(), and fmt().

◆ snprintf()

int sese::text::snprintf ( char * buf,
size_t buf_size,
const char * pattern,
... )

Cross-platform compatible snprintf

Parameters
bufOutput buffer
buf_sizeBuffer size
patternFormat string
...Arguments for the format string
Returns
Result