Merge branch 'refactoring'

This commit is contained in:
ToruNiina
2019-05-30 16:25:10 +09:00
3 changed files with 51 additions and 51 deletions

View File

@@ -276,7 +276,7 @@ namespace detail
{
template<typename T, std::size_t ...I>
T get_tuple_impl(const toml::Array& a, index_sequence<I...>)
T get_tuple_impl(const toml::array& a, index_sequence<I...>)
{
return std::make_tuple(
::toml::get<typename std::tuple_element<I, T>::type>(a.at(I))...);

View File

@@ -132,29 +132,29 @@ template<> struct toml_default_type<value_t::Empty > {typedef void
template<> struct toml_default_type<value_t::Unknown > {typedef void type;};
template<typename T> struct toml_value_t {static constexpr value_t value = value_t::Unknown ;};
template<> struct toml_value_t<Boolean >{static constexpr value_t value = value_t::Boolean ;};
template<> struct toml_value_t<Integer >{static constexpr value_t value = value_t::Integer ;};
template<> struct toml_value_t<Float >{static constexpr value_t value = value_t::Float ;};
template<> struct toml_value_t<String >{static constexpr value_t value = value_t::String ;};
template<> struct toml_value_t<OffsetDatetime>{static constexpr value_t value = value_t::OffsetDatetime;};
template<> struct toml_value_t<LocalDatetime >{static constexpr value_t value = value_t::LocalDatetime ;};
template<> struct toml_value_t<LocalDate >{static constexpr value_t value = value_t::LocalDate ;};
template<> struct toml_value_t<LocalTime >{static constexpr value_t value = value_t::LocalTime ;};
template<> struct toml_value_t<Array >{static constexpr value_t value = value_t::Array ;};
template<> struct toml_value_t<Table >{static constexpr value_t value = value_t::Table ;};
template<> struct toml_value_t<boolean >{static constexpr value_t value = value_t::Boolean ;};
template<> struct toml_value_t<integer >{static constexpr value_t value = value_t::Integer ;};
template<> struct toml_value_t<floating >{static constexpr value_t value = value_t::Float ;};
template<> struct toml_value_t<string >{static constexpr value_t value = value_t::String ;};
template<> struct toml_value_t<offset_datetime>{static constexpr value_t value = value_t::OffsetDatetime;};
template<> struct toml_value_t<local_datetime >{static constexpr value_t value = value_t::LocalDatetime ;};
template<> struct toml_value_t<local_date >{static constexpr value_t value = value_t::LocalDate ;};
template<> struct toml_value_t<local_time >{static constexpr value_t value = value_t::LocalTime ;};
template<> struct toml_value_t<array >{static constexpr value_t value = value_t::Array ;};
template<> struct toml_value_t<table >{static constexpr value_t value = value_t::Table ;};
template<typename T>
struct is_exact_toml_type : disjunction<
std::is_same<T, Boolean >,
std::is_same<T, Integer >,
std::is_same<T, Float >,
std::is_same<T, String >,
std::is_same<T, boolean >,
std::is_same<T, integer >,
std::is_same<T, floating >,
std::is_same<T, string >,
std::is_same<T, offset_datetime>,
std::is_same<T, local_datetime >,
std::is_same<T, local_date >,
std::is_same<T, local_time >,
std::is_same<T, Array >,
std::is_same<T, Table >
std::is_same<T, array >,
std::is_same<T, table >
>{};
template<typename T> struct is_exact_toml_type<T&> : is_exact_toml_type<T>{};
template<typename T> struct is_exact_toml_type<T const&> : is_exact_toml_type<T>{};

View File

@@ -759,72 +759,72 @@ struct switch_cast;
template<>
struct switch_cast<value_t::Boolean>
{
static Boolean& invoke(value& v) {return v.as_boolean();}
static Boolean const& invoke(value const& v) {return v.as_boolean();}
static Boolean&& invoke(value&& v) {return std::move(v).as_boolean();}
static ::toml::boolean& invoke(value& v) {return v.as_boolean();}
static ::toml::boolean const& invoke(value const& v) {return v.as_boolean();}
static ::toml::boolean&& invoke(value&& v) {return std::move(v).as_boolean();}
};
template<>
struct switch_cast<value_t::Integer>
{
static Integer& invoke(value& v) {return v.as_integer();}
static Integer const& invoke(value const& v) {return v.as_integer();}
static Integer&& invoke(value&& v) {return std::move(v).as_integer();}
static ::toml::integer& invoke(value& v) {return v.as_integer();}
static ::toml::integer const& invoke(value const& v) {return v.as_integer();}
static ::toml::integer&& invoke(value&& v) {return std::move(v).as_integer();}
};
template<>
struct switch_cast<value_t::Float>
{
static Float& invoke(value& v) {return v.as_float();}
static Float const& invoke(value const& v) {return v.as_float();}
static Float&& invoke(value&& v) {return std::move(v).as_float();}
static ::toml::floating& invoke(value& v) {return v.as_float();}
static ::toml::floating const& invoke(value const& v) {return v.as_float();}
static ::toml::floating&& invoke(value&& v) {return std::move(v).as_float();}
};
template<>
struct switch_cast<value_t::String>
{
static String& invoke(value& v) {return v.as_string();}
static String const& invoke(value const& v) {return v.as_string();}
static String&& invoke(value&& v) {return std::move(v).as_string();}
static ::toml::string& invoke(value& v) {return v.as_string();}
static ::toml::string const& invoke(value const& v) {return v.as_string();}
static ::toml::string&& invoke(value&& v) {return std::move(v).as_string();}
};
template<>
struct switch_cast<value_t::OffsetDatetime>
{
static OffsetDatetime& invoke(value& v) {return v.as_offset_datetime();}
static OffsetDatetime const& invoke(value const& v) {return v.as_offset_datetime();}
static OffsetDatetime&& invoke(value&& v) {return std::move(v).as_offset_datetime();}
static ::toml::offset_datetime& invoke(value& v) {return v.as_offset_datetime();}
static ::toml::offset_datetime const& invoke(value const& v) {return v.as_offset_datetime();}
static ::toml::offset_datetime&& invoke(value&& v) {return std::move(v).as_offset_datetime();}
};
template<>
struct switch_cast<value_t::LocalDatetime>
{
static LocalDatetime& invoke(value& v) {return v.as_local_datetime();}
static LocalDatetime const& invoke(value const& v) {return v.as_local_datetime();}
static LocalDatetime&& invoke(value&& v) {return std::move(v).as_local_datetime();}
static ::toml::local_datetime& invoke(value& v) {return v.as_local_datetime();}
static ::toml::local_datetime const& invoke(value const& v) {return v.as_local_datetime();}
static ::toml::local_datetime&& invoke(value&& v) {return std::move(v).as_local_datetime();}
};
template<>
struct switch_cast<value_t::LocalDate>
{
static LocalDate& invoke(value& v) {return v.as_local_date();}
static LocalDate const& invoke(value const& v) {return v.as_local_date();}
static LocalDate&& invoke(value&& v) {return std::move(v).as_local_date();}
static ::toml::local_date& invoke(value& v) {return v.as_local_date();}
static ::toml::local_date const& invoke(value const& v) {return v.as_local_date();}
static ::toml::local_date&& invoke(value&& v) {return std::move(v).as_local_date();}
};
template<>
struct switch_cast<value_t::LocalTime>
{
static LocalTime& invoke(value& v) {return v.as_local_time();}
static LocalTime const& invoke(value const& v) {return v.as_local_time();}
static LocalTime&& invoke(value&& v) {return std::move(v).as_local_time();}
static ::toml::local_time& invoke(value& v) {return v.as_local_time();}
static ::toml::local_time const& invoke(value const& v) {return v.as_local_time();}
static ::toml::local_time&& invoke(value&& v) {return std::move(v).as_local_time();}
};
template<>
struct switch_cast<value_t::Array>
{
static Array& invoke(value& v) {return v.as_array();}
static Array const& invoke(value const& v) {return v.as_array();}
static Array&& invoke(value&& v) {return std::move(v).as_array();}
static ::toml::array& invoke(value& v) {return v.as_array();}
static ::toml::array const& invoke(value const& v) {return v.as_array();}
static ::toml::array&& invoke(value&& v) {return std::move(v).as_array();}
};
template<>
struct switch_cast<value_t::Table>
{
static Table& invoke(value& v) {return v.as_table();}
static Table const& invoke(value const& v) {return v.as_table();}
static Table&& invoke(value&& v) {return std::move(v).as_table();}
static ::toml::table& invoke(value& v) {return v.as_table();}
static ::toml::table const& invoke(value const& v) {return v.as_table();}
static ::toml::table&& invoke(value&& v) {return std::move(v).as_table();}
};
}// detail