mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0024023: Revamp the OCCT Handle -- plugin
Definition of PLUGINFACTORY function changed to return Standard_Transient* instead of Handle(Standard_Transient), which cannot be returned by C-style function. Default implementation of PLUGINFACTORY() instantiated by macro PLUGIN() is corrected accordingly. Methods Factory() in persistence packages are made returning const & to handle; this is to reflect the fact that returned handle should point to existing object (usually statically allocated) rather than new one.
This commit is contained in:
@@ -32,6 +32,7 @@ is
|
||||
class DocumentRetrievalDriver;
|
||||
|
||||
Factory (theGUID : GUID from Standard) returns Transient from Standard;
|
||||
---C++: return const &
|
||||
|
||||
AttributeDrivers (theMsgDriver: MessageDriver from CDM)
|
||||
returns ADriverTable from XmlMDF;
|
||||
|
@@ -40,7 +40,7 @@ static Standard_GUID XmlRetrievalDriver("03a56822-8269-11d5-aab2-0050044b1af1");
|
||||
//function : Factory
|
||||
//purpose : PLUGIN FACTORY
|
||||
//=======================================================================
|
||||
Handle(Standard_Transient) XmlDrivers::Factory(const Standard_GUID& theGUID)
|
||||
const Handle(Standard_Transient)& XmlDrivers::Factory(const Standard_GUID& theGUID)
|
||||
{
|
||||
if (theGUID == XmlStorageDriver)
|
||||
{
|
||||
@@ -64,7 +64,8 @@ Handle(Standard_Transient) XmlDrivers::Factory(const Standard_GUID& theGUID)
|
||||
}
|
||||
|
||||
Standard_Failure::Raise ("XmlDrivers : unknown GUID");
|
||||
return NULL;
|
||||
static Handle(Standard_Transient) aNullHandle;
|
||||
return aNullHandle;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -87,9 +88,5 @@ Handle(XmlMDF_ADriverTable) XmlDrivers::AttributeDrivers
|
||||
return aTable;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4190) /* disable warning on C++ type returned by C function; should be OK for C++ usage */
|
||||
#endif
|
||||
|
||||
// Declare entry point PLUGINFACTORY
|
||||
PLUGIN(XmlDrivers)
|
||||
|
Reference in New Issue
Block a user