microfmt
Zero-allocation C++ formatting for constrained environments
Loading...
Searching...
No Matches
Classes | Namespaces | Enumerations | Functions
styled.hpp File Reference

Zero-allocation text casing, quoting, truncation, and alignment view. More...

#include "../microfmt.hpp"
#include <cstddef>
#include <cstdint>
#include <string_view>
#include <type_traits>
#include "styled.ipp"
Include dependency graph for styled.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  microfmt::styled_str_view
 
struct  microfmt::formatter< styled_str_view >
 

Namespaces

namespace  microfmt
 

Enumerations

enum class  microfmt::text_case : uint8_t { microfmt::none = 0 , microfmt::upper , microfmt::lower , microfmt::title }
 
enum class  microfmt::text_align : uint8_t { microfmt::left = 0 , microfmt::center , microfmt::right }
 
enum class  microfmt::quote_style : uint8_t {
  microfmt::none = 0 , microfmt::double_quotes , microfmt::single_quotes , microfmt::brackets ,
  microfmt::parens , microfmt::angle_brackets
}
 

Functions

constexpr styled_str_view microfmt::pad (microfmt::string_view s, size_t width, text_align a=text_align::left, char fill=' ') noexcept
 
constexpr styled_str_view microfmt::pad_center (microfmt::string_view s, size_t width, char fill=' ') noexcept
 
constexpr styled_str_view microfmt::pad_right (microfmt::string_view s, size_t width, char fill=' ') noexcept
 
constexpr styled_str_view microfmt::to_upper (microfmt::string_view s) noexcept
 
constexpr styled_str_view microfmt::to_lower (microfmt::string_view s) noexcept
 
constexpr styled_str_view microfmt::truncate (microfmt::string_view s, size_t max_chars, bool use_ellipsis=true) noexcept
 
constexpr styled_str_view microfmt::quoted (microfmt::string_view s, quote_style q=quote_style::double_quotes) noexcept
 

Detailed Description

Zero-allocation text casing, quoting, truncation, and alignment view.

Format microfmt::styled_str_view values directly, or construct them with microfmt::pad, microfmt::to_upper, microfmt::truncate, and microfmt::quoted. Format specifiers use an optional fill and alignment (*<, >, or ^), a width, and optional u, l, t, q, b, or .N transformation flags.