The TCreateUpdateCollectionWrap class was created to simplify usage of CObjectCollectionControllerCompBase.
The TCreateUpdateCollectionWrap class was created to simplify usage of CObjectCollectionControllerCompBase
- Note
- Programmers SHOULD NOT use this class. They SHOULD create a correct implementation of Base's methods
- Authors
- SZ, VS
- Parameters
-
| _CreateRepresentation | - a representation, used to create an object |
| _UpdateRequest | - a request, MUST be able to extract representtion to update object's data, with type _CreateRepresentation |
| _Base | - a base class, that contains create/update methods |
| _OID | - an object ID, that should be created with _Base i.e.: by call _Base::CreateObject() method |
- Warning
_OID MUST be defined as static variable (CXX known limitation)
usage
static char s_MyClassCOTId[] = "";
class MyClass: public TCreateUpdateCollectionWrap<MyRepresentation, MyUpdateRequest, BaseCollectionController, s_MyClassCOTId>
{
protected:
[[nodiscard]]virtual MyRepresentation GetRepresentationFromRequest(const MyUpdateRequest& request)const
{
return request->GetRepresentation();
};
[[nodiscard]]virtual bool SetObjectDataFromRepresentation(istd::IChangeable& object, const MyRepresentation& representation, QString& errorString) const
{
MyModelData* modelData = (MyModelData*)(object);
if (modelData != nullptr){
modelData->SetName(representation.GetName());
return true;
}
return false;
};
}