forked from lthn/blockchain
in the middle of refactoring autodoc
This commit is contained in:
parent
3d76415af2
commit
e5afb6b0c6
5 changed files with 32 additions and 6 deletions
|
|
@ -72,7 +72,15 @@ public: \
|
|||
epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name, auto_doc_mode, substitute, description);
|
||||
|
||||
#define KV_SERIALIZE_N_DOC2(varialble, val_name) \
|
||||
{using var_type = decltype(this_ref.varialble); epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name, auto_doc_mode,
|
||||
{using var_type = decltype(this_ref.varialble); \
|
||||
epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name); \
|
||||
if constexpr (t_storage::use_descriptions::value) \
|
||||
{ \
|
||||
epee::serialization::selector<is_store>::set_descr(this_ref.varialble, stg, hparent_section, val_name); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//substitute, description);
|
||||
|
|
|
|||
|
|
@ -315,11 +315,18 @@ namespace epee
|
|||
struct selector<true>
|
||||
{
|
||||
template<class t_type, class t_storage>
|
||||
static bool serialize(const t_type& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname, bool doc_mode = false, const t_type& doc_substitute = t_type(), const std::string& description = std::string())
|
||||
static bool serialize(const t_type& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
||||
{
|
||||
stg.set_entry_description(hparent_section, pname, description);
|
||||
return kv_serialize( (doc_mode ? doc_substitute:d), stg, hparent_section, pname);
|
||||
}
|
||||
//bool doc_mode = false, const t_type& doc_substitute = t_type(), const std::string& description = std::string()
|
||||
template<class t_type, class t_storage>
|
||||
static bool set_descr(t_storage& stg, typename t_storage::hsection hparent_section, const char* pname, const std::string& description = std::string(), const t_type& doc_substitute = t_type())
|
||||
{
|
||||
stg.set_entry_description(hparent_section, pname, description);
|
||||
return kv_serialize((doc_mode ? doc_substitute : d), stg, hparent_section, pname);
|
||||
}
|
||||
|
||||
template<class t_type, class t_storage>
|
||||
static bool serialize_stl_container_pod_val_as_blob(const t_type& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ namespace epee
|
|||
{
|
||||
public:
|
||||
//typedef epee::serialization::hsection hsection;
|
||||
using use_descriptions = std::false_type;
|
||||
typedef t_section* hsection;
|
||||
typedef epee::serialization::harray harray;
|
||||
typedef storage_entry meta_entry;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ namespace epee
|
|||
class portable_storage_extended_doc: public portable_storage
|
||||
{
|
||||
public:
|
||||
using use_descriptions = std::true_type;
|
||||
|
||||
void set_entry_description(hsection hparent_section, const std::string& name, const std::string& description)
|
||||
{
|
||||
if (!hparent_section)
|
||||
|
|
|
|||
|
|
@ -109,11 +109,15 @@ namespace epee
|
|||
|
||||
template<class t_stream>
|
||||
static void handle_obj_begin(t_stream& strm, size_t indent)
|
||||
{}
|
||||
{
|
||||
strm << "{";
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_obj_end(t_stream& strm, size_t indent)
|
||||
{}
|
||||
{
|
||||
strm << "}";
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_print_key(t_stream& strm, const std::string& key, size_t indent)
|
||||
|
|
@ -125,11 +129,15 @@ namespace epee
|
|||
|
||||
template<class t_stream>
|
||||
static void handle_section_entry_separator(t_stream& strm, size_t indent)
|
||||
{}
|
||||
{
|
||||
strm << ",";
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_array_entry_separator(t_stream& strm, size_t indent)
|
||||
{}
|
||||
{
|
||||
strm << ",";
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_line_break(t_stream& strm, size_t indent)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue