Use macros to instantiate most SField instances:

There have been cases in the past where SFields have been defined
in such a way that they did not follow our conventions.  In
particular, the string representation of an SField should match
the in-code name of the SField.

This change leverages the preprocessor to encourage SFields to
be properly constructed.

The suffixes of SField types are changed to be the same as
the suffixes of corresponding SerializedTypeIDs.  This allows
The preprocessor to match types using simple name pasting.

Since the string representation of the SField is part of our
stable API, the name of sfPayChannel was changed to sfChannel.
This change allows sfChannel to follow our conventions while
making no changes to our external API.
This commit is contained in:
Scott Schurr
2020-11-06 09:30:35 -08:00
committed by Nik Bougalis
parent f239050054
commit 17abca1caa
11 changed files with 356 additions and 360 deletions

View File

@@ -56,7 +56,7 @@ void
populateProtoVLasString(
T const& getProto,
STObject const& from,
SF_Blob const& field)
SF_VL const& field)
{
if (from.isFieldPresent(field))
{
@@ -71,7 +71,7 @@ void
populateProtoVec256(
T const& getProto,
STObject const& from,
SF_Vec256 const& field)
SF_VECTOR256 const& field)
{
if (from.isFieldPresent(field))
{
@@ -89,7 +89,7 @@ void
populateProtoAccount(
T const& getProto,
STObject const& from,
SF_Account const& field)
SF_ACCOUNT const& field)
{
if (from.isFieldPresent(field))
{
@@ -103,7 +103,7 @@ void
populateProtoAmount(
T const& getProto,
STObject const& from,
SF_Amount const& field)
SF_AMOUNT const& field)
{
if (from.isFieldPresent(field))
{
@@ -117,7 +117,7 @@ void
populateProtoCurrency(
T const& getProto,
STObject const& from,
SF_U160 const& field)
SF_HASH160 const& field)
{
if (from.isFieldPresent(field))
{
@@ -364,7 +364,7 @@ void
populateChannel(T& to, STObject const& from)
{
populateProtoPrimitive(
[&to]() { return to.mutable_channel(); }, from, sfPayChannel);
[&to]() { return to.mutable_channel(); }, from, sfChannel);
}
template <class T>