Sese Framework
3.0.0
A cross-platform framework
|
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,...) |
using sese::text::Char = sstr::SChar |
using sese::text::String = sstr::SString |
|
strong |
std::string sese::text::fmt | ( | std::string_view | pattern, |
ARGS && | ... ) |
String formatting
ARGS | Template parameters |
pattern | Match pattern |
References FormatParameterCounter().
Referenced by sese::log::Logger::debug(), sese::log::Logger::error(), sese::log::Logger::info(), and sese::log::Logger::warn().
std::string sese::text::fmt | ( | std::string_view | pattern, |
ARGS &&... | args ) |
String formatting
ARGS | Template parameters |
pattern | Match pattern |
args | Arguments |
References sese::text::FmtCtx::builder, Format(), FormatParameterCounter(), and sese::text::AbstractStringBuffer::toString().
std::string sese::text::for_each | ( | const C & | container | ) |
References sese::text::FmtCtx::builder, and sese::text::AbstractStringBuffer::toString().
void sese::text::Format | ( | FmtCtx & | ctx, |
T && | arg ) |
void sese::text::Format | ( | FmtCtx & | ctx, |
T && | arg, | ||
ARGS &&... | args ) |
void sese::text::FormatOption_FloatNumberFormat | ( | FmtCtx & | ctx, |
FormatOption & | opt, | ||
T | number ) |
Format string according to floating-point formatting standards
T | Floating-point type |
ctx | Formatting context |
opt | Options |
number | Floating-point number |
References sese::text::FormatOption::align, sese::text::AbstractStringBuffer::append(), sese::text::FmtCtx::builder, CENTER, sese::text::FormatOption::ext_type, sese::text::FormatOption::float_placeholder, sese::floating2StringLength(), LEFT, RIGHT, sese::text::Number::toString(), sese::text::FormatOption::wide, and sese::text::FormatOption::wide_char.
Referenced by sese::text::overload::Formatter< VALUE, std::enable_if_t< std::is_floating_point_v< VALUE > > >::format().
void sese::text::FormatOption_NumberFormat | ( | FmtCtx & | ctx, |
FormatOption & | opt, | ||
T | number ) |
Format string according to integer formatting standards, including alignment
T | Integer type |
ctx | Formatting context |
opt | Options |
number | Integer |
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().
SESE_ALWAYS_INLINE void sese::text::FormatOption_NumberFormatAlgin | ( | FmtCtx & | ctx, |
FormatOption & | opt, | ||
T | number, | ||
int | radix, | ||
bool | upper_case ) |
bool sese::text::FormatOption_NumberParse | ( | FormatOption & | opt, |
const std::string & | opt_str ) |
Parse and validate string formatting options
opt | Option |
opt_str | Option string |
References sese::text::FormatOption::ext_type, sese::text::FormatOption::float_placeholder, and sese::text::FormatOption::parse().
Referenced by sese::text::overload::Formatter< VALUE, std::enable_if_t< std::is_floating_point_v< VALUE > > >::parse(), and sese::text::overload::Formatter< VALUE, std::enable_if_t< std::is_integral_v< VALUE > > >::parse().
void sese::text::FormatOption_StringFormat | ( | FmtCtx & | ctx, |
FormatOption & | opt, | ||
const std::string & | value ) |
Format string according to formatting options (alignment)
ctx | Context |
opt | Options |
value | String |
References sese::text::FormatOption::align, sese::text::FmtCtx::builder, CENTER, LEFT, RIGHT, sese::text::FormatOption::wide, and sese::text::FormatOption::wide_char.
Referenced by sese::text::overload::Formatter< const char * >::format(), and sese::text::overload::Formatter< std::string >::format().
bool sese::text::FormatOption_StringParse | ( | FormatOption & | opt, |
const std::string & | opt_str ) |
Parse and validate string formatting options
opt | Option |
opt_str | Option string |
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().
|
constexpr |
int sese::text::snprintf | ( | char * | buf, |
size_t | buf_size, | ||
const char * | pattern, | ||
... ) |
Cross-platform compatible snprintf
buf | Output buffer |
buf_size | Buffer size |
pattern | Format string |
... | Arguments for the format string |