]> OCCT Git - occt-copy.git/commitdiff
Added overloaded methods SaveAs() with 3rd parameter status message string.
authorstv <stv@opencascade.com>
Fri, 5 Jun 2015 11:33:05 +0000 (14:33 +0300)
committerstv <stv@opencascade.com>
Fri, 5 Jun 2015 11:33:05 +0000 (14:33 +0300)
src/TDocStd/TDocStd_Application.cdl
src/TDocStd/TDocStd_Application.cxx

index 8993c829229506961a6188781ca2bcb4c25a2480..1d63b54789e5e813d1ae4fdb01dbd852b1482a11 100644 (file)
@@ -215,16 +215,37 @@ is
        --           path <thePath> ; overwrites  the file  if  it already exists.
     returns StoreStatus from PCDM;
 
+    SaveAs (me : mutable; theDoc : Document from TDocStd;
+                          thePath: ExtendedString from TCollection;
+                         theStatusMessage: out ExtendedString from TCollection)
+       ---Purpose:  Save the  active document  in the
+       --           path <thePath> ; overwrites  the file  if  it already exists.
+    returns StoreStatus from PCDM;
+
+    SaveAs (me : mutable; theDoc    : Document from TDocStd;
+                          theOStream: in out OStream from Standard)
+       ---Purpose:  Save the  active document  in the stream  <theOStream>;
+    returns StoreStatus from PCDM;
+
+    SaveAs (me : mutable; theDoc    : Document from TDocStd;
+                          theOStream: in out OStream from Standard;
+                         theStatusMessage: out ExtendedString from TCollection)
+       ---Purpose:  Save the  active document  in the stream  <theOStream>;
+    returns StoreStatus from PCDM;
+
     SaveAs (me : mutable; theDoc   : Document from TDocStd;
                           theDevice: IODevice from Storage)
        ---Purpose:  Save the  active document  in the device  <theDevice>;
        --           overwrites  the file  if  it already exists.
     returns StoreStatus from PCDM is protected;
     
-    SaveAs (me : mutable; theDoc    : Document from TDocStd;
-                          theOStream: in out OStream from Standard)
-       ---Purpose:  Save the  active document  in the stream  <theOStream>;
-    returns StoreStatus from PCDM;
+    SaveAs (me : mutable; aDoc : Document from TDocStd;
+                          aDev : IODevice from Storage;
+                         theStatusMessage:  out  ExtendedString from TCollection)
+       ---Purpose:  Save the  active document  in the file  <name> in the
+       --           path <path>.  overwrite  the file  if  it
+       --          already exist. 
+    returns StoreStatus from PCDM is protected;
 
     Save (me : mutable; aDoc : Document from TDocStd)
        ---Purpose: Save aDoc active document.  
@@ -233,14 +254,6 @@ is
        -- was not retrieved in the applicative session by using Open. 
     returns StoreStatus from PCDM;
     
-    SaveAs (me : mutable; aDoc : Document from TDocStd;
-                          aDev : IODevice from Storage;
-                         theStatusMessage:  out  ExtendedString from TCollection)
-       ---Purpose:  Save the  active document  in the file  <name> in the
-       --           path <path>  .  overwrite  the file  if  it
-       --          already exist. 
-    returns StoreStatus from PCDM;    
-    
     Save (me : mutable; aDoc : Document from TDocStd; 
                        theStatusMessage:  out  ExtendedString from TCollection)
        ---Purpose: Save the document overwriting the previous file 
index 588ee15a28d766371bb8d10085d336124514f2d1..c05e613ffec7b50cde22be881d1496f112e25a5d 100644 (file)
@@ -259,8 +259,8 @@ PCDM_ReaderStatus TDocStd_Application::Open( Standard_IStream& theIStream,
 PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& theDoc,
                                              const TCollection_ExtendedString& thePath)
 {
-  Handle(Storage_File) aDevice = new Storage_File(thePath);
-  return SaveAs (theDoc, aDevice);
+  Handle(Storage_File) aDevice = new Storage_File( thePath );
+  return SaveAs( theDoc, aDevice );
 }
 
 //=======================================================================
@@ -268,57 +268,85 @@ PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& the
 //purpose  :
 //=======================================================================
 
-PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
-                                             const Handle(Storage_IODevice)& aDevice)
-                                             {
-  /*
-  TDocStd_PathParser tool (path);
-  TCollection_ExtendedString directory = tool.Trek();
-  TCollection_ExtendedString file = tool.Name();
-  file+=".";
-  file+=tool.Extension();
-  */
-  D->Open(this);
-  CDF_Store storer (D);
-  if (!storer.SetDevice(aDevice))
-  {
-    TCollection_ExtendedString aMsg ("TDocStd_Application::SaveAs() - device ");
-    aMsg += " not valid";
-    if(!MessageDriver().IsNull())
-      MessageDriver()->Write(aMsg.ToExtString());
-    return storer.StoreStatus(); //CDF_SS_Failure;
-  }
-  //  storer.SetName (file);
-  try {
-    OCC_CATCH_SIGNALS
-    storer.Realize();
-  }
-  catch (Standard_Failure) {
-    Handle(Standard_Failure) F = Standard_Failure::Caught();
-    if (!F.IsNull() && !MessageDriver().IsNull()) {
-      TCollection_ExtendedString aString (F->GetMessageString());
-      MessageDriver()->Write(aString.ToExtString());
-    }
-  }
-  if(storer.StoreStatus() == PCDM_SS_OK)
-    D->SetSaved();
-#ifdef OCCT_DEBUG
-  cout<<"TDocStd_Application::SaveAs(): The status = "<<storer.StoreStatus()<<endl;
-#endif
-  return storer.StoreStatus();
+PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& theDoc,
+                                             const TCollection_ExtendedString& thePath,
+                                             TCollection_ExtendedString& theStatusMessage)
+{
+  Handle(Storage_File) aDevice = new Storage_File( thePath );
+  return SaveAs( theDoc, aDevice, theStatusMessage );
 }
 
 //=======================================================================
-//function : Save
+//function : SaveAs
 //purpose  :
 //=======================================================================
 
-
 PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& theDoc,
                                              Standard_OStream& theOStream)
 {
-  Handle(Storage_OStream) aDevice = new Storage_OStream (theOStream);
-  return SaveAs (theDoc, aDevice);
+  Handle(Storage_OStream) aDevice = new Storage_OStream( theOStream );
+  return SaveAs( theDoc, aDevice );
+}
+
+//=======================================================================
+//function : SaveAs
+//purpose  :
+//=======================================================================
+
+PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& theDoc,
+                                             Standard_OStream& theOStream,
+                                             TCollection_ExtendedString& theStatusMessage)
+{
+  Handle(Storage_OStream) aDevice = new Storage_OStream( theOStream );
+  return SaveAs( theDoc, aDevice, theStatusMessage );
+}
+
+//=======================================================================
+//function : SaveAs
+//purpose  :
+//=======================================================================
+
+PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
+                                             const Handle(Storage_IODevice)& aDevice)
+{
+  TCollection_ExtendedString aStatusMessage;
+  return SaveAs( D, aDevice, aStatusMessage );
+}
+
+//=======================================================================
+//function : SaveAs
+//purpose  : 
+//=======================================================================
+
+PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
+                                             const Handle(Storage_IODevice)& aDev,
+                                             TCollection_ExtendedString& theStatusMessage) 
+{ 
+  PCDM_StoreStatus aStatus = PCDM_SS_Failure;
+  D->Open(this);
+  CDF_Store storer (D);  
+  if (storer.SetDevice(aDev)) {
+    try {
+      OCC_CATCH_SIGNALS
+      storer.Realize();
+    }
+    catch (Standard_Failure) {
+      Handle(Standard_Failure) F = Standard_Failure::Caught();
+      if (!F.IsNull() && !MessageDriver().IsNull()) {
+        TCollection_ExtendedString aString (F->GetMessageString());
+        MessageDriver()->Write(aString.ToExtString());
+      }
+    }
+    if(storer.StoreStatus() == PCDM_SS_OK)
+      D->SetSaved();
+    theStatusMessage = storer.AssociatedStatusText();
+    aStatus = storer.StoreStatus();
+  } else {
+    theStatusMessage =
+      TCollection_ExtendedString("TDocStd_Application::SaveAs: No valid device ");
+    aStatus = PCDM_SS_Failure;
+  }
+  return aStatus;
 }
 
 //=======================================================================
@@ -383,50 +411,6 @@ PCDM_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D) {
 // }
 
 
-//=======================================================================
-//function : SaveAs
-//purpose  : 
-//=======================================================================
-
-PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
-                                             const Handle(Storage_IODevice)& aDev,
-                                             TCollection_ExtendedString& theStatusMessage) 
-{ 
-  PCDM_StoreStatus aStatus = PCDM_SS_Failure;
-  /*
-  TDocStd_PathParser tool (path);
-  TCollection_ExtendedString directory = tool.Trek();   
-  TCollection_ExtendedString file = tool.Name();   
-  file+=".";   
-  file+=tool.Extension();
-  */
-  D->Open(this);
-  CDF_Store storer (D);  
-  if (storer.SetDevice(aDev)) {
-    //    storer.SetName (file);
-    try {
-      OCC_CATCH_SIGNALS
-      storer.Realize();
-    }
-    catch (Standard_Failure) {
-      Handle(Standard_Failure) F = Standard_Failure::Caught();
-      if (!F.IsNull() && !MessageDriver().IsNull()) {
-        TCollection_ExtendedString aString (F->GetMessageString());
-        MessageDriver()->Write(aString.ToExtString());
-      }
-    }
-    if(storer.StoreStatus() == PCDM_SS_OK)
-      D->SetSaved();
-    theStatusMessage = storer.AssociatedStatusText();
-    aStatus = storer.StoreStatus();
-  } else {
-    theStatusMessage =
-      TCollection_ExtendedString("TDocStd_Application::SaveAs: No valid device ");
-    aStatus = PCDM_SS_Failure;
-  }
-  return aStatus;
-}
-
 //=======================================================================
 //function : Save
 //purpose  :