[#FORMATTER_METHODS]
= FORMATTER&lowbar;METHODS
:mrdocs:

Implement the Ser and Unser methods needed for implementing a formatter (see Using below)&period;

== Synopsis

Declared in `&lt;serialize&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
#define FORMATTER&lowbar;METHODS(cls, obj)

----

== Description

Both Ser and Unser are delegated to a single static method SerializationOps, which is polymorphic in the serialized&sol;deserialized type (allowing it to be const when serializing, and non&hyphen;const when deserializing)&period;

Example use&colon; struct FooFormatter &lcub; FORMATTER&lowbar;METHODS(Class, obj) &lcub; READWRITE(obj&period;val1, VARINT(obj&period;val2))&semi; &rcub; &rcub; would define a class FooFormatter that defines a serialization of Class objects consisting of serializing its val1 member using the default serialization, and its val2 member using VARINT serialization&period; That FooFormatter can then be used in statements like READWRITE(Using&lt;FooFormatter&gt;(obj&period;bla))&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *cls*
| The class whose objects the formatter serializes&period;
| *obj*
| The name bound to the object inside the generated method body&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
