1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +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:
abv
2015-06-29 09:17:43 +03:00
parent 83eaf3e892
commit ce8b059af3
20 changed files with 35 additions and 53 deletions

View File

@@ -33,6 +33,7 @@ is
Factory (aGUID: GUID from Standard)
returns Transient from Standard;
---C++: return const &
---Purpose: Depending from the ID, returns a list of storage
-- or retrieval attribute drivers. Used for plugin.
--

View File

@@ -25,7 +25,7 @@
static Standard_GUID XSStorageDriver ("f78ff496-a779-11d5-aab4-0050044b1af1");
static Standard_GUID XSRetrievalDriver("f78ff497-a779-11d5-aab4-0050044b1af1");
Handle(Standard_Transient) XmlXCAFDrivers::Factory(const Standard_GUID& aGUID)
const Handle(Standard_Transient)& XmlXCAFDrivers::Factory(const Standard_GUID& aGUID)
{
if(aGUID == XSStorageDriver)
{
@@ -50,7 +50,4 @@ Handle(Standard_Transient) XmlXCAFDrivers::Factory(const Standard_GUID& aGUID)
return XmlDrivers::Factory (aGUID);
}
#ifdef _MSC_VER
#pragma warning(disable:4190) /* disable warning on C++ type returned by C function; should be OK for C++ usage */
#endif
PLUGIN(XmlXCAFDrivers)