cpp-toolbox  0.0.1
A toolbox library for C++
Loading...
Searching...
No Matches
ini_struct.hpp File Reference
#include <optional>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <cpp-toolbox/logger/thread_logger.hpp>
#include <cpp-toolbox/utils/ini_config.hpp>
Include dependency graph for ini_struct.hpp:

Go to the source code of this file.

Classes

struct  toolbox::utils::ini_detail::is_optional< T >
 
struct  toolbox::utils::ini_detail::is_optional< std::optional< U > >
 
struct  toolbox::utils::ini_detail::optional_value_type< T >
 
struct  toolbox::utils::ini_detail::optional_value_type< std::optional< U > >
 
struct  toolbox::utils::ini_detail::has_istream_operator< T, typename >
 
struct  toolbox::utils::ini_detail::has_istream_operator< T, std::void_t< decltype(std::declval< std::istream & >() > > std::declval< T & >())> >
 
struct  toolbox::utils::ini_field_desc< Struct, Member >
 
struct  toolbox::utils::ini_struct_traits< T >
 

Namespaces

namespace  toolbox
 
namespace  toolbox::utils
 < 用于 std::out_of_range/For std::out_of_range
 
namespace  toolbox::utils::ini_detail
 

Macros

#define TOOLBOX_INI_FIELD(struct_type, member, section, key)
 
#define TOOLBOX_INI_STRUCT(struct_type, ...)
 

Typedefs

template<typename T >
using toolbox::utils::ini_detail::optional_value_type_t = typename optional_value_type< std::remove_cv_t< std::remove_reference_t< T > > >::type
 

Functions

template<typename T >
bool toolbox::utils::ini_detail::parse_non_optional (const std::string &input, T &output)
 
template<typename T_Optional >
bool toolbox::utils::ini_detail::parse_non_optional (const std::string &input, std::optional< T_Optional > &output)
 
template<typename T >
bool toolbox::utils::ini_detail::parse_value (const std::string &input, T &output)
 
template<typename Struct >
bool toolbox::utils::load_struct_from_ini (const ini_config_t &cfg, Struct &obj, const std::string &base_section="")
 

Variables

template<typename T >
constexpr bool toolbox::utils::ini_detail::is_optional_v
 
template<typename T >
constexpr bool toolbox::utils::ini_detail::has_istream_operator_v
 

Macro Definition Documentation

◆ TOOLBOX_INI_FIELD

#define TOOLBOX_INI_FIELD (   struct_type,
  member,
  section,
  key 
)
Value:
toolbox::utils::ini_field_desc<struct_type, decltype(struct_type::member)>{ \
section, key, &struct_type::member }
Definition ini_struct.hpp:150

◆ TOOLBOX_INI_STRUCT

#define TOOLBOX_INI_STRUCT (   struct_type,
  ... 
)
Value:
template<> struct toolbox::utils::ini_struct_traits<struct_type> { \
static constexpr auto fields = std::make_tuple(__VA_ARGS__); \
};
Definition ini_struct.hpp:159
static constexpr auto fields
Definition ini_struct.hpp:160