mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-27 03:21:34 +00:00
StrFormatter -> StrFormatSpec.
This commit is contained in:
parent
ba6c5fe522
commit
09f98854bf
15
format.h
15
format.h
@ -402,13 +402,14 @@ class IntFormatSpec : public SpecT {
|
|||||||
T value() const { return value_; }
|
T value() const { return value_; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// A string format specifier.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class StrFormatter : public AlignSpec {
|
class StrFormatSpec : public AlignSpec {
|
||||||
private:
|
private:
|
||||||
const T *str_;
|
const T *str_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StrFormatter(const T *str, const AlignSpec &spec = AlignSpec())
|
StrFormatSpec(const T *str, const AlignSpec &spec = AlignSpec())
|
||||||
: AlignSpec(spec), str_(str) {}
|
: AlignSpec(spec), str_(str) {}
|
||||||
|
|
||||||
const T *str() const { return str_; }
|
const T *str() const { return str_; }
|
||||||
@ -503,9 +504,9 @@ DEFINE_INT_FORMATTERS(unsigned long long)
|
|||||||
|
|
||||||
\endrst
|
\endrst
|
||||||
*/
|
*/
|
||||||
inline StrFormatter<char> pad(
|
inline StrFormatSpec<char> pad(
|
||||||
const char *str, unsigned width, wchar_t fill = ' ') {
|
const char *str, unsigned width, wchar_t fill = ' ') {
|
||||||
return StrFormatter<char>(str, AlignSpec(width, fill));
|
return StrFormatSpec<char>(str, AlignSpec(width, fill));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Char>
|
template <typename Char>
|
||||||
@ -712,9 +713,9 @@ class BasicWriter {
|
|||||||
BasicWriter &operator<<(const IntFormatSpec<T, Spec> &spec);
|
BasicWriter &operator<<(const IntFormatSpec<T, Spec> &spec);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
BasicWriter &operator<<(const StrFormatter<T> &f) {
|
BasicWriter &operator<<(const StrFormatSpec<T> &spec) {
|
||||||
const char *s = f.str();
|
const char *s = spec.str();
|
||||||
FormatString(s, std::strlen(s), f);
|
FormatString(s, std::strlen(s), spec);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user