Commit 17c17d15 authored by Victor Zverovich's avatar Victor Zverovich Committed by GitHub

Merge pull request #389 from chronoxor/master

Extend ArgLists to support serialization/deserialization in third-party components
parents 64a00166 d09dd1a8
...@@ -1388,10 +1388,7 @@ class ArgList { ...@@ -1388,10 +1388,7 @@ class ArgList {
}; };
internal::Arg::Type type(unsigned index) const { internal::Arg::Type type(unsigned index) const {
unsigned shift = index * 4; return type(types_, index);
uint64_t mask = 0xf;
return static_cast<internal::Arg::Type>(
(types_ & (mask << shift)) >> shift);
} }
template <typename Char> template <typename Char>
...@@ -1408,6 +1405,8 @@ class ArgList { ...@@ -1408,6 +1405,8 @@ class ArgList {
ArgList(ULongLong types, const internal::Arg *args) ArgList(ULongLong types, const internal::Arg *args)
: types_(types), args_(args) {} : types_(types), args_(args) {}
uint64_t types() const { return types_; }
/** Returns the argument at specified index. */ /** Returns the argument at specified index. */
internal::Arg operator[](unsigned index) const { internal::Arg operator[](unsigned index) const {
using internal::Arg; using internal::Arg;
...@@ -1433,6 +1432,13 @@ class ArgList { ...@@ -1433,6 +1432,13 @@ class ArgList {
} }
return args_[index]; 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 #define FMT_DISPATCH(call) static_cast<Impl*>(this)->call
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment