0031353: TDocStd_Application does not have api to set progress indicator
[occt.git] / src / PCDM / PCDM_StorageDriver.cxx
index 0b62126..8aeb79d 100644 (file)
@@ -42,14 +42,11 @@ IMPLEMENT_STANDARD_RTTIEXT(PCDM_StorageDriver,PCDM_Writer)
 
 
 
-void PCDM_StorageDriver::Write(const Handle(CDM_Document)& aDocument, const TCollection_ExtendedString&  aFileName) 
+void PCDM_StorageDriver::Write (const Handle(CDM_Document)& aDocument,
+                                const TCollection_ExtendedString&  aFileName, 
+                                const Handle(Message_ProgressIndicator) &/*theProgress*/) 
 {
-  Handle(Storage_Schema) theSchema=PCDM::Schema(SchemaName(),aDocument->Application());
-
-  TColStd_SequenceOfExtendedString theExtensions;
-  aDocument->Extensions(theExtensions);
-  LoadExtensions(theSchema,theExtensions);
-
+  Handle(Storage_Schema) theSchema = new Storage_Schema;
 
   Handle(Storage_Data) theData = new Storage_Data;
 
@@ -59,17 +56,17 @@ void PCDM_StorageDriver::Write(const Handle(CDM_Document)& aDocument, const TCol
   PCDM_SequenceOfDocument thePersistentDocuments;
   {
     try { OCC_CATCH_SIGNALS Make(aDocument,thePersistentDocuments);}
-    catch (Standard_Failure) {
-      aMsg << Standard_Failure::Caught()<<(char)0;
+    catch (Standard_Failure const& anException) {
+      aMsg << anException<<(char)0;
       Failure=Standard_True;
     }
   }
 
-  if(Failure) PCDM_DriverError::Raise(aMsg);
+  if(Failure) throw PCDM_DriverError(aMsg.str().c_str());
 
   if(thePersistentDocuments.IsEmpty()) {
     aMsg << "the storage driver: " << DynamicType()->Name() << "returned no documents to store" << (char) 0;
-    PCDM_DriverError::Raise(aMsg);
+    throw PCDM_DriverError(aMsg.str().c_str());
   }
 
   Standard_Integer i=1;
@@ -96,13 +93,13 @@ void PCDM_StorageDriver::Write(const Handle(CDM_Document)& aDocument, const TCol
     theData->AddToComments(aComments(i));
   }
 
-  FSD_CmpFile theFile;
+  Handle(FSD_CmpFile) theFile = new FSD_CmpFile;
   PCDM_ReadWriter::Open(theFile,aFileName,Storage_VSWrite);
   theSchema->Write(theFile,theData);
-  theFile.Close();
+  theFile->Close();
 
   if ( theData->ErrorStatus() != Storage_VSOk )
-    PCDM_DriverError::Raise(theData->ErrorStatusExtension().ToCString());
+    throw PCDM_DriverError(theData->ErrorStatusExtension().ToCString());
 }
 
 
@@ -110,21 +107,19 @@ void PCDM_StorageDriver::Write(const Handle(CDM_Document)& aDocument, const TCol
 //function : Write
 //purpose  : 
 //=======================================================================
-void PCDM_StorageDriver::Write (const Handle(CDM_Document)& /*aDocument*/, Standard_OStream& /*theOStream*/) 
+void PCDM_StorageDriver::Write (const Handle(CDM_Document)&              /*aDocument*/, 
+                                Standard_OStream&                        /*theOStream*/, 
+                                const Handle(Message_ProgressIndicator)& /*theProgress*/)
 {
   
 }
-//void PCDM_StorageDriver::LoadExtensions(const Handle(Storage_Schema)& aSchema, const TColStd_SequenceOfExtendedString& Extensions) {}
-void PCDM_StorageDriver::LoadExtensions(const Handle(Storage_Schema)& , const TColStd_SequenceOfExtendedString& ) {}
-
 
 //Handle(PCDM_Document) PCDM_StorageDriver::Make(const Handle(CDM_Document)& aDocument) {
 Handle(PCDM_Document) PCDM_StorageDriver::Make(const Handle(CDM_Document)& ) {
   Handle(PCDM_Document) voidDocument;
   Standard_SStream aMsg;
   aMsg << "No Make method were implemented in this Driver" << DynamicType()->Name() << (char) 0;
-  Standard_NotImplemented::Raise(aMsg);
-  return voidDocument;
+  throw Standard_NotImplemented(aMsg.str().c_str());
 }
 
 void PCDM_StorageDriver::Make(const Handle(CDM_Document)& aDocument, PCDM_SequenceOfDocument& Documents) {