diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-01-31 14:18:42 +0100 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-08-28 17:48:15 +0200 |
commit | fac42e9d35f6ba046999b2e3a757ab720c51b6bb (patch) | |
tree | 9afb3e212793d40df3b16f0dbf1a34220a587396 /src/serialize.h | |
parent | aaaa3fa9477eef9ea72e4a501d130c57b47b470a (diff) |
Rename CSerAction* to Action*
This allows new code, added in the next commit, to conform to the coding
guideline: No C-prefix for class names.
Diffstat (limited to 'src/serialize.h')
-rw-r--r-- | src/serialize.h | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/src/serialize.h b/src/serialize.h index 08c10fbce4..d61883512a 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -188,11 +188,11 @@ const Out& AsBase(const In& x) */ #define FORMATTER_METHODS(cls, obj) \ template<typename Stream> \ - static void Ser(Stream& s, const cls& obj) { SerializationOps(obj, s, CSerActionSerialize()); } \ + static void Ser(Stream& s, const cls& obj) { SerializationOps(obj, s, ActionSerialize{}); } \ template<typename Stream> \ - static void Unser(Stream& s, cls& obj) { SerializationOps(obj, s, CSerActionUnserialize()); } \ + static void Unser(Stream& s, cls& obj) { SerializationOps(obj, s, ActionUnserialize{}); } \ template<typename Stream, typename Type, typename Operation> \ - static inline void SerializationOps(Type& obj, Stream& s, Operation ser_action) \ + static void SerializationOps(Type& obj, Stream& s, Operation ser_action) /** * Implement the Serialize and Unserialize methods by delegating to a single templated @@ -953,26 +953,17 @@ void Unserialize(Stream& is, std::shared_ptr<const T>& p) } - /** - * Support for SERIALIZE_METHODS and READWRITE macro. + * Support for all macros providing or using the ser_action parameter of the SerializationOps method. */ -struct CSerActionSerialize -{ +struct ActionSerialize { constexpr bool ForRead() const { return false; } }; -struct CSerActionUnserialize -{ +struct ActionUnserialize { constexpr bool ForRead() const { return true; } }; - - - - - - /* ::GetSerializeSize implementations * * Computing the serialized size of objects is done through a special stream @@ -1031,36 +1022,36 @@ inline void UnserializeMany(Stream& s, Args&&... args) } template<typename Stream, typename... Args> -inline void SerReadWriteMany(Stream& s, CSerActionSerialize ser_action, const Args&... args) +inline void SerReadWriteMany(Stream& s, ActionSerialize ser_action, const Args&... args) { ::SerializeMany(s, args...); } template<typename Stream, typename... Args> -inline void SerReadWriteMany(Stream& s, CSerActionUnserialize ser_action, Args&&... args) +inline void SerReadWriteMany(Stream& s, ActionUnserialize ser_action, Args&&... args) { ::UnserializeMany(s, args...); } template<typename Stream, typename Type, typename Fn> -inline void SerRead(Stream& s, CSerActionSerialize ser_action, Type&&, Fn&&) +inline void SerRead(Stream& s, ActionSerialize ser_action, Type&&, Fn&&) { } template<typename Stream, typename Type, typename Fn> -inline void SerRead(Stream& s, CSerActionUnserialize ser_action, Type&& obj, Fn&& fn) +inline void SerRead(Stream& s, ActionUnserialize ser_action, Type&& obj, Fn&& fn) { fn(s, std::forward<Type>(obj)); } template<typename Stream, typename Type, typename Fn> -inline void SerWrite(Stream& s, CSerActionSerialize ser_action, Type&& obj, Fn&& fn) +inline void SerWrite(Stream& s, ActionSerialize ser_action, Type&& obj, Fn&& fn) { fn(s, std::forward<Type>(obj)); } template<typename Stream, typename Type, typename Fn> -inline void SerWrite(Stream& s, CSerActionUnserialize ser_action, Type&&, Fn&&) +inline void SerWrite(Stream& s, ActionUnserialize ser_action, Type&&, Fn&&) { } |