forked from OctaForge/libostd
move format impl into namespace detail
This commit is contained in:
parent
47a98592f0
commit
c17de276e3
|
@ -544,11 +544,11 @@ namespace detail {
|
|||
if (idx) return get_arg_param(idx - 1, param, args...);
|
||||
return convert_arg_param(val, param);
|
||||
}
|
||||
} /* namespace detail */
|
||||
|
||||
template<typename R, typename ...A>
|
||||
static inline octa::Ptrdiff format(R writer, octa::Size &fmtn,
|
||||
const char *fmt, const A &...args) {
|
||||
static inline octa::Ptrdiff format_impl(R &writer, octa::Size &fmtn,
|
||||
const char *fmt,
|
||||
const A &...args) {
|
||||
octa::Size argidx = 1, retn = 0, twr = 0;
|
||||
octa::Ptrdiff written = 0;
|
||||
octa::detail::WriteSpec spec(fmt);
|
||||
|
@ -559,13 +559,13 @@ static inline octa::Ptrdiff format(R writer, octa::Size &fmtn,
|
|||
argpos = argidx++;
|
||||
if (spec.arg_width) {
|
||||
spec.arg_width = false;
|
||||
if (!octa::detail::get_arg_param(argpos - 1, spec.width, args...))
|
||||
if (!get_arg_param(argpos - 1, spec.width, args...))
|
||||
return -1;
|
||||
argpos = argidx++;
|
||||
}
|
||||
if (spec.arg_precision) {
|
||||
spec.arg_precision = false;
|
||||
if (!octa::detail::get_arg_param(argpos - 1, spec.precision, args...))
|
||||
if (!get_arg_param(argpos - 1, spec.precision, args...))
|
||||
return -1;
|
||||
argpos = argidx++;
|
||||
}
|
||||
|
@ -577,7 +577,7 @@ static inline octa::Ptrdiff format(R writer, octa::Size &fmtn,
|
|||
return -1;
|
||||
}
|
||||
spec.arg_precision = false;
|
||||
if (!octa::detail::get_arg_param(argpos - 2, spec.precision, args...))
|
||||
if (!get_arg_param(argpos - 2, spec.precision, args...))
|
||||
return -1;
|
||||
}
|
||||
if (spec.arg_width) {
|
||||
|
@ -586,7 +586,7 @@ static inline octa::Ptrdiff format(R writer, octa::Size &fmtn,
|
|||
return -1;
|
||||
}
|
||||
spec.arg_width = false;
|
||||
if (!octa::detail::get_arg_param(argpos - 2 - argprec, spec.width, args...))
|
||||
if (!get_arg_param(argpos - 2 - argprec, spec.width, args...))
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -600,7 +600,7 @@ static inline octa::Ptrdiff format(R writer, octa::Size &fmtn,
|
|||
}
|
||||
|
||||
template<typename R, typename ...A>
|
||||
static inline octa::Ptrdiff format(R writer, octa::Size &fmtn,
|
||||
static inline octa::Ptrdiff format(R &writer, octa::Size &fmtn,
|
||||
const char *fmt) {
|
||||
octa::Size written = 0;
|
||||
octa::detail::WriteSpec spec(fmt);
|
||||
|
@ -608,6 +608,13 @@ static inline octa::Ptrdiff format(R writer, octa::Size &fmtn,
|
|||
fmtn = 0;
|
||||
return written;
|
||||
}
|
||||
} /* namespace detail */
|
||||
|
||||
template<typename R, typename ...A>
|
||||
static inline octa::Ptrdiff format(R writer, octa::Size &fmtn,
|
||||
const char *fmt, const A &...args) {
|
||||
return octa::detail::format_impl(writer, fmtn, fmt, args...);
|
||||
}
|
||||
|
||||
template<typename R, typename AL, typename ...A>
|
||||
octa::Ptrdiff format(R writer, octa::Size &fmtn,
|
||||
|
|
Loading…
Reference in a new issue