1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0026937: Eliminate NO_CXX_EXCEPTION macro support

Macro NO_CXX_EXCEPTION was removed from code.
Method Raise() was replaced by explicit throw statement.
Method Standard_Failure::Caught() was replaced by normal C++mechanism of exception transfer.
Method Standard_Failure::Caught() is deprecated now.
Eliminated empty constructors.
Updated samples.
Eliminate empty method ChangeValue from NCollection_Map class.
Removed not operable methods from NCollection classes.
This commit is contained in:
ski
2017-02-02 16:35:21 +03:00
committed by apn
parent 0c63f2f8b9
commit 9775fa6110
1146 changed files with 4860 additions and 6183 deletions

View File

@@ -222,12 +222,12 @@ Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMeta
case PCDM_RS_UnknownDocument:
aMsg << "could not find the referenced document: " << aMetaData->Path() << "; not found." <<(char)0 << endl;
myRetrievableStatus = PCDM_RS_UnknownDocument;
Standard_Failure::Raise(aMsg);
throw Standard_Failure(aMsg.str().c_str());
break;
case PCDM_RS_PermissionDenied:
aMsg << "Could not find the referenced document: " << aMetaData->Path() << "; permission denied. " <<(char)0 << endl;
myRetrievableStatus = PCDM_RS_PermissionDenied;
Standard_Failure::Raise(aMsg);
throw Standard_Failure(aMsg.str().c_str());
break;
default:
break;
@@ -245,7 +245,7 @@ Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMeta
{
Standard_SStream aMsg;
aMsg << "Could not determine format for the file " << aMetaData->FileName() << (char)0;
Standard_NoSuchObject::Raise(aMsg);
throw Standard_NoSuchObject(aMsg.str().c_str());
}
Handle(PCDM_Reader) theReader = ReaderFromFormat (aFormat);
@@ -267,12 +267,12 @@ Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMeta
OCC_CATCH_SIGNALS
theReader->Read(aMetaData->FileName(),theDocument,this);
}
catch (Standard_Failure) {
catch (Standard_Failure const& anException) {
myRetrievableStatus = theReader->GetStatus();
if(myRetrievableStatus > PCDM_RS_AlreadyRetrieved){
Standard_SStream aMsg;
aMsg << Standard_Failure::Caught() << endl;
Standard_Failure::Raise(aMsg);
aMsg << anException << endl;
throw Standard_Failure(aMsg.str().c_str());
}
}
myRetrievableStatus = theReader->GetStatus();
@@ -333,13 +333,13 @@ Handle(CDM_Document) CDF_Application::Read (Standard_IStream& theIStream)
aFormat = PCDM_ReadWriter::FileFormat (theIStream, dData);
}
catch (Standard_Failure)
catch (Standard_Failure const& anException)
{
myRetrievableStatus = PCDM_RS_FormatFailure;
Standard_SStream aMsg;
aMsg << Standard_Failure::Caught() << endl;
Standard_Failure::Raise(aMsg);
aMsg << anException << endl;
throw Standard_Failure(aMsg.str().c_str());
}
if (aFormat.IsEmpty())
@@ -361,14 +361,14 @@ Handle(CDM_Document) CDF_Application::Read (Standard_IStream& theIStream)
aReader->Read (theIStream, dData, aDoc, this);
}
catch (Standard_Failure)
catch (Standard_Failure const& anException)
{
myRetrievableStatus = aReader->GetStatus();
if (myRetrievableStatus > PCDM_RS_AlreadyRetrieved)
{
Standard_SStream aMsg;
aMsg << Standard_Failure::Caught() << endl;
Standard_Failure::Raise(aMsg);
aMsg << anException << endl;
throw Standard_Failure(aMsg.str().c_str());
}
}
@@ -397,7 +397,7 @@ Handle(PCDM_Reader) CDF_Application::ReaderFromFormat(const TCollection_Extended
Standard_SStream aMsg;
aMsg << "Could not found the item:" << aResourceName <<(char)0;
myRetrievableStatus = PCDM_RS_WrongResource;
Standard_NoSuchObject::Raise(aMsg);
throw Standard_NoSuchObject(aMsg.str().c_str());
}
// Get GUID as a string.
@@ -414,11 +414,11 @@ Handle(PCDM_Reader) CDF_Application::ReaderFromFormat(const TCollection_Extended
OCC_CATCH_SIGNALS
aReader = Handle(PCDM_RetrievalDriver)::DownCast(Plugin::Load(aPluginId));
}
catch (Standard_Failure)
catch (Standard_Failure const& anException)
{
myReaders.Add(theFormat, aReader);
myRetrievableStatus = PCDM_RS_WrongResource;
Standard_Failure::Caught()->Reraise();
throw anException;
}
if (!aReader.IsNull()) {
aReader->SetFormat(theFormat);
@@ -452,7 +452,7 @@ Handle(PCDM_StorageDriver) CDF_Application::WriterFromFormat(const TCollection_E
myWriters.Add(theFormat, aDriver);
Standard_SStream aMsg;
aMsg << "Could not found the resource definition:" << aResourceName <<(char)0;
Standard_NoSuchObject::Raise(aMsg);
throw Standard_NoSuchObject(aMsg.str().c_str());
}
// Get GUID as a string.
@@ -469,11 +469,11 @@ Handle(PCDM_StorageDriver) CDF_Application::WriterFromFormat(const TCollection_E
OCC_CATCH_SIGNALS
aDriver = Handle(PCDM_StorageDriver)::DownCast(Plugin::Load(aPluginId));
}
catch (Standard_Failure)
catch (Standard_Failure const& anException)
{
myWriters.Add(theFormat, aDriver);
myRetrievableStatus = PCDM_RS_WrongResource;
Standard_Failure::Caught()->Reraise();
throw anException;
}
if (aDriver.IsNull())
{

View File

@@ -180,7 +180,7 @@ TCollection_ExtendedString CDF_FWOSDriver::DefaultFolder()
else {
theDefaultFolder=UTL::xgetenv("TEMP");
if(theDefaultFolder.Length()==0)
Standard_Failure::Raise("cannot determine default folder; HOMEDRIVE and TEMP are undefined");
throw Standard_Failure("cannot determine default folder; HOMEDRIVE and TEMP are undefined");
}
#else
TCollection_ExtendedString home=UTL::xgetenv("HOME");

View File

@@ -31,7 +31,7 @@ DEFINE_STANDARD_HANDLE(CDF_MetaDataDriverError, Standard_Failure)
#if !defined No_Exception && !defined No_CDF_MetaDataDriverError
#define CDF_MetaDataDriverError_Raise_if(CONDITION, MESSAGE) \
if (CONDITION) CDF_MetaDataDriverError::Raise(MESSAGE);
if (CONDITION) throw CDF_MetaDataDriverError(MESSAGE);
#else
#define CDF_MetaDataDriverError_Raise_if(CONDITION, MESSAGE)
#endif

View File

@@ -32,10 +32,9 @@
IMPLEMENT_STANDARD_RTTIEXT(CDF_StoreList,Standard_Transient)
static void CAUGHT(TCollection_ExtendedString& status,const TCollection_ExtendedString& what) {
Handle(Standard_Failure) F = Standard_Failure::Caught();
static void CAUGHT(const Standard_Failure& theException,TCollection_ExtendedString& status,const TCollection_ExtendedString& what) {
status += what;
status += F->GetMessageString();
status += theException.GetMessageString();
}
CDF_StoreList::CDF_StoreList(const Handle(CDM_Document)& aDocument) {
@@ -91,7 +90,7 @@ PCDM_StoreStatus CDF_StoreList::Store (Handle(CDM_MetaData)& aMetaData, TCollect
Handle(CDF_Application) anApp = Handle(CDF_Application)::DownCast (theDocument->Application());
if (anApp.IsNull())
{
Standard_Failure::Raise("Document has no application, cannot save!");
throw Standard_Failure("Document has no application, cannot save!");
}
Handle(PCDM_StorageDriver) aDocumentStorageDriver =
anApp->WriterFromFormat(theDocument->StorageFormat());
@@ -99,13 +98,13 @@ PCDM_StoreStatus CDF_StoreList::Store (Handle(CDM_MetaData)& aMetaData, TCollect
{
Standard_SStream aMsg;
aMsg <<"No storage driver does exist for this format: " << theDocument->StorageFormat() << (char)0;
Standard_Failure::Raise(aMsg);
throw Standard_Failure(aMsg.str().c_str());
}
if(!theMetaDataDriver->FindFolder(theDocument->RequestedFolder())) {
Standard_SStream aMsg; aMsg << "could not find the active dbunit";
aMsg << TCollection_ExtendedString(theDocument->RequestedFolder())<< (char)0;
Standard_NoSuchObject::Raise(aMsg);
throw Standard_NoSuchObject(aMsg.str().c_str());
}
TCollection_ExtendedString theName=theMetaDataDriver->BuildFileName(theDocument);
@@ -122,12 +121,12 @@ PCDM_StoreStatus CDF_StoreList::Store (Handle(CDM_MetaData)& aMetaData, TCollect
}
}
catch (CDF_MetaDataDriverError) {
CAUGHT(aStatusAssociatedText,TCollection_ExtendedString("metadatadriver failed; reason:"));
catch (CDF_MetaDataDriverError anException) {
CAUGHT(anException, aStatusAssociatedText, TCollection_ExtendedString("metadatadriver failed; reason:"));
status = PCDM_SS_DriverFailure;
}
catch (Standard_Failure) {
CAUGHT(aStatusAssociatedText,TCollection_ExtendedString("driver failed; reason:"));
catch (Standard_Failure const& anException) {
CAUGHT(anException, aStatusAssociatedText, TCollection_ExtendedString("driver failed; reason:"));
status = PCDM_SS_Failure;
}
}