3#ifndef TETL_FORMAT_ARGUMENT_HPP
4#define TETL_FORMAT_ARGUMENT_HPP
11namespace etl::detail {
13inline constexpr auto token_begin =
'{';
14inline constexpr auto token_end =
'}';
16template <
typename ValueT,
typename FormatContext>
17auto format_argument(ValueT
const& val, FormatContext& fc) ->
decltype(fc.out())
19 auto f = formatter<ValueT, char>{};
20 return f.format(val, fc);
30 auto first = str.substr(0, index);
31 auto second = str.substr(index + 2);
38template <
typename FormatContext>
39auto format_escaped_sequences(
etl::string_view str, FormatContext& ctx) ->
void
42 auto const* first =
begin(str);
45 auto const*
const openFirst =
etl::find(first,
end(str), token_begin);
46 auto const*
const openSec =
etl::next(openFirst);
47 auto const escapeStart = openFirst !=
end(str)
48 && openSec !=
end(str)
49 && *openSec == token_begin;
57 auto const* closeSec =
etl::next(closeFirst);
58 auto escapeClose = closeFirst !=
end(str)
59 && closeSec !=
end(str)
60 && *closeSec == token_end;
65 first = closeFirst + 2;
#define TETL_PRECONDITION(...)
Definition check.hpp:16
constexpr auto find(InputIt first, InputIt last, T const &value) noexcept -> InputIt
Searches for an element equal to value.
Definition find.hpp:18
constexpr auto end(C &c) -> decltype(c.end())
Returns an iterator to the end (i.e. the element after the last element) of the given container c or ...
Definition end.hpp:14
constexpr auto next(InputIt it, typename iterator_traits< InputIt >::difference_type n=1) -> InputIt
Return the nth successor of iterator it.
Definition next.hpp:14
constexpr auto distance(It first, It last) -> typename iterator_traits< It >::difference_type
Returns the number of hops from first to last.
Definition distance.hpp:16
constexpr auto begin(C &c) -> decltype(c.begin())
Returns an iterator to the beginning of the given container c or array array. These templates rely on...
Definition begin.hpp:20
basic_string_view< char, etl::char_traits< char > > string_view
Typedef for common character type char
Definition basic_string_view.hpp:704
pair(T1, T2) -> pair< T1, T2 >
constexpr auto make_pair(T1 &&t, T2 &&u) -> pair< decay_t< T1 >, decay_t< T2 > >
Creates a etl::pair object, deducing the target type from the types of arguments.
Definition pair.hpp:164
etl::size_t size_type
Definition basic_string_view.hpp:43