///
/// @file eo_private.hh
///
#ifndef EFL_CXX_EO_PRIVATE_HH
#define EFL_CXX_EO_PRIVATE_HH
#include "eo_ops.hh"
namespace eo {
struct Base;
}
namespace efl { namespace eo { namespace detail {
/// @addtogroup Efl_Cxx_Detail
/// @{
/// @internal
///
/// @brief Provides a getter for an heterogeous sequence of arguments.
///
/// @param T An EO C++ Class
/// @param Seq An heterogenous sequence of arguments.
///
template
struct args_class
{
typedef T class_type;
/// @internal
///
/// @brief Class constructor.
///
/// @param tuple An heterogenous sequence of arguments.
///
args_class(Tuple tuple) : _tuple(tuple) {}
/// @internal
///
/// @brief Get the Nth element of the sequence.
///
/// @param N The index of the argument to be retrieved.
///
template
typename std::remove_reference
<
typename std::tuple_element::type
>::type get() const
{
return std::get(_tuple);
}
///
/// TODO document.
///
constexpr std::size_t size() const
{
return std::tuple_size::value;
}
Tuple _tuple; ///< The sequence of arguments.
};
/// @internal
///
/// @brief A simple generic tag to help keeping track of a type.
///
/// @details
/// Used to mimic what would be a "template specialization" of a
/// function through the overload of an argument of type @ref
/// efl::eo::detail::tag --- because @c C++0x does not implement
/// template specialization of functions.
///
template struct tag {};
/// @internal
///
/// @brief Invokes the different implementations of @ref
/// efl::eo::detail::eo_class_new for the parent and all extensions.
///
/// @see efl::eo::detail::eo_class_new
///
template
Eo_Class const* do_eo_class_new(Eo_Class_Description& class_desc)
{
return eo_class_new(&class_desc, get_eo_class(tag())..., (void*)NULL);
}
template struct operation_description_class_size;
template <> struct operation_description_class_size< ::eo::Base> : std::integral_constant {};
/// @internal
///
/// @brief Provides the operator to convert @p T to @p D.
///
/// @param D The target (derived) class
/// @param T An EO C++ Class
///
template
struct conversion_operator
{
operator T() const
{
detail::ref(static_cast(this)->_eo_ptr());
return T(static_cast(this)->_eo_ptr());
}
};
/// @}
} // namespace detail {
template
detail::args_class >
args(A... arg)
{
return detail::args_class >(std::tuple(arg...));
}
namespace detail {
/// @addtogroup Efl_Cxx_Detail
/// @{
/// @internal
///
/// @brief Provides all operations of type @p T.
///
/// @param T An EO C++ Class
///
/// There must be an unique specialization of this class for each
/// declared EO C++ Class.
///
template struct operations;
template <>
struct operations< ::eo::Base> { template struct type {}; };
/// @internal
///
/// @brief Provides the operations of an extension as well as its
/// conversion operator.
///
/// @param T The EO C++ Extension
///
/// There must be an unique specialization of @ref
/// efl::eo::detail::extension_inheritance for each known EO C++
/// Extension -- i.e., @em Interfaces and @em Mixins.
///
template
struct extension_inheritance {};
/// @internal
///
/// @brief efl::eo::inherit's private data.
///
struct Inherit_Private_Data
{
void* this_;
};
} } } // namespace efl { namespace eo { namespace detail {
namespace efl { namespace eo { namespace detail {
template
int initialize_operation_description(efl::eo::detail::tag< ::eo::Base>
, Eo_Op_Description* ops)
{
(void)ops;
return 0;
}
/// @}
} } } // namespace efl { namespace eo { namespace detail {
#endif