hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
iroha::model::converters::FieldDeserializer< D > Struct Template Reference

#include "json_common.hpp"

Collaboration diagram for iroha::model::converters::FieldDeserializer< D >:
Collaboration graph

Public Member Functions

 FieldDeserializer (const D &document)
 
template<typename T , typename V , typename B , typename Convert = Convert<V>>
auto deserialize (V B::*member, const std::string &field, Convert transform=Convert())
 
template<typename V , typename B >
auto Uint (V B::*member, const std::string &field)
 
template<typename V , typename B >
auto Uint64 (V B::*member, const std::string &field)
 
template<typename V , typename B >
auto Bool (V B::*member, const std::string &field)
 
template<typename V , typename B >
auto String (V B::*member, const std::string &field)
 
auto String (const std::string &field)
 
template<typename V , typename B , typename Convert = Convert<V>>
auto Array (V B::*member, const std::string &field, Convert transform=Convert())
 
template<typename V , typename B , typename Convert = Convert<V>>
auto Object (V B::*member, const std::string &field, Convert transform=Convert())
 

Public Attributes

const D & document
 

Detailed Description

template<typename D>
struct iroha::model::converters::FieldDeserializer< D >

Functor for deserialization from given document

Template Parameters
D- document type

Constructor & Destructor Documentation

template<typename D >
iroha::model::converters::FieldDeserializer< D >::FieldDeserializer ( const D &  document)
inlineexplicit
Parameters
document- document for field deserialization

Member Function Documentation

template<typename D >
template<typename V , typename B , typename Convert = Convert<V>>
auto iroha::model::converters::FieldDeserializer< D >::Array ( V B::*  member,
const std::string &  field,
Convert  transform = Convert() 
)
inline

Deserialize field of Array type to given member field of block, using provided transform function

Template Parameters
V- block member type
B- block type
Convert- transform function type
Parameters
member- pointer to member in block
field- field name for deserialization
transform- transform function from Array to V
Returns
See also
deserialize
template<typename D >
template<typename V , typename B >
auto iroha::model::converters::FieldDeserializer< D >::Bool ( V B::*  member,
const std::string &  field 
)
inline

Deserialize field of Bool type to given member field of block

Template Parameters
V- block member type
B- block type
Parameters
member- pointer to member in block
field- field name for deserialization
Returns
See also
deserialize
template<typename D >
template<typename T , typename V , typename B , typename Convert = Convert<V>>
auto iroha::model::converters::FieldDeserializer< D >::deserialize ( V B::*  member,
const std::string &  field,
Convert  transform = Convert() 
)
inline

Create function, which deserializes document field, transforms the value to required type, and assigns it to block member

Template Parameters
T- getter return type
V- block member type
B- block type
Convert- transform function type
Parameters
member- pointer to member in block
field- field name for deserialization
transform- transform function from T to V
Returns
function, which takes block, returns block with deserialized member on success, nullopt otherwise

Here is the call graph for this function:

template<typename D >
template<typename V , typename B , typename Convert = Convert<V>>
auto iroha::model::converters::FieldDeserializer< D >::Object ( V B::*  member,
const std::string &  field,
Convert  transform = Convert() 
)
inline

Deserialize field of Object type to given member field of block

Template Parameters
V- block member type
B- block type
Parameters
member- pointer to member in block
field- field name for deserialization
Returns
See also
deserialize
template<typename D >
template<typename V , typename B >
auto iroha::model::converters::FieldDeserializer< D >::String ( V B::*  member,
const std::string &  field 
)
inline

Deserialize field of String type to given member field of block

Template Parameters
V- block member type
B- block type
Parameters
member- pointer to member in block
field- field name for deserialization
Returns
See also
deserialize
template<typename D >
auto iroha::model::converters::FieldDeserializer< D >::String ( const std::string &  field)
inline

Deserialize field of String type

Parameters
field- field name for deserialization
Returns
deserialized field on success, nullopt otherwise
template<typename D >
template<typename V , typename B >
auto iroha::model::converters::FieldDeserializer< D >::Uint ( V B::*  member,
const std::string &  field 
)
inline

Deserialize field of Uint type to given member field of block

Template Parameters
V- block member type
B- block type
Parameters
member- pointer to member in block
field- field name for deserialization
Returns
See also
deserialize
template<typename D >
template<typename V , typename B >
auto iroha::model::converters::FieldDeserializer< D >::Uint64 ( V B::*  member,
const std::string &  field 
)
inline

Deserialize field of Uint64 type to given member field of block

Template Parameters
V- block member type
B- block type
Parameters
member- pointer to member in block
field- field name for deserialization
Returns
See also
deserialize

Member Data Documentation

template<typename D >
const D& iroha::model::converters::FieldDeserializer< D >::document

The documentation for this struct was generated from the following file: