Improved the documentation

This commit is contained in:
Filippo Cucchetto 2016-07-10 16:51:15 +02:00
parent fcdb2ce98f
commit 755ba4ac24
2 changed files with 41 additions and 5 deletions

View File

@ -351,6 +351,7 @@ DOS_API DosQObject *DOS_CALL dos_qvariant_toQObject(const DosQVariant *vptr);
/// @{ /// @{
/// \brief Create a new QMetaObject /// \brief Create a new QMetaObject
/// \param superClassMetaObject The superclass metaobject
/// \param className The class name /// \param className The class name
/// \param signalDefinitions The SignalDefinitions /// \param signalDefinitions The SignalDefinitions
/// \param slotDefinitions The SlotDefinitions struct /// \param slotDefinitions The SlotDefinitions struct
@ -365,7 +366,6 @@ DOS_API DosQMetaObject *DOS_CALL dos_qmetaobject_create(DosQMetaObject *superCla
const SlotDefinitions *slotDefinitions, const SlotDefinitions *slotDefinitions,
const PropertyDefinitions *propertyDefinitions); const PropertyDefinitions *propertyDefinitions);
/// \brief Free the memory allocated for the given QMetaObject /// \brief Free the memory allocated for the given QMetaObject
/// \param vptr The QMetaObject /// \param vptr The QMetaObject
DOS_API void DOS_CALL dos_qmetaobject_delete(DosQMetaObject *vptr); DOS_API void DOS_CALL dos_qmetaobject_delete(DosQMetaObject *vptr);
@ -383,6 +383,7 @@ DOS_API DosQMetaObject *DOS_CALL dos_qabstractlistmodel_qmetaobject();
/// \brief Create a new QAbstractListModel /// \brief Create a new QAbstractListModel
/// \param callbackObject The pointer of QAbstractListModel in the binded language
/// \param metaObject The QMetaObject for this QAbstractListModel /// \param metaObject The QMetaObject for this QAbstractListModel
/// \param dObjectCallback The callback for handling the properties read/write and slots execution /// \param dObjectCallback The callback for handling the properties read/write and slots execution
/// \param rowCountCallback The callback for handling the QAbstractListModel::rowCount() execution /// \param rowCountCallback The callback for handling the QAbstractListModel::rowCount() execution
@ -391,7 +392,7 @@ DOS_API DosQMetaObject *DOS_CALL dos_qabstractlistmodel_qmetaobject();
/// \param setDataCallback The callback for handling the QAbstractListModel::setData() execution /// \param setDataCallback The callback for handling the QAbstractListModel::setData() execution
/// \param roleNamesCallback The callback for handling the QAbstractListModel::roleNames() execution /// \param roleNamesCallback The callback for handling the QAbstractListModel::roleNames() execution
/// \param flagsCallback The callback for handling the QAbstractListModel::flags() execution /// \param flagsCallback The callback for handling the QAbstractListModel::flags() execution
/// \param headedDataCallback The callback for handling the QAbstractListModel::headerData() execution /// \param headerDataCallback The callback for handling the QAbstractListModel::headerData() execution
DOS_API DosQAbstractListModel *DOS_CALL dos_qabstractlistmodel_create(void *callbackObject, DOS_API DosQAbstractListModel *DOS_CALL dos_qabstractlistmodel_create(void *callbackObject,
DosQMetaObject *metaObject, DosQMetaObject *metaObject,
DObjectCallback dObjectCallback, DObjectCallback dObjectCallback,
@ -459,16 +460,20 @@ DOS_API void DOS_CALL dos_qabstractlistmodel_dataChanged(DosQAbstractListModel *
DOS_API DosQMetaObject *DOS_CALL dos_qobject_qmetaobject(); DOS_API DosQMetaObject *DOS_CALL dos_qobject_qmetaobject();
/// \brief Create a new QObject /// \brief Create a new QObject
/// \param dObjectPointer The pointer of the QObject in the binded language
/// \param metaObject The QMetaObject associated to the given QObject /// \param metaObject The QMetaObject associated to the given QObject
/// \param dObjectCallback The callback called from QML whenever a slot or property /// \param dObjectCallback The callback called from QML whenever a slot or property
/// should be in read, write or invoked /// should be in read, write or invoked
/// \return A new QObject /// \return A new QObject
/// \note The returned QObject should be freed by calling dos_qobject_delete() /// \note The returned QObject should be freed by calling dos_qobject_delete()
/// \note The \p dObjectPointer is usefull for forwarding a property read/slot to the correct
/// object in the binded language in the callback
DOS_API DosQObject *DOS_CALL dos_qobject_create(void *dObjectPointer, DOS_API DosQObject *DOS_CALL dos_qobject_create(void *dObjectPointer,
DosQMetaObject *metaObject, DosQMetaObject *metaObject,
DObjectCallback dObjectCallback); DObjectCallback dObjectCallback);
/// \brief Emit a signal definited in a QObject /// \brief Emit a signal definited in a QObject
/// \param vptr The QObject
/// \param name The signal name /// \param name The signal name
/// \param parametersCount The number of parameters in the \p parameters array /// \param parametersCount The number of parameters in the \p parameters array
/// \param parameters An array of DosQVariant with the values of signal arguments /// \param parameters An array of DosQVariant with the values of signal arguments
@ -540,7 +545,7 @@ DOS_API bool DOS_CALL dos_qmodelindex_isValid(const DosQModelIndex *vptr);
/// \brief Calls the QModelIndex::data() function /// \brief Calls the QModelIndex::data() function
/// \param vptr The QModelIndex /// \param vptr The QModelIndex
/// \param int The model role to which we want the data /// \param role The model role to which we want the data
/// \return The QVariant associated at the given role /// \return The QVariant associated at the given role
/// \note The returned QVariant should be freed by calling the dos_qvariant_delete() function /// \note The returned QVariant should be freed by calling the dos_qvariant_delete() function
DOS_API DosQVariant *DOS_CALL dos_qmodelindex_data (const DosQModelIndex *vptr, int role); DOS_API DosQVariant *DOS_CALL dos_qmodelindex_data (const DosQModelIndex *vptr, int role);
@ -574,7 +579,7 @@ DOS_API void DOS_CALL dos_qmodelindex_assign (DosQModelIndex *l, const DosQModel
/// @} /// @}
/// \defgroup QHash /// \defgroup QHash QHash
/// \brief Functions related to the QHash class /// \brief Functions related to the QHash class
/// @{ /// @{

View File

@ -99,7 +99,7 @@ typedef void (DOS_CALL *HeaderDataCallback)(void *self, int section, int orienta
/// Callback called from QML for creating a registered type /// Callback called from QML for creating a registered type
/** /**
* When a type is created through the QML engine a new QObject \i"Wrapper" is created. This becomes a proxy * When a type is created through the QML engine a new QObject \p "Wrapper" is created. This becomes a proxy
* between the "default" QObject created through dos_qobject_create() and the QML engine. This imply that implementation * between the "default" QObject created through dos_qobject_create() and the QML engine. This imply that implementation
* for this callback should swap the DosQObject* stored in the binded language with the wrapper. At the end the wrapper * for this callback should swap the DosQObject* stored in the binded language with the wrapper. At the end the wrapper
* becomes the owner of the original "default" DosQObject. Furthermore if the binding language is garbage collected you * becomes the owner of the original "default" DosQObject. Furthermore if the binding language is garbage collected you
@ -149,8 +149,13 @@ typedef void (DOS_CALL *CreateDObject)(int id, void *wrapper, void **dosQObject,
*/ */
typedef void (DOS_CALL *DeleteDObject)(int id, void * bindedQObject); typedef void (DOS_CALL *DeleteDObject)(int id, void * bindedQObject);
/// \brief Store an array of QVariant
/// \note This struct should be freed by calling dos_qvariantarray_delete(DosQVariantArray *ptr). This in turn
/// cleans up the internal array
struct DosQVariantArray { struct DosQVariantArray {
/// The number of elements
int size; int size;
/// The array
DosQVariant** data; DosQVariant** data;
}; };
@ -179,39 +184,65 @@ struct QmlRegisterType {
DeleteDObject deleteDObject; DeleteDObject deleteDObject;
}; };
/// Represents a single signal definition
struct SignalDefinition { struct SignalDefinition {
/// The signal name
const char *name; const char *name;
/// The signal parameters count
int parametersCount; int parametersCount;
/// The signal parameters metatypes
int *parametersMetaTypes; int *parametersMetaTypes;
}; };
/// Represents a set of signal definitions
struct SignalDefinitions { struct SignalDefinitions {
/// The total number of signals
int count; int count;
/// The signal definitions array
SignalDefinition *definitions; SignalDefinition *definitions;
}; };
/// Represents a single slot definition
struct SlotDefinition { struct SlotDefinition {
/// The slot name
const char *name; const char *name;
/// The slot return type
int returnMetaType; int returnMetaType;
/// The slot parameters count
int parametersCount; int parametersCount;
/// The slot parameters metatypes
int *parametersMetaTypes; int *parametersMetaTypes;
}; };
/// Represents a set of slot definitions
struct SlotDefinitions { struct SlotDefinitions {
/// The total number of slots
int count; int count;
/// The slot definitions array
SlotDefinition *definitions; SlotDefinition *definitions;
}; };
/// Represents a single property definition
struct PropertyDefinition { struct PropertyDefinition {
/// The property name
const char *name; const char *name;
/// The property metatype
int propertyMetaType; int propertyMetaType;
/// The name of the property read slot
const char *readSlot; const char *readSlot;
/// \brief The name of the property write slot
/// \note Setting this to null means a readonly proeperty
const char *writeSlot; const char *writeSlot;
/// \brief The name of the property notify signals
/// \note Setting this to null means a constant property
const char *notifySignal; const char *notifySignal;
}; };
/// Represents a set of property definitions
struct PropertyDefinitions { struct PropertyDefinitions {
/// The total number of properties
int count; int count;
/// The property definitions array
PropertyDefinition *definitions; PropertyDefinition *definitions;
}; };