#include <abi_serializer.hpp>
Definition at line 227 of file abi_serializer.hpp.
◆ abi_traverse_context_with_path() [1/2]
Definition at line 228 of file abi_serializer.hpp.
230 {
232 }
const abi_serializer & abis
void set_path_root(const std::string_view &type)
abi_traverse_context(abi_serializer::yield_function_t yield)
abi_serializer::yield_function_t yield
◆ abi_traverse_context_with_path() [2/2]
sysio::chain::impl::abi_traverse_context_with_path::abi_traverse_context_with_path |
( |
const abi_serializer & | abis, |
|
|
const abi_traverse_context & | ctx, |
|
|
const std::string_view & | type ) |
|
inline |
◆ get_path_string()
string sysio::chain::impl::abi_traverse_context_with_path::get_path_string |
( |
| ) |
const |
Definition at line 844 of file abi_serializer.cpp.
844 {
847
848 generate_path_string_visitor visitor(shorten_names, !full_path);
849 if( full_path )
851 for(
size_t i = 0, n =
path.size(); i < n; ++i ) {
852 if( full_path && !std::holds_alternative<array_index_path_item>(
path[i]) )
853 visitor.add_dot();
854
855 std::visit( visitor,
path[i] );
856
857 }
858
859 if( !full_path ) {
860 if( std::holds_alternative<empty_path_item>(visitor.last_path_item) ) {
862 } else {
863 path_item_type_visitor vis2(visitor.s, shorten_names);
864 std::visit(vis2, visitor.last_path_item);
865 }
866 }
867
868 return visitor.s.str();
869 }
◆ hint_array_type_if_in_array()
void sysio::chain::impl::abi_traverse_context_with_path::hint_array_type_if_in_array |
( |
| ) |
|
Definition at line 682 of file abi_serializer.cpp.
682 {
683 if(
path.size() == 0 || !std::holds_alternative<array_index_path_item>(
path.back()) )
684 return;
685
686 std::get<array_index_path_item>(
path.back()).type_hint = array_type_path_root{};
687 }
◆ hint_struct_type_if_in_array()
void sysio::chain::impl::abi_traverse_context_with_path::hint_struct_type_if_in_array |
( |
const map< type_name, struct_def >::const_iterator & | itr | ) |
|
Definition at line 689 of file abi_serializer.cpp.
689 {
690 if(
path.size() == 0 || !std::holds_alternative<array_index_path_item>(
path.back()) )
691 return;
692
693 std::get<array_index_path_item>(
path.back()).type_hint = struct_type_path_root{ .struct_itr = itr };
694 }
◆ hint_variant_type_if_in_array()
void sysio::chain::impl::abi_traverse_context_with_path::hint_variant_type_if_in_array |
( |
const map< type_name, variant_def >::const_iterator & | itr | ) |
|
Definition at line 696 of file abi_serializer.cpp.
696 {
697 if(
path.size() == 0 || !std::holds_alternative<array_index_path_item>(
path.back()) )
698 return;
699
700 std::get<array_index_path_item>(
path.back()).type_hint = variant_type_path_root{ .variant_itr = itr };
701 }
◆ maybe_shorten()
string sysio::chain::impl::abi_traverse_context_with_path::maybe_shorten |
( |
const std::string_view & | str | ) |
|
Definition at line 871 of file abi_serializer.cpp.
871 {
873 return std::string(str);
874
878 }
void output_name(std::ostream &s, const string_view &str, bool shorten, size_t max_length=64)
◆ push_to_path()
fc::scoped_exit< std::function< void()> > sysio::chain::impl::abi_traverse_context_with_path::push_to_path |
( |
const path_item & | item | ) |
|
Definition at line 660 of file abi_serializer.cpp.
660 {
661 std::function<void()> callback = [this](){
663 "invariant failure in variant_to_binary_context: path is empty on scope exit" );
665 };
666
667 path.push_back( item );
668
669 return {std::move(callback)};
670 }
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
◆ set_array_index_of_path_back()
void sysio::chain::impl::abi_traverse_context_with_path::set_array_index_of_path_back |
( |
uint32_t | i | ) |
|
Definition at line 672 of file abi_serializer.cpp.
672 {
674
675 auto& b =
path.back();
676
677 SYS_ASSERT( std::holds_alternative<array_index_path_item>(b), abi_exception,
"trying to set array index without first pushing new array index item" );
678
679 std::get<array_index_path_item>(b).array_index = i;
680 }
◆ set_path_root()
void sysio::chain::impl::abi_traverse_context_with_path::set_path_root |
( |
const std::string_view & | type | ) |
|
Definition at line 642 of file abi_serializer.cpp.
642 {
644
647 } else {
648 auto itr1 =
abis.structs.find(rtype);
649 if( itr1 !=
abis.structs.end() ) {
650 root_of_path = struct_type_path_root{ .struct_itr = itr1 };
651 } else {
652 auto itr2 =
abis.variants.find(rtype);
653 if( itr2 !=
abis.variants.end() ) {
654 root_of_path = variant_type_path_root{ .variant_itr = itr2 };
655 }
656 }
657 }
658 }
std::string_view resolve_type(const std::string_view &t) const
bool is_array(const std::string_view &type) const
◆ abis
const abi_serializer& sysio::chain::impl::abi_traverse_context_with_path::abis |
|
protected |
◆ path
◆ root_of_path
path_root sysio::chain::impl::abi_traverse_context_with_path::root_of_path |
|
protected |
◆ short_path
bool sysio::chain::impl::abi_traverse_context_with_path::short_path = false |
The documentation for this struct was generated from the following files: