mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-08 11:33:46 +00:00
Extend ArgLists to support serialization/deserialization in third-party components
This commit is contained in:
parent
1fb0586b06
commit
d09dd1a81a
14
fmt/format.h
14
fmt/format.h
@ -1377,10 +1377,7 @@ class ArgList {
|
||||
};
|
||||
|
||||
internal::Arg::Type type(unsigned index) const {
|
||||
unsigned shift = index * 4;
|
||||
uint64_t mask = 0xf;
|
||||
return static_cast<internal::Arg::Type>(
|
||||
(types_ & (mask << shift)) >> shift);
|
||||
return type(types_, index);
|
||||
}
|
||||
|
||||
template <typename Char>
|
||||
@ -1397,6 +1394,8 @@ class ArgList {
|
||||
ArgList(ULongLong types, const internal::Arg *args)
|
||||
: types_(types), args_(args) {}
|
||||
|
||||
uint64_t types() const { return types_; }
|
||||
|
||||
/** Returns the argument at specified index. */
|
||||
internal::Arg operator[](unsigned index) const {
|
||||
using internal::Arg;
|
||||
@ -1422,6 +1421,13 @@ class ArgList {
|
||||
}
|
||||
return args_[index];
|
||||
}
|
||||
|
||||
static internal::Arg::Type type(uint64_t types, unsigned index) {
|
||||
unsigned shift = index * 4;
|
||||
uint64_t mask = 0xf;
|
||||
return static_cast<internal::Arg::Type>(
|
||||
(types & (mask << shift)) >> shift);
|
||||
}
|
||||
};
|
||||
|
||||
#define FMT_DISPATCH(call) static_cast<Impl*>(this)->call
|
||||
|
Loading…
Reference in New Issue
Block a user