libqi-api
2.8.7.4
|
#include <map>
#include <boost/type_traits.hpp>
#include <boost/utility/enable_if.hpp>
#include <qi/api.hpp>
#include <qi/type/fwd.hpp>
#include <qi/type/detail/accessor.hxx>
#include <qi/type/typeinterface.hpp>
#include <qi/preproc.hpp>
Go to the source code of this file.
Namespaces | |
qi | |
Deprecated in 2.5. Use int8_t from <cstdint>. | |
qi::detail | |
Macros | |
#define | _QITYPE_DETAIL_TYPETUPLE_HXX_ |
#define | QI_TYPE_STRUCT_EXTENSION_ADDED_FIELDS(name,...) |
#define | QI_TYPE_STRUCT_EXTENSION_DROPPED_FIELDS(name,...) |
#define | QI_TYPE_STRUCT_EXTENSION_CONVERT_HANDLERS(name, fromHandler, toHandler) |
#define | __QI_TYPE_STRUCT_DECLARE(name, extra) |
#define | __QI_TUPLE_TYPE(_, what, field) res.push_back(::qi::typeOf(ptr->field)); |
#define | __QI_TUPLE_GET(_, what, field) if (i == index) return ::qi::typeOf(ptr->field)->initializeStorage(&ptr->field); i++; |
#define | __QI_TUPLE_SET(_, what, field) if (i == index) ::qi::detail::setFromStorage(ptr->field, valueStorage); i++; |
#define | __QI_TUPLE_FIELD_NAME(_, what, field) res.push_back(BOOST_PP_STRINGIZE(QI_DELAY(field))); |
#define | __QI_TYPE_STRUCT_IMPLEMENT(name, inl, onSet,...) |
#define | QI_STRUCT_HELPER(name, func) (name, func, FUNC) |
Declare a struct field using an helper function. More... | |
#define | QI_STRUCT_FIELD(name, field) (name, field, FIELD) |
Declare a struct feld that is a member (member value or member accessor function) More... | |
#define | __QI_STRUCT_ACCESS_FUNC(fname, field) &field |
#define | __QI_STRUCT_ACCESS_FIELD(fname, field) &ClassType::field |
#define | __QI_STRUCT_ACCESS_BOUNCE2(name, accessor, type) QI_CAT(__QI_STRUCT_ACCESS_, type)(name, accessor) |
#define | __QI_STRUCT_ACCESS_BOUNCE1(x, y) __QI_STRUCT_ACCESS_BOUNCE2(x, y, FIELD) |
#define | __QI_STRUCT_ACCESS_BOUNCE(...) QI_CAT(__QI_STRUCT_ACCESS_BOUNCE, QI_LIST_VASIZE((__VA_ARGS__)))(__VA_ARGS__) |
#define | __QI_STRUCT_ACCESS(tuple) QI_DELAY(__QI_STRUCT_ACCESS_BOUNCE)tuple |
#define | __QI_ATUPLE_TYPE(_, what, field) res.push_back(::qi::detail::fieldType(__QI_STRUCT_ACCESS(field))); |
#define | __QI_ATUPLE_GET(_, what, field) if (i == index) return ::qi::detail::fieldStorage(ptr, __QI_STRUCT_ACCESS(field)); i++; |
#define | __QI_ATUPLE_FIELD_NAME(_, what, field) res.push_back(QI_PAIR_FIRST(field)); |
#define | __QI_ATUPLE_FROMDATA(idx, what, field) ::qi::detail::fieldValue(ptr, __QI_STRUCT_ACCESS(field), const_cast<void**>(&data[idx])) |
#define | __QI_TYPE_STRUCT_AGREGATE_CONSTRUCTOR_IMPLEMENT(name, inl, onSet,...) |
#define | QI_TYPE_STRUCT_PRIVATE_ACCESS(name) friend class qi::TypeImpl<name>; |
Allow the QI_TYPE_STRUCT macro and variants to access private members. More... | |
#define | QI_TYPE_STRUCT(name,...) |
#define | QI_TYPE_STRUCT_EX(name, onSet,...) |
#define | QI_TYPE_STRUCT_IMPLEMENT(name,...) __QI_TYPE_STRUCT_IMPLEMENT(name, , , __VA_ARGS__) |
#define | QI_TYPE_STRUCT_AGREGATE_CONSTRUCTOR(name,...) |
#define | QI_TYPE_STRUCT_REGISTER(name,...) |
#define | QI_TYPE_STRUCT_AGREGATE_CONSTRUCTOR_REGISTER(name,...) |
#define | QI_TYPE_STRUCT_BOUNCE(name, bounceTo, conversion) |
#define | QI_TYPE_STRUCT_BOUNCE_REGISTER(name, bounceTo, conversion) |
Functions | |
bool | qi::detail::fillMissingFieldsWithDefaultValues (std::map< std::string,::qi::AnyValue > &fields, const std::vector< std::tuple< std::string, TypeInterface * >> &missing, const char **which=0, int whichLength=0) |
std::string | qi::detail::normalizeClassName (const std::string &name) |
template<typename T > | |
void | qi::detail::setFromStorage (T &ref, void *storage) |
template<typename A > | |
TypeInterface * | qi::detail::fieldType (A) |
template<typename C , typename A > | |
void * | qi::detail::fieldStorage (C *inst, A accessor) |
template<typename C , typename A > | |
detail::Accessor< A >::value_type & | qi::detail::fieldValue (C *instance, A accessor, void **data) |
#define __QI_ATUPLE_FIELD_NAME | ( | _, | |
what, | |||
field | |||
) | res.push_back(QI_PAIR_FIRST(field)); |
Definition at line 323 of file structtypeinterface.hxx.
#define __QI_ATUPLE_FROMDATA | ( | idx, | |
what, | |||
field | |||
) | ::qi::detail::fieldValue(ptr, __QI_STRUCT_ACCESS(field), const_cast<void**>(&data[idx])) |
Definition at line 324 of file structtypeinterface.hxx.
#define __QI_ATUPLE_GET | ( | _, | |
what, | |||
field | |||
) | if (i == index) return ::qi::detail::fieldStorage(ptr, __QI_STRUCT_ACCESS(field)); i++; |
Definition at line 322 of file structtypeinterface.hxx.
#define __QI_ATUPLE_TYPE | ( | _, | |
what, | |||
field | |||
) | res.push_back(::qi::detail::fieldType(__QI_STRUCT_ACCESS(field))); |
Definition at line 321 of file structtypeinterface.hxx.
#define __QI_STRUCT_ACCESS | ( | tuple | ) | QI_DELAY(__QI_STRUCT_ACCESS_BOUNCE)tuple |
Definition at line 318 of file structtypeinterface.hxx.
#define __QI_STRUCT_ACCESS_BOUNCE | ( | ... | ) | QI_CAT(__QI_STRUCT_ACCESS_BOUNCE, QI_LIST_VASIZE((__VA_ARGS__)))(__VA_ARGS__) |
Definition at line 314 of file structtypeinterface.hxx.
#define __QI_STRUCT_ACCESS_BOUNCE1 | ( | x, | |
y | |||
) | __QI_STRUCT_ACCESS_BOUNCE2(x, y, FIELD) |
Definition at line 310 of file structtypeinterface.hxx.
#define __QI_STRUCT_ACCESS_BOUNCE2 | ( | name, | |
accessor, | |||
type | |||
) | QI_CAT(__QI_STRUCT_ACCESS_, type)(name, accessor) |
Definition at line 306 of file structtypeinterface.hxx.
#define __QI_STRUCT_ACCESS_FIELD | ( | fname, | |
field | |||
) | &ClassType::field |
Definition at line 303 of file structtypeinterface.hxx.
#define __QI_STRUCT_ACCESS_FUNC | ( | fname, | |
field | |||
) | &field |
Definition at line 301 of file structtypeinterface.hxx.
#define __QI_TUPLE_FIELD_NAME | ( | _, | |
what, | |||
field | |||
) | res.push_back(BOOST_PP_STRINGIZE(QI_DELAY(field))); |
Definition at line 242 of file structtypeinterface.hxx.
#define __QI_TUPLE_GET | ( | _, | |
what, | |||
field | |||
) | if (i == index) return ::qi::typeOf(ptr->field)->initializeStorage(&ptr->field); i++; |
Definition at line 240 of file structtypeinterface.hxx.
#define __QI_TUPLE_SET | ( | _, | |
what, | |||
field | |||
) | if (i == index) ::qi::detail::setFromStorage(ptr->field, valueStorage); i++; |
Definition at line 241 of file structtypeinterface.hxx.
#define __QI_TUPLE_TYPE | ( | _, | |
what, | |||
field | |||
) | res.push_back(::qi::typeOf(ptr->field)); |
Definition at line 239 of file structtypeinterface.hxx.
#define __QI_TYPE_STRUCT_AGREGATE_CONSTRUCTOR_IMPLEMENT | ( | name, | |
inl, | |||
onSet, | |||
... | |||
) |
Definition at line 325 of file structtypeinterface.hxx.
#define __QI_TYPE_STRUCT_DECLARE | ( | name, | |
extra | |||
) |
Definition at line 214 of file structtypeinterface.hxx.
#define __QI_TYPE_STRUCT_IMPLEMENT | ( | name, | |
inl, | |||
onSet, | |||
... | |||
) |
Definition at line 243 of file structtypeinterface.hxx.
#define _QITYPE_DETAIL_TYPETUPLE_HXX_ |
Definition at line 8 of file structtypeinterface.hxx.
#define QI_STRUCT_FIELD | ( | name, | |
field | |||
) | (name, field, FIELD) |
Declare a struct feld that is a member (member value or member accessor function)
Definition at line 298 of file structtypeinterface.hxx.
#define QI_STRUCT_HELPER | ( | name, | |
func | |||
) | (name, func, FUNC) |
Declare a struct field using an helper function.
Definition at line 296 of file structtypeinterface.hxx.
#define QI_TYPE_STRUCT | ( | name, | |
... | |||
) |
Declare a simple struct to the type system. First argument is the structure name. Remaining arguments are the structure fields. This macro must be called outside any namespace. This macro should be called in the header file defining the structure 'name', or in a header included by all source files using the structure. See QI_TYPE_STRUCT_REGISTER for a similar macro that can be called from a single source file.
Definition at line 396 of file structtypeinterface.hxx.
#define QI_TYPE_STRUCT_AGREGATE_CONSTRUCTOR | ( | name, | |
... | |||
) |
Register a struct with member field/function getters, and constructor setter
Call like that: QI_TYPE_STRUCT_AGREGATE_CONSTRUCTOR(Point, ("x", getX), ("y", y))
The first macro argument is the class full name including namespace. Remaining arguments can be:
The class must provide a constructor that accepts all fields as argument, in the order in which they are declared in the macro.
Must be called outside any namespace.
Definition at line 432 of file structtypeinterface.hxx.
#define QI_TYPE_STRUCT_AGREGATE_CONSTRUCTOR_REGISTER | ( | name, | |
... | |||
) |
Similar to QI_TYPE_STRUCT_AGREGATE_CONSTRUCTOR, but using the runtime factory instead of the compile-time template.
Definition at line 454 of file structtypeinterface.hxx.
#define QI_TYPE_STRUCT_BOUNCE | ( | name, | |
bounceTo, | |||
conversion | |||
) |
Declares that name is equivalent to type bounceTo, and that instances can be converted using the conversion function with signature 'bounceTo* (name*)'. This macro should be called in a header included by all code using the 'name' class. See QI_TYPE_STRUCT_BOUNCE_REGISTER for a similar macro that can be called from a single source file.
Definition at line 467 of file structtypeinterface.hxx.
#define QI_TYPE_STRUCT_BOUNCE_REGISTER | ( | name, | |
bounceTo, | |||
conversion | |||
) |
Similar to QI_TYPE_STRUCT_BOUNCE, but using the runtime factory instead of the compile-time template.
Definition at line 487 of file structtypeinterface.hxx.
#define QI_TYPE_STRUCT_EX | ( | name, | |
onSet, | |||
... | |||
) |
Similar to QI_TYPE_STRUCT, but evaluates 'onSet' after writting to an instance. The instance is accessible through the variable 'ptr'.
Definition at line 403 of file structtypeinterface.hxx.
#define QI_TYPE_STRUCT_EXTENSION_ADDED_FIELDS | ( | name, | |
... | |||
) |
Declare that some fields have been added in this structure. They will be filled with default values upon conversion to this structure.
Definition at line 81 of file structtypeinterface.hxx.
#define QI_TYPE_STRUCT_EXTENSION_CONVERT_HANDLERS | ( | name, | |
fromHandler, | |||
toHandler | |||
) |
Declare handlers for structure conversion from and to old version.
name | the name of the structure |
fromHandler | a handler that will be called when converting from old structure to this one. It should have the following signature: bool convertFrom(StructTypeInterface* type, std::map<std::string, ::qi::AnyValue>& fields, const std::vector<std::tuple<std::string, TypeInterface*>>& missing, const std::map<std::string, ::qi::AnyReference>& dropfields). The method receives the structure to convert from as a map and it must fill in the fields given in the missing argument. It must return true upon successful conversion. |
toHandler | a handler that will be called when converting from this structure to the old one. It should have the following signature: bool convertFrom(StructTypeInterface* type, std::map<std::string, ::qi::AnyValue>& fields, const std::vector<std::tuple<std::string>& missing, const std::map<std::string, ::qi::AnyReference>& dropfields). The method receives the structure to convert from as a map and it must fill in the fields given in the missing argument. It must return true upon successful conversion. |
Definition at line 155 of file structtypeinterface.hxx.
#define QI_TYPE_STRUCT_EXTENSION_DROPPED_FIELDS | ( | name, | |
... | |||
) |
Declare that some fields have been dropped in this structure. They will be filled with default values upon conversion to the old structure.
Definition at line 112 of file structtypeinterface.hxx.
#define QI_TYPE_STRUCT_IMPLEMENT | ( | name, | |
... | |||
) | __QI_TYPE_STRUCT_IMPLEMENT(name, , , __VA_ARGS__) |
Definition at line 407 of file structtypeinterface.hxx.
#define QI_TYPE_STRUCT_PRIVATE_ACCESS | ( | name | ) | friend class qi::TypeImpl<name>; |
Allow the QI_TYPE_STRUCT macro and variants to access private members.
Definition at line 384 of file structtypeinterface.hxx.
#define QI_TYPE_STRUCT_REGISTER | ( | name, | |
... | |||
) |
Similar to QI_TYPE_STRUCT, but using the runtime factory instead of the compile-time template. This macro will register the struct at static initialization time, and thus should only be called from one compilation unit. To ensure this, the simplest option is to use this macro from a .cpp source file. It should not be used in a header.
Definition at line 443 of file structtypeinterface.hxx.