]> OCCT Git - occt-copy.git/commitdiff
* 0026229: Add the possibility in OCAF to open/save a document from/to a stream object.
authorstv <stv@opencascade.com>
Tue, 19 May 2015 13:02:24 +0000 (16:02 +0300)
committermsv <msv@opencascade.com>
Thu, 22 Oct 2015 12:49:02 +0000 (15:49 +0300)
TKCAF has been separated on two parts:
- The sources which independent from visualization are remained in this TK.
- Visualisation dependencies are moved to the new TK: TKVCAF.
- Some dependencies which are connected with persistent objects (from other TK) have been corrected.

181 files changed:
adm/UDLIST
src/BinDrivers/BinDrivers.cxx
src/BinDrivers/BinDrivers_DocumentRetrievalDriver.cdl
src/BinDrivers/BinDrivers_DocumentRetrievalDriver.cxx
src/BinDrivers/BinDrivers_DocumentStorageDriver.cdl
src/BinDrivers/BinDrivers_DocumentStorageDriver.cxx
src/BinLDrivers/BinLDrivers.cxx
src/BinLDrivers/BinLDrivers_DocumentRetrievalDriver.cdl
src/BinLDrivers/BinLDrivers_DocumentRetrievalDriver.cxx
src/BinLDrivers/BinLDrivers_DocumentSection.cdl
src/BinLDrivers/BinLDrivers_DocumentSection.cxx
src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cdl
src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx
src/BinMDataXtd/BinMDataXtd.cdl
src/BinMDataXtd/BinMDataXtd.cxx
src/BinMDataXtd/BinMDataXtd_PositionDriver.cdl [new file with mode: 0644]
src/BinMDataXtd/BinMDataXtd_PositionDriver.cxx [new file with mode: 0644]
src/BinMDataXtd/BinMDataXtd_PresentationDriver.cdl [new file with mode: 0644]
src/BinMDataXtd/BinMDataXtd_PresentationDriver.cxx [new file with mode: 0644]
src/BinMNaming/BinMNaming.cdl
src/BinMNaming/BinMNaming_NamedShapeDriver.cdl
src/BinMNaming/BinMNaming_NamedShapeDriver.cxx
src/BinMPrsStd/BinMPrsStd.cdl [deleted file]
src/BinMPrsStd/BinMPrsStd.cxx [deleted file]
src/BinMPrsStd/BinMPrsStd_AISPresentationDriver.cdl [deleted file]
src/BinMPrsStd/BinMPrsStd_AISPresentationDriver.cxx [deleted file]
src/BinMPrsStd/BinMPrsStd_PositionDriver.cdl [deleted file]
src/BinMPrsStd/BinMPrsStd_PositionDriver.cxx [deleted file]
src/BinObjMgt/BinObjMgt.cdl
src/BinObjMgt/BinObjMgt_Persistent.cdl
src/BinObjMgt/BinObjMgt_Persistent.cxx
src/CDF/CDF.cdl
src/CDF/CDF_Application.cdl
src/CDF/CDF_Application.cxx
src/CDF/CDF_FWOSDriver.cdl
src/CDF/CDF_FWOSDriver.cxx
src/CDF/CDF_MetaDataDriver.cdl
src/CDF/CDF_MetaDataDriver.cxx
src/CDF/CDF_Store.cdl
src/CDF/CDF_Store.cxx
src/CDF/CDF_StoreList.cxx
src/CDM/CDM.cdl
src/CDM/CDM_Document.cdl
src/CDM/CDM_Document.cxx
src/CDM/CDM_MetaData.cdl
src/CDM/CDM_MetaData.cxx
src/DDF/DDF_BasicCommands.cxx
src/DDF/DDF_IOStream.cxx [deleted file]
src/DDF/DDF_IOStream.hxx [deleted file]
src/DDF/FILES
src/FSD/FSD_BinaryFile.cdl
src/FSD/FSD_BinaryFile.cxx
src/FSD/FSD_CmpFile.cdl
src/FSD/FSD_CmpFile.cxx
src/FSD/FSD_File.cdl
src/FSD/FSD_File.cxx
src/LDOM/LDOM_XmlWriter.cxx
src/LDOM/LDOM_XmlWriter.hxx
src/MDataXtd/MDataXtd.cdl
src/MDataXtd/MDataXtd.cxx
src/MDataXtd/MDataXtd_PositionRetrievalDriver.cdl [new file with mode: 0644]
src/MDataXtd/MDataXtd_PositionRetrievalDriver.cxx [new file with mode: 0644]
src/MDataXtd/MDataXtd_PositionStorageDriver.cdl [new file with mode: 0644]
src/MDataXtd/MDataXtd_PositionStorageDriver.cxx [new file with mode: 0644]
src/MDataXtd/MDataXtd_PresentationRetrievalDriver.cdl [new file with mode: 0644]
src/MDataXtd/MDataXtd_PresentationRetrievalDriver.cxx [new file with mode: 0644]
src/MDataXtd/MDataXtd_PresentationRetrievalDriver_1.cdl [new file with mode: 0644]
src/MDataXtd/MDataXtd_PresentationRetrievalDriver_1.cxx [new file with mode: 0644]
src/MDataXtd/MDataXtd_PresentationStorageDriver.cdl [new file with mode: 0644]
src/MDataXtd/MDataXtd_PresentationStorageDriver.cxx [new file with mode: 0644]
src/MPrsStd/MPrsStd.cdl [deleted file]
src/MPrsStd/MPrsStd.cxx [deleted file]
src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cdl [deleted file]
src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cxx [deleted file]
src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cdl [deleted file]
src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cxx [deleted file]
src/MPrsStd/MPrsStd_AISPresentationStorageDriver.cdl [deleted file]
src/MPrsStd/MPrsStd_AISPresentationStorageDriver.cxx [deleted file]
src/MPrsStd/MPrsStd_PositionRetrievalDriver.cdl [deleted file]
src/MPrsStd/MPrsStd_PositionRetrievalDriver.cxx [deleted file]
src/MPrsStd/MPrsStd_PositionStorageDriver.cdl [deleted file]
src/MPrsStd/MPrsStd_PositionStorageDriver.cxx [deleted file]
src/OS/ApplicationFramework.tcl
src/OS/Draw.tcl
src/PCDM/PCDM.cdl
src/PCDM/PCDM.cxx
src/PCDM/PCDM_DOMHeaderParser.cxx
src/PCDM/PCDM_DOMHeaderParser.hxx
src/PCDM/PCDM_ReadWriter.cdl
src/PCDM/PCDM_ReadWriter.cxx
src/PCDM/PCDM_ReadWriter_1.cdl
src/PCDM/PCDM_ReadWriter_1.cxx
src/PCDM/PCDM_Reader.cdl
src/PCDM/PCDM_Reference.cdl
src/PCDM/PCDM_Reference.cxx
src/PCDM/PCDM_ReferenceIterator.cxx
src/PCDM/PCDM_RetrievalDriver.cdl
src/PCDM/PCDM_RetrievalDriver.cxx
src/PCDM/PCDM_StorageDriver.cdl
src/PCDM/PCDM_StorageDriver.cxx
src/PCDM/PCDM_Writer.cdl
src/PDataXtd/PDataXtd.cdl
src/PDataXtd/PDataXtd_Presentation.cdl [new file with mode: 0644]
src/PDataXtd/PDataXtd_Presentation.cxx [new file with mode: 0644]
src/PDataXtd/PDataXtd_Presentation_1.cdl [new file with mode: 0644]
src/PDataXtd/PDataXtd_Presentation_1.cxx [new file with mode: 0644]
src/PPrsStd/PPrsStd.cdl [deleted file]
src/PPrsStd/PPrsStd_AISPresentation.cdl [deleted file]
src/PPrsStd/PPrsStd_AISPresentation.cxx [deleted file]
src/PPrsStd/PPrsStd_AISPresentation_1.cdl [deleted file]
src/PPrsStd/PPrsStd_AISPresentation_1.cxx [deleted file]
src/QABugs/QABugs_11.cxx
src/QABugs/QABugs_19.cxx
src/Standard/FILES
src/Standard/Standard.cdl
src/Standard/Standard_FStream.hxx [new file with mode: 0644]
src/Standard/Standard_IStreamPtr.hxx [new file with mode: 0644]
src/Standard/Standard_OStreamPtr.hxx [new file with mode: 0644]
src/StdDrivers/StdDrivers_DocumentRetrievalDriver.cxx
src/StdDrivers/StdDrivers_DocumentStorageDriver.cxx
src/StdSchema/StdSchema.cdl
src/Storage/Storage.cdl
src/Storage/Storage_BaseDriver.cdl
src/Storage/Storage_BaseDriver.cxx
src/Storage/Storage_BaseDriver.lxx
src/Storage/Storage_File.cdl [new file with mode: 0644]
src/Storage/Storage_File.cxx [new file with mode: 0644]
src/Storage/Storage_IODevice.cdl [new file with mode: 0644]
src/Storage/Storage_IODevice.cxx [new file with mode: 0644]
src/Storage/Storage_IODevice.lxx [new file with mode: 0644]
src/Storage/Storage_IStream.cdl [new file with mode: 0644]
src/Storage/Storage_IStream.cxx [new file with mode: 0644]
src/Storage/Storage_OStream.cdl [new file with mode: 0644]
src/Storage/Storage_OStream.cxx [new file with mode: 0644]
src/TDataXtd/TDataXtd.cdl
src/TDataXtd/TDataXtd_Presentation.cdl [new file with mode: 0644]
src/TDataXtd/TDataXtd_Presentation.cxx [new file with mode: 0644]
src/TDocStd/TDocStd.cdl
src/TDocStd/TDocStd_Application.cdl
src/TDocStd/TDocStd_Application.cxx
src/TDocStd/TDocStd_Document.cxx
src/TKBin/EXTERNLIB
src/TKBin/PACKAGES
src/TKCAF/EXTERNLIB
src/TKCAF/PACKAGES
src/TKDCAF/EXTERNLIB
src/TKPCAF/EXTERNLIB
src/TKPCAF/PACKAGES
src/TKQADraw/EXTERNLIB
src/TKVCAF/EXTERNLIB [new file with mode: 0644]
src/TKVCAF/FILES [new file with mode: 0644]
src/TKVCAF/PACKAGES [new file with mode: 0644]
src/TKVRML/EXTERNLIB
src/TKXCAF/EXTERNLIB
src/TKXDEDRAW/EXTERNLIB
src/TKXml/EXTERNLIB
src/TKXml/PACKAGES
src/TPrsStd/GUID.txt
src/TPrsStd/TPrsStd_AISPresentation.cdl
src/TPrsStd/TPrsStd_AISPresentation.cxx
src/TPrsStd/TPrsStd_AISViewer.cxx
src/UTL/UTL.cdl
src/UTL/UTL.cxx
src/XmlDrivers/XmlDrivers.cxx
src/XmlLDrivers/XmlLDrivers.cdl
src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cdl
src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx
src/XmlLDrivers/XmlLDrivers_DocumentStorageDriver.cdl
src/XmlLDrivers/XmlLDrivers_DocumentStorageDriver.cxx
src/XmlMDataXtd/XmlMDataXtd.cdl
src/XmlMDataXtd/XmlMDataXtd.cxx
src/XmlMDataXtd/XmlMDataXtd_PositionDriver.cdl [new file with mode: 0644]
src/XmlMDataXtd/XmlMDataXtd_PositionDriver.cxx [new file with mode: 0644]
src/XmlMDataXtd/XmlMDataXtd_PresentationDriver.cdl [new file with mode: 0644]
src/XmlMDataXtd/XmlMDataXtd_PresentationDriver.cxx [new file with mode: 0644]
src/XmlMPrsStd/XmlMPrsStd.cdl [deleted file]
src/XmlMPrsStd/XmlMPrsStd.cxx [deleted file]
src/XmlMPrsStd/XmlMPrsStd_AISPresentationDriver.cdl [deleted file]
src/XmlMPrsStd/XmlMPrsStd_AISPresentationDriver.cxx [deleted file]
src/XmlMPrsStd/XmlMPrsStd_PositionDriver.cdl [deleted file]
src/XmlMPrsStd/XmlMPrsStd_PositionDriver.cxx [deleted file]

index be32f80619fdc94cc725faaefe0dda038dbefbd6..2340b5c4f248979f9ea84ac5ab118ad548dec47e 100644 (file)
@@ -240,7 +240,6 @@ p BinMDataXtd
 p BinMDocStd
 p BinMFunction
 p BinMNaming
-p BinMPrsStd
 p BinObjMgt
 p BinTools
 p CDF
@@ -253,7 +252,6 @@ p MDataXtd
 p MDocStd
 p MFunction
 p MNaming
-p MPrsStd
 p MgtBRep
 p MgtGeom
 p MgtGeom2d
@@ -277,7 +275,6 @@ p PGeom2d
 p PMMgt
 p PNaming
 p PPoly
-p PPrsStd
 p PShort
 p PStandard
 p PTColStd
@@ -301,7 +298,6 @@ p XmlMDataXtd
 p XmlMDocStd
 p XmlMFunction
 p XmlMNaming
-p XmlMPrsStd
 p XmlObjMgt
 r StdResource
 r XmlOcafResource
@@ -318,6 +314,7 @@ t TKCDF
 t TKLCAF
 t TKPCAF
 t TKPLCAF
+t TKVCAF
 t TKPShape
 t TKShapeSchema
 t TKStdLSchema
index 6fe301780ed9f21a9950240f05d2109e6d903f55..25cbde24ec9bab9ab1985207e57f33c7f26ecf35 100644 (file)
@@ -21,7 +21,6 @@
 #include <BinMNaming.hxx>
 #include <BinMDocStd.hxx>
 #include <BinMFunction.hxx>
-#include <BinMPrsStd.hxx>
 #include <Standard_Failure.hxx>
 #include <BinDrivers_DocumentStorageDriver.hxx>
 #include <BinDrivers_DocumentRetrievalDriver.hxx>
@@ -76,7 +75,6 @@ Handle(BinMDF_ADriverTable) BinDrivers::AttributeDrivers
   BinMNaming    ::AddDrivers (aTable, aMsgDrv);
   BinMDocStd    ::AddDrivers (aTable, aMsgDrv);
   BinMFunction  ::AddDrivers (aTable, aMsgDrv);
-  BinMPrsStd    ::AddDrivers (aTable, aMsgDrv);
   return aTable;
 }
 
index 60c8e223f5bc3ed3fd4dc5b3a6b0c88b053fb0a7..4adc416be7ab8f575be19d9587cd9d50289b8579 100644 (file)
@@ -20,7 +20,8 @@ uses
     ADriverTable     from BinMDF, 
     Position         from Storage, 
     IStream          from Standard, 
-    DocumentSection from BinLDrivers 
+    DocumentSection  from BinLDrivers ,
+    IODevice         from Storage
     
 is
     -- ===== Public methods =====
@@ -34,12 +35,12 @@ is
 
     ReadShapeSection (me: mutable;
                       theSection : in out DocumentSection from BinLDrivers;
-                      theIS      : in out IStream from Standard
-                     isMess     : Boolean from Standard = Standard_False) is redefined virtual;  
+                      theDevice  : IODevice from Storage
+                         isMess     : Boolean from Standard = Standard_False) is redefined virtual;  
                       
     CheckShapeSection (me: mutable;
-                      thePos : Position from Storage;
-                      theIS  : in out IStream from Standard) is redefined virtual
+                      thePos    : Position from Storage;
+                      theDevice : IODevice from Storage) is redefined virtual protected
                       
     PropagateDocumentVersion(me: mutable; theVersion : Integer from Standard) 
        is redefined  virtual;                
index 7adbec2dc3606381ac9b67c2a30d95bc839e8a7e..5615d4648e8835c845b02e830d78f07035ee9dd5 100644 (file)
@@ -24,6 +24,9 @@
 #include <Standard_Failure.hxx>
 #include <Standard_IStream.hxx>
 #include <Standard_ErrorHandler.hxx>
+
+#include <string>
+
 //=======================================================================
 //function : BinDrivers_DocumentRetrievalDriver
 //purpose  : Constructor
@@ -49,28 +52,44 @@ Handle(BinMDF_ADriverTable) BinDrivers_DocumentRetrievalDriver::AttributeDrivers
 //purpose  : 
 //=======================================================================
 
-void BinDrivers_DocumentRetrievalDriver::ReadShapeSection
-                              (BinLDrivers_DocumentSection& /*theSection*/,
-                               Standard_IStream&            theIS,
-                              const Standard_Boolean       /*isMess*/)
+void BinDrivers_DocumentRetrievalDriver::ReadShapeSection( BinLDrivers_DocumentSection& theSection,
+                                                           const Handle(Storage_IODevice)& theDevice,
+                                                           const Standard_Boolean /*isMess*/)
 
 {
   // Read Shapes
+  Standard_Character* aBuf = 0;
   Handle(BinMNaming_NamedShapeDriver) aNamedShapeDriver;
-  if (myDrivers->GetDriver(STANDARD_TYPE(TNaming_NamedShape),aNamedShapeDriver))
-    {
-      try {
-       OCC_CATCH_SIGNALS
-         aNamedShapeDriver->ReadShapeSection (theIS);
+  if (myDrivers->GetDriver(STANDARD_TYPE(TNaming_NamedShape), aNamedShapeDriver))
+  {
+    try {
+      OCC_CATCH_SIGNALS
+
+      aBuf = (Standard_Character*)malloc( theSection.Length() + 1 );
+      Standard_Size aSize = theDevice->Read( (Standard_Address)aBuf, theSection.Length() );
+      if ( aSize == theSection.Length() )
+      {
+          Standard_SStream aStrStream( std::string( aBuf, aSize ), Standard_SStream::in | Standard_SStream::binary );
+          aNamedShapeDriver->ReadShapeSection( aStrStream );
       }
-      catch(Standard_Failure) {
-       Handle(Standard_Failure) aFailure = Standard_Failure::Caught();
-       const TCollection_ExtendedString aMethStr
-         ("BinDrivers_DocumentRetrievalDriver: ");
-       WriteMessage (aMethStr + "error of Shape Section " +
-                     aFailure->GetMessageString());
+      else
+        WriteMessage( "BinDrivers_DocumentRetrievalDriver: can't read all shape section data." );
+    }
+    catch(Standard_Failure) {
+      if ( aBuf )
+      {
+        free( aBuf );
+        aBuf = 0;
       }
+
+      Handle(Standard_Failure) aFailure = Standard_Failure::Caught();
+      const TCollection_ExtendedString aMethStr ("BinDrivers_DocumentRetrievalDriver: ");
+      WriteMessage (aMethStr + "error of Shape Section " +
+      aFailure->GetMessageString());
     }
+  }
+  if ( aBuf )
+    free( aBuf );
 }
 
 //=======================================================================
@@ -78,8 +97,8 @@ void BinDrivers_DocumentRetrievalDriver::ReadShapeSection
 //purpose  : 
 //=======================================================================
 void BinDrivers_DocumentRetrievalDriver::CheckShapeSection(
-                             const Storage_Position& /*ShapeSectionPos*/, 
-                                                Standard_IStream& /*IS*/)
+                                          const Storage_Position& /*ShapeSectionPos*/, 
+                                          const Handle(Storage_IODevice)& /*theDevice*/)
 {}
 
 //=======================================================================
index 8800cc9a7d933db79b5f063a2d5bbd463dc499ba..7be390ec207eed4367a14ecaa65700e6d386af35 100644 (file)
@@ -21,7 +21,8 @@ uses
     OStream          from Standard,
     MessageDriver    from CDM, 
     DocumentSection  from BinLDrivers,
-    ADriverTable     from BinMDF
+    ADriverTable     from BinMDF,
+    IODevice         from Storage
 is
     -- ===== Public methods =====
 
@@ -34,7 +35,7 @@ is
        is redefined virtual; 
         
     WriteShapeSection    (me: mutable; theDocSection : in out DocumentSection from BinLDrivers;
-                                       theOS         : in out OStream from Standard)
+                                       theDevice     : IODevice from Storage)
         is redefined  virtual; 
         ---Purpose: implements the procedure of writing a shape section to file        
 
index 94960740c3bec9d1a64d5d4d32b0e1a306cbecc2..5f45e930c7a3c6442249688109951d43d2248fd8 100644 (file)
 
 #include <BinDrivers_DocumentStorageDriver.ixx>
 #include <Standard_ErrorHandler.hxx>
+#include <Standard_SStream.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <BinDrivers.hxx>
 #include <BinMDF_ADriver.hxx>
 #include <BinMNaming_NamedShapeDriver.hxx>
 #include <TNaming_NamedShape.hxx>
+
+#include <string>
+
 //=======================================================================
 //function : BinDrivers_DocumentStorageDriver
 //purpose  : Constructor
@@ -45,25 +49,37 @@ Handle(BinMDF_ADriverTable) BinDrivers_DocumentStorageDriver::AttributeDrivers
 //purpose  : Implements WriteShapeSection
 //=======================================================================
 void BinDrivers_DocumentStorageDriver::WriteShapeSection
-                               (BinLDrivers_DocumentSection&   theSection,
-                                Standard_OStream&              theOS)
+                               (BinLDrivers_DocumentSection&    theSection,
+                                const Handle(Storage_IODevice)& theDevice)
 {
-  const Standard_Size aShapesSectionOffset = (Standard_Size) theOS.tellp();
+  if (!theDevice->CanWrite())
+  {
+    return;
+  }
+
+  const Standard_Size aShapesSectionOffset = theDevice->Tell();
   
   Handle(BinMNaming_NamedShapeDriver) aNamedShapeDriver;
   if (myDrivers->GetDriver(STANDARD_TYPE(TNaming_NamedShape), aNamedShapeDriver)) {   
     try { 
-      OCC_CATCH_SIGNALS  aNamedShapeDriver->WriteShapeSection (theOS);
+      OCC_CATCH_SIGNALS
+
+      Standard_SStream aStrStream( Standard_SStream::out | Standard_SStream::binary );
+      aNamedShapeDriver->WriteShapeSection( aStrStream );
+
+      std::string aData = aStrStream.str();
+      Standard_Size aSize = theDevice->Write( (Standard_Address)aData.c_str(), aData.length() );
+      if ( aSize < aData.length() )
+        WriteMessage( "BinDrivers_DocumentRetrievalDriver: can't write all shape section data." );
     }
     catch(Standard_Failure) {
       TCollection_ExtendedString anErrorStr ("Error: ");
       Handle(Standard_Failure) aFailure = Standard_Failure::Caught();
-      TCollection_ExtendedString aStr = 
-       anErrorStr + "BinDrivers_DocumentStorageDriver, Shape Section :";
+      TCollection_ExtendedString aStr = anErrorStr + "BinDrivers_DocumentStorageDriver, Shape Section :";
       WriteMessage (aStr  + aFailure->GetMessageString());
     }
   }
    
   // Write the section info in the TOC.
-  theSection.Write (theOS, aShapesSectionOffset);
+  theSection.Write (theDevice, aShapesSectionOffset);
 }
index ef1efd164dcfaee51de83cb4e116d41300fcc650..41b5a11d282216d80cbb4ff79388442bbe82d4d5 100644 (file)
@@ -74,7 +74,6 @@ Handle(BinMDF_ADriverTable) BinLDrivers::AttributeDrivers
   BinMDocStd    ::AddDrivers (aTable, aMsgDrv);
 
 //  BinMNaming    ::AddDrivers (aTable, aMsgDrv);
-//  BinMPrsStd    ::AddDrivers (aTable, aMsgDrv);
   return aTable;
 }
 
index dc67cc2536710a892f41561fbbea001f7f291eda..70cb5e80e29d45be8f8a28a7bdd89390782ee386 100644 (file)
@@ -29,6 +29,7 @@ uses
     Persistent                  from BinObjMgt,
     Label                       from TDF,
     IStream                     from Standard,
+    IODevice                    from Storage,
     MapOfInteger                from TColStd,
     DocumentSection             from BinLDrivers,
     VectorOfDocumentSection     from BinLDrivers
@@ -52,7 +53,7 @@ is
         returns Document from CDM is redefined virtual;
         ---Purpose: pure virtual method definition
 
-    Read(me:mutable; theFileName:    ExtendedString from TCollection;
+    Read(me:mutable; theDevice: IODevice from Storage;
                      theNewDocument: Document    from CDM;
                      theApplication: Application from CDM) is redefined virtual;
         ---Purpose: retrieves the content of the file into a new Document.
@@ -63,14 +64,14 @@ is
 
     -- ===== Protected methods =====
 
-    ReadSubTree (me: mutable; theIS   : in out IStream from Standard;
+    ReadSubTree (me: mutable; theDevice: IODevice from Storage;
                               theData : Label from TDF)
         returns Integer from Standard
         is virtual protected;
         ---Purpose: Read the tree from the stream <theIS> to <theLabel>
 
-    ReadInfoSection(me: mutable; theFile : AsciiString from TCollection;
-                                 theData : in out HeaderData from Storage)
+    ReadInfoSection(me: mutable; theDevice: IODevice from Storage;
+                                 theData  : in out HeaderData from Storage)
         returns Position from Storage is protected;
         ---Purpose: Read the  info  section  of  theFile into theData,
         --          return a file  position  corresponding to the info
@@ -79,19 +80,19 @@ is
     ReadSection    (me: mutable;
                     theSection : in out DocumentSection from BinLDrivers;
                     theDoc     : Document    from CDM;
-                    theIS      : in out IStream from Standard)
+                    theDevice  : IODevice from Storage)
         is virtual protected; 
         ---Purpose: define the procedure of reading a section to file.
 
     ReadShapeSection (me: mutable;
                       theSection : in out DocumentSection from BinLDrivers;
-                      theIS      : in out IStream from Standard
-                     isMess     : Boolean from Standard = Standard_False)
+                      theDevice: IODevice from Storage
+                      isMess     : Boolean from Standard = Standard_False)
         is virtual protected; 
        
     CheckShapeSection (me: mutable;
-                      thePos : Position from Storage;
-                      theIS  : in out IStream from Standard)
+                   thePos : Position from Storage;
+                   theDevice: IODevice from Storage)
         is virtual protected; 
         
     PropagateDocumentVersion(me: mutable; theVersion : Integer from Standard) 
index 9c3781c785b3c12c47a29dfbf3ef67c2a235aac9..54d6bfad6ec1fcf192a653679a503ac61f10d9e0 100644 (file)
@@ -82,10 +82,9 @@ void BinLDrivers_DocumentRetrievalDriver::Make (const Handle(PCDM_Document)&,
 #define START_TYPES "START_TYPES"
 #define END_TYPES "END_TYPES"
 
-void BinLDrivers_DocumentRetrievalDriver::Read
-                         (const TCollection_ExtendedString& theFileName,
-                          const Handle(CDM_Document)&       theNewDocument,
-                          const Handle(CDM_Application)&    theApplication)
+void BinLDrivers_DocumentRetrievalDriver::Read (const Handle(Storage_IODevice)&   theDevice,
+                                                const Handle(CDM_Document)&       theNewDocument,
+                                                const Handle(CDM_Application)&    theApplication)
 {
   myReaderStatus = PCDM_RS_DriverFailure;
   myMsgDriver = theApplication -> MessageDriver();
@@ -103,11 +102,9 @@ void BinLDrivers_DocumentRetrievalDriver::Read
     return;
   }
 
-  TCollection_AsciiString aFileName (theFileName);
-
   // 1. Read the information section
   Handle(Storage_HeaderData) aHeaderData;
-  Storage_Position anInfoSectionEnd = ReadInfoSection( aFileName, aHeaderData );
+  Storage_Position anInfoSectionEnd = ReadInfoSection( theDevice, aHeaderData );
   if (!anInfoSectionEnd) {
     WriteMessage (aMethStr + "error: file has invalid header");
     myReaderStatus = PCDM_RS_UnrecognizedFileFormat;
@@ -178,22 +175,24 @@ void BinLDrivers_DocumentRetrievalDriver::Read
        WriteMessage (aTypeNames(i));
   }
 
+  theDevice->Open (Storage_VSRead);
+
   // Open the file stream
-#ifdef _WIN32
-  ifstream anIS ((const wchar_t*) theFileName.ToExtString(), ios::in | ios::binary);
-#else
-  ifstream anIS (aFileName.ToCString());
-#endif
+//#ifdef _WIN32
+//  ifstream anIS ((const wchar_t*) theFileName.ToExtString(), ios::in | ios::binary);
+//#else
+//  ifstream anIS (aFileName.ToCString());
+//#endif
 
-  if (!anIS) {
+  if (!theDevice->CanRead()) {
     // Can not open file
-    WriteMessage (aMethStr + "error: can't open file " + theFileName);
+    WriteMessage (aMethStr + "error: can't read " + theDevice->Name());
     myReaderStatus = PCDM_RS_OpenError;
     return;
   }
 
   // skip info section
-  anIS.seekg( (streampos) anInfoSectionEnd );
+  theDevice->Seek ((streampos) anInfoSectionEnd);
 
   // propagate the opened document version to data drivers
   PropagateDocumentVersion(aFileVer);
@@ -211,30 +210,30 @@ void BinLDrivers_DocumentRetrievalDriver::Read
   if (aFileVer >= 3) {
     BinLDrivers_DocumentSection aSection;
     do {
-      BinLDrivers_DocumentSection::ReadTOC (aSection, anIS);
+      BinLDrivers_DocumentSection::ReadTOC (aSection, theDevice);
       mySections.Append(aSection);
     } while
       (!aSection.Name().IsEqual((Standard_CString)SHAPESECTION_POS));
-    aDocumentPos = anIS.tellg(); // position of root label
+    aDocumentPos = theDevice->Tell(); // position of root label
 
     BinLDrivers_VectorOfDocumentSection::Iterator anIterS (mySections);
     for (; anIterS.More(); anIterS.Next()) {
       BinLDrivers_DocumentSection& aCurSection = anIterS.ChangeValue();
       if (aCurSection.IsPostRead() == Standard_False) {
-        anIS.seekg ((streampos) aCurSection.Offset());
+        theDevice->Seek((streampos) aCurSection.Offset());
         if (aCurSection.Name().IsEqual ((Standard_CString)SHAPESECTION_POS)) 
-          ReadShapeSection (aCurSection, anIS);
+          ReadShapeSection (aCurSection, theDevice);
         else
-          ReadSection (aCurSection, theNewDocument, anIS); 
+          ReadSection (aCurSection, theNewDocument, theDevice); 
       }
     }
   } else { //aFileVer < 3
-    aDocumentPos = anIS.tellg(); // position of root label
+    aDocumentPos = theDevice->Tell(); // position of root label
 
     // retrieve SHAPESECTION_POS string
     char aShapeSecLabel[SIZEOFSHAPELABEL + 1];
     aShapeSecLabel[SIZEOFSHAPELABEL] = 0x00;
-    anIS.read ((char*)&aShapeSecLabel, SIZEOFSHAPELABEL);// SHAPESECTION_POS
+    theDevice->Read ((char*)&aShapeSecLabel, SIZEOFSHAPELABEL);// SHAPESECTION_POS
     TCollection_AsciiString aShapeLabel(aShapeSecLabel);
     // detect if a file was written in old fashion (version 2 without shapes)
     // and if so then skip reading ShapeSection
@@ -248,7 +247,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read
 
       // retrieve ShapeSection Position
       Standard_Integer aShapeSectionPos; // go to ShapeSection
-      anIS.read ((char*)&aShapeSectionPos, sizeof(Standard_Integer));
+      theDevice->Read ((char*)&aShapeSectionPos, sizeof(Standard_Integer));
 
 #if DO_INVERSE
       aShapeSectionPos = InverseInt (aShapeSectionPos);
@@ -257,26 +256,26 @@ void BinLDrivers_DocumentRetrievalDriver::Read
       cout <<"aShapeSectionPos = " <<aShapeSectionPos <<endl;
 #endif
       if(aShapeSectionPos) { 
-       aDocumentPos = anIS.tellg();
-       anIS.seekg((streampos) aShapeSectionPos);
+       aDocumentPos = theDevice->Tell();
+       theDevice->Seek ((streampos) aShapeSectionPos);
 
-       CheckShapeSection(aShapeSectionPos, anIS);
+       //CheckShapeSection(aShapeSectionPos, theDevice);
        // Read Shapes
        BinLDrivers_DocumentSection aCurSection;
-       ReadShapeSection (aCurSection, anIS, Standard_False);
+       ReadShapeSection (aCurSection, theDevice, Standard_False);
       }
     }
   } // end of reading Sections or shape section
 
   // Return to read of the Document structure
-  anIS.seekg(aDocumentPos);
+  theDevice->Seek (aDocumentPos);
 
   // read the header (tag) of the root label
   Standard_Integer aTag;
-  anIS.read ((char*)&aTag, sizeof(Standard_Integer));
+  theDevice->Read ((char*)&aTag, sizeof(Standard_Integer));
 
   // read sub-tree of the root label
-  Standard_Integer nbRead = ReadSubTree (anIS, aData->Root());
+  Standard_Integer nbRead = ReadSubTree (theDevice, aData->Root());
   myPAtt.Destroy();    // free buffer
   myRelocTable.Clear();
   myMapUnsupported.Clear();
@@ -295,8 +294,8 @@ void BinLDrivers_DocumentRetrievalDriver::Read
     for (; anIterS.More(); anIterS.Next()) {
       BinLDrivers_DocumentSection& aCurSection = anIterS.ChangeValue();
       if (aCurSection.IsPostRead()) {
-       anIS.seekg ((streampos) aCurSection.Offset());
-       ReadSection (aCurSection, theNewDocument, anIS); 
+       theDevice->Seek ((streampos) aCurSection.Offset());
+       ReadSection (aCurSection, theNewDocument, theDevice); 
       }
     }
   }
@@ -308,7 +307,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read
 //=======================================================================
 
 Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
-                         (Standard_IStream& theIS,
+                         (const Handle(Storage_IODevice)&   theDevice,
                           const TDF_Label&  theLabel)
 {
   Standard_Integer nbRead = 0;
@@ -316,9 +315,12 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
     ("BinLDrivers_DocumentRetrievalDriver: ");
 
   // Read attributes:
-  theIS >> myPAtt;
-  while (theIS && myPAtt.TypeId() > 0 &&             // not an end marker ?
-         myPAtt.Id() > 0) {                          // not a garbage ?
+  myPAtt.Read (theDevice); 
+
+  while (theDevice->CanRead()
+      && myPAtt.TypeId() > 0              // not an end marker ?
+      && myPAtt.Id() > 0)                // not a garbage ?
+  {
     // get a driver according to TypeId
     Handle(BinMDF_ADriver) aDriver = myDrivers->GetDriver (myPAtt.TypeId());
     if (!aDriver.IsNull()) {
@@ -352,9 +354,9 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
                     + myPAtt.TypeId());
 
     // read next attribute
-    theIS >> myPAtt;
-  }
-  if (!theIS || myPAtt.TypeId() != BinLDrivers_ENDATTRLIST) {
+    myPAtt.Read (theDevice);
+      }
+  if (!theDevice->CanRead() || myPAtt.TypeId() != BinLDrivers_ENDATTRLIST) {
     // unexpected EOF or garbage data
     WriteMessage (aMethStr + "error: unexpected EOF or garbage data");
     myReaderStatus = PCDM_RS_UnrecognizedFileFormat;
@@ -364,23 +366,23 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
   // Read children:
   // read the tag of a child label
   Standard_Integer aTag = BinLDrivers_ENDLABEL;
-  theIS.read ((char*) &aTag, sizeof(Standard_Integer));
+  theDevice->Read ((char*) &aTag, sizeof(Standard_Integer));
 #if DO_INVERSE
   aTag = InverseInt (aTag);
 #endif
-  while (theIS && aTag >= 0) { // not an end marker ?
+  while (theDevice->CanRead() && aTag >= 0) { // not an end marker ?
     // create sub-label
     TDF_Label aLab = theLabel.FindChild (aTag, Standard_True);
 
     // read sub-tree
-    Standard_Integer nbSubRead = ReadSubTree(theIS, aLab);
+    Standard_Integer nbSubRead = ReadSubTree(theDevice, aLab);
     // check for error
     if (nbSubRead == -1)
       return -1;
     nbRead += nbSubRead;
 
     // read the tag of the next child
-    theIS.read ((char*) &aTag, sizeof(Standard_Integer));
+    theDevice->Read ((char*) &aTag, sizeof(Standard_Integer));
 #if DO_INVERSE
     aTag = InverseInt (aTag);
 #endif
@@ -413,7 +415,7 @@ Handle(BinMDF_ADriverTable) BinLDrivers_DocumentRetrievalDriver::AttributeDriver
 //=======================================================================
 
 Storage_Position BinLDrivers_DocumentRetrievalDriver::ReadInfoSection
-                         (const TCollection_AsciiString& theFileName,
+                         (const Handle(Storage_IODevice)& theDevice,
                           Handle(Storage_HeaderData)&    theData)
 {
   TCollection_ExtendedString aMsg
@@ -421,7 +423,7 @@ Storage_Position BinLDrivers_DocumentRetrievalDriver::ReadInfoSection
 
   FSD_BinaryFile aFileDriver;
   Storage_Position aPos = 0;
-  if (aFileDriver.Open( theFileName, Storage_VSRead ) == Storage_VSOk)
+  if (aFileDriver.Open( theDevice, Storage_VSRead ) == Storage_VSOk)
   {
     Storage_Schema aSchema;
     theData = aSchema.ReadHeaderSection( aFileDriver );
@@ -432,7 +434,7 @@ Storage_Position BinLDrivers_DocumentRetrievalDriver::ReadInfoSection
       WriteMessage( aMsg + theData->ErrorStatusExtension() );
   }
   else
-    WriteMessage( aMsg + "can not open file " + theFileName);
+    WriteMessage( aMsg + "can not open file " + theDevice->Name());
 
   aFileDriver.Close();
 
@@ -460,7 +462,7 @@ void BinLDrivers_DocumentRetrievalDriver::WriteMessage
 void BinLDrivers_DocumentRetrievalDriver::ReadSection
                                 (BinLDrivers_DocumentSection& /*theSection*/,
                                  const Handle(CDM_Document)&  /*theDocument*/,
-                                 Standard_IStream&            /*theIS*/)
+                                 const Handle(Storage_IODevice)&   /*theDevice*/)
 {
   // empty; should be redefined in subclasses
 }
@@ -472,7 +474,7 @@ void BinLDrivers_DocumentRetrievalDriver::ReadSection
 
 void BinLDrivers_DocumentRetrievalDriver::ReadShapeSection
                               (BinLDrivers_DocumentSection& theSection,
-                               Standard_IStream&            /*theIS*/,
+                               const Handle(Storage_IODevice)&   /*theDevice*/,
                               const Standard_Boolean isMess)
 
 {
@@ -487,20 +489,10 @@ void BinLDrivers_DocumentRetrievalDriver::ReadShapeSection
 //purpose  : 
 //=======================================================================
 void BinLDrivers_DocumentRetrievalDriver::CheckShapeSection(
-                                 const Storage_Position& ShapeSectionPos
-                                                   Standard_IStream& IS)
+                                            const Storage_Position&           /*ShapeSectionPos*/
+                                            const Handle(Storage_IODevice)&   /*theDevice*/)
 {
-  if (!IS.eof())
-  {
-    const std::streamoff endPos = IS.rdbuf()->pubseekoff(0L, std::ios_base::end, std::ios_base::in);
-#ifdef OCCT_DEBUG
-    cout << "endPos = " << endPos <<endl;
-#endif
-    if(ShapeSectionPos != endPos) {
-      const TCollection_ExtendedString aMethStr ("BinLDrivers_DocumentRetrievalDriver: ");
-      WriteMessage (aMethStr + "warning: Geometry is not supported by Lite schema. ");
-    }
-  }
+  
 }
 
 //=======================================================================
index 62fffd7d0f1509adf681a908d6ebd3c4b5ba65c3..de20773a177af1f8d6d7d2443d6acd9f6e0ca539 100644 (file)
@@ -20,7 +20,8 @@ class DocumentSection from BinLDrivers
 
 uses
     AsciiString      from TCollection,
-    Size             from Standard
+    Size             from Standard,
+    IODevice         from Storage
 
 is
     -- ===== Public methods =====
@@ -58,16 +59,16 @@ is
     SetLength   (me:in out; theLength: Size from Standard);
     ---Purpose: Set the length of the section in the persistent file
 
-    WriteTOC    (me: in out; theOS : in out OStream from Standard);
+    WriteTOC    (me: in out; theDevice : IODevice from Storage);
     ---Purpose: Create a Section entry in the Document TOC (list of sections)
 
-    Write       (me: in out; theOS : in out OStream from Standard;
+    Write       (me: in out; theDevice : IODevice from Storage;
                              theOffset: Size from Standard);
     ---Purpose: Save Offset and Length data into the Section entry
     --          in the Document TOC (list of sections)
 
     ReadTOC     (myclass; theSection: out DocumentSection from BinLDrivers;
-                          theIS : in out IStream from Standard);
+                          theDevice : IODevice from Storage);
     ---Purpose: Fill a DocumentSection instance from the data that are read
     --          from TOC.
 
index 85b5c02341c8c1972b904dd27f582f958eafb12b..7172921ddc07908051aeae086b4434b4f981f104 100644 (file)
@@ -16,6 +16,8 @@
 #include <BinLDrivers_DocumentSection.hxx>
 #include <FSD_FileHeader.hxx>
 
+#include <Storage_IODevice.hxx>
+
 //=======================================================================
 //function : BinLDrivers_DocumentSection
 //purpose  : Empty constructor
@@ -108,7 +110,7 @@ void BinLDrivers_DocumentSection::SetLength (const Standard_Size theLength)
 //purpose  : 
 //=======================================================================
 
-void BinLDrivers_DocumentSection::WriteTOC (Standard_OStream& theStream)
+void BinLDrivers_DocumentSection::WriteTOC (const Handle(Storage_IODevice)& theDevice)
 {
   char aBuf[512];
 
@@ -135,10 +137,10 @@ void BinLDrivers_DocumentSection::WriteTOC (Standard_OStream& theStream)
 #else
     aBufSz[0] = (Standard_Integer)aBufSize;
 #endif
-    theStream.write (&aBuf[0], aBufSize + sizeof(Standard_Integer));
+    theDevice->Write( (Standard_Address)&aBuf[0], aBufSize + sizeof(Standard_Integer) );
 
     // Store the address of Offset word in the file
-    myValue[0] = (Standard_Size) theStream.tellp();
+    myValue[0] = (Standard_Size) theDevice->Tell();
     myValue[1] = 0;
 
     // Write the placeholders of Offset and Length of the section that should
@@ -146,7 +148,7 @@ void BinLDrivers_DocumentSection::WriteTOC (Standard_OStream& theStream)
     aBufSz[0] = 0;
     aBufSz[1] = 0;
     aBufSz[2] = 0;
-    theStream.write (&aBuf[0], 3*sizeof(Standard_Integer));
+    theDevice->Write( (Standard_Address)&aBuf[0], 3*sizeof(Standard_Integer));
   }
 }
 
@@ -155,11 +157,11 @@ void BinLDrivers_DocumentSection::WriteTOC (Standard_OStream& theStream)
 //purpose  : 
 //=======================================================================
 
-void BinLDrivers_DocumentSection::Write (Standard_OStream&   theStream,
+void BinLDrivers_DocumentSection::Write (const Handle(Storage_IODevice)& theDevice,
                                          const Standard_Size theOffset)
 {
-  const Standard_Size aSectionEnd = (Standard_Size) theStream.tellp();
-  theStream.seekp(myValue[0]);
+  const Standard_Size aSectionEnd = (Standard_Size)theDevice->Tell();
+  theDevice->Seek(myValue[0]);
   myValue[0] = theOffset;
   myValue[1] = aSectionEnd - theOffset;
   Standard_Integer aVal[3] = {
@@ -173,8 +175,8 @@ void BinLDrivers_DocumentSection::Write (Standard_OStream&   theStream,
   aVal[2] = InverseSize(aVal[2]);
 #endif
 
-  theStream.write((char *)&aVal[0], 3*sizeof(Standard_Integer));
-  theStream.seekp(aSectionEnd);
+  theDevice->Write((Standard_Address)&aVal[0], 3*sizeof(Standard_Integer));
+  theDevice->Seek(aSectionEnd);
 }
 
 //=======================================================================
@@ -182,21 +184,20 @@ void BinLDrivers_DocumentSection::Write (Standard_OStream&   theStream,
 //purpose  : 
 //=======================================================================
 
-void BinLDrivers_DocumentSection::ReadTOC
-                                (BinLDrivers_DocumentSection& theSection,
-                                 Standard_IStream&            theStream)
+void BinLDrivers_DocumentSection::ReadTOC( BinLDrivers_DocumentSection& theSection,
+                                           const Handle(Storage_IODevice)& theDevice)
 {
   char aBuf[512];
   Standard_Integer aNameBufferSize;
-  theStream.read ((char *)&aNameBufferSize, sizeof(Standard_Integer));
+  theDevice->Read( (Standard_Address)&aNameBufferSize, sizeof(Standard_Integer) );
 #if DO_INVERSE
   aNameBufferSize = InverseSize(aNameBufferSize);
 #endif
   if (aNameBufferSize > 0) {
-    theStream.read ((char *)&aBuf[0], (Standard_Size)aNameBufferSize);
+    theDevice->Read ((char *)&aBuf[0], (Standard_Size)aNameBufferSize);
     theSection.myName = (Standard_CString)&aBuf[0];
     Standard_Integer aValue[3];
-    theStream.read ((char *)&aValue[0], 3*sizeof(Standard_Integer));
+    theDevice->Read ((char *)&aValue[0], 3*sizeof(Standard_Integer));
 #if DO_INVERSE
     aValue[0] = InverseSize (aValue[0]);
     aValue[1] = InverseSize (aValue[1]);
index 088f292142c70004a0ad8207c78b75ed34cdd2c5..1689dba533de7a3324805b2cd76d3cbc0f879d9e 100644 (file)
@@ -31,7 +31,8 @@ uses
     MapOfTransient              from TColStd,
     IndexedMapOfTransient       from TColStd,
     DocumentSection             from BinLDrivers,
-    VectorOfDocumentSection     from BinLDrivers
+    VectorOfDocumentSection     from BinLDrivers,
+    IODevice                    from Storage
 
 is
     -- ===== Public methods =====
@@ -43,7 +44,7 @@ is
         ---Purpose: pure virtual method definition
 
     Write (me: mutable; theDocument: Document from CDM;
-                        theFileName: ExtendedString from TCollection)
+                        theDevice: IODevice from Storage)
         is redefined virtual;
         ---Purpose: Write <theDocument> to the binary file <theFileName>
 
@@ -54,7 +55,7 @@ is
     -- ===== Protected methods =====
 
     WriteSubTree (me: mutable; theData  : Label from TDF;
-                               theOS    : in out OStream from Standard)
+                               theDevice: IODevice from Storage)
         is protected;
         ---Purpose: Write the tree under <theLabel> to the stream <theOS>
 
@@ -64,12 +65,12 @@ is
 
     WriteSection    (me: mutable; theName : AsciiString from TCollection;
                                   theDoc  : Document    from CDM;
-                                  theOS   : in out OStream from Standard)
+                                  theDevice: IODevice from Storage)
         is virtual protected; 
         ---Purpose: define the procedure of writing a section to file.  
        
     WriteShapeSection    (me: mutable; theDocSection : in out DocumentSection from BinLDrivers;
-                                       theOS         : in out OStream from Standard)
+                                       theDevice: IODevice from Storage)
         is virtual protected; 
         ---Purpose: defines the procedure of writing a shape  section to file 
        
@@ -82,7 +83,7 @@ is
         --          attributes to store
     
     WriteInfoSection(me: mutable; theDocument  : Document from CDM;
-                                  theFile      : AsciiString from TCollection)
+                                  theDevice: IODevice from Storage)
         is private;
         ---Purpose: Write info secton using FSD_BinaryFile driver
     
index 1599144851ad4ca2060aed4ba00d3d23bd2ea574..f4aeece7e51b9b0639a89a3554b8ca0a58b06937 100644 (file)
@@ -62,8 +62,8 @@ TCollection_ExtendedString BinLDrivers_DocumentStorageDriver::SchemaName() const
 //=======================================================================
 
 void BinLDrivers_DocumentStorageDriver::Write
-                          (const Handle(CDM_Document)&       theDocument,
-                           const TCollection_ExtendedString& theFileName)
+                          (const Handle(CDM_Document)&     theDocument,
+                           const Handle(Storage_IODevice)& theDevice)
 {
   SetIsError(Standard_False);
   SetStoreStatus(PCDM_SS_OK);
@@ -78,9 +78,6 @@ void BinLDrivers_DocumentStorageDriver::Write
     SetStoreStatus(PCDM_SS_Doc_IsNull);
   }
   else {
-    // Open the file
-    TCollection_AsciiString aFileName (theFileName);
-
     // First pass: collect empty labels, assign IDs to the types
     if (myDrivers.IsNull())
       myDrivers = AttributeDrivers (myMsgDriver);
@@ -88,7 +85,7 @@ void BinLDrivers_DocumentStorageDriver::Write
     FirstPass (aData->Root());
 
 //  1. Write info section (including types table)
-    WriteInfoSection(theDocument, aFileName);
+    WriteInfoSection(theDocument, theDevice);
     myTypesMap.Clear();
     if (IsError())
     {
@@ -96,31 +93,20 @@ void BinLDrivers_DocumentStorageDriver::Write
         return;
     }
 
-#if defined(_WIN32)
-    ofstream anOS ((const wchar_t*) theFileName.ToExtString(), ios::in | ios::binary | ios::ate);
-#elif !defined(IRIX) // 10.10.2005
-    ofstream anOS (aFileName.ToCString(), ios::in | ios::binary | ios::ate);
-#else
-    ofstream anOS (aFileName.ToCString(), ios::ate);
-    //ofstream anOS (aFileName.ToCString(), ios::out| ios::binary | ios::ate);
-#endif
-#ifdef OCCT_DEBUG
-    const Standard_Integer aP = (Standard_Integer) anOS.tellp();
-    cout << "POS = " << aP <<endl;
-#endif
-//#endif
+    theDevice->Open( Storage_VSAppend );
+    Standard_Size aP = theDevice->Tell();
 
-    if (anOS) {
+    if (theDevice->CanWrite()) {
 
 //  2. Write the Table of Contents of Sections
       BinLDrivers_VectorOfDocumentSection::Iterator anIterS (mySections);
       for (; anIterS.More(); anIterS.Next())
-        anIterS.ChangeValue().WriteTOC (anOS);
+        anIterS.ChangeValue().WriteTOC (theDevice);
 
       // Shapes Section is the last one, it indicates the end of the table.
       BinLDrivers_DocumentSection aShapesSection (SHAPESECTION_POS,
                                                   Standard_False);
-      aShapesSection.WriteTOC (anOS);
+      aShapesSection.WriteTOC (theDevice);
 
 //  3. Write document contents
       // (Storage data to the stream)
@@ -128,17 +114,17 @@ void BinLDrivers_DocumentStorageDriver::Write
       myPAtt.Init();
 
 //    Write Doc structure
-      WriteSubTree (aData->Root(), anOS); // Doc is written
+      WriteSubTree (aData->Root(), theDevice); // Doc is written
 
 //  4. Write Shapes section
-      WriteShapeSection(aShapesSection, anOS);
+      WriteShapeSection(aShapesSection, theDevice);
 
 // Write application-defined sections
       for (anIterS.Init (mySections); anIterS.More(); anIterS.Next()) {
         BinLDrivers_DocumentSection& aSection = anIterS.ChangeValue();
-        const Standard_Size aSectionOffset = (Standard_Size) anOS.tellp();
-        WriteSection (aSection.Name(), theDocument, anOS);
-        aSection.Write (anOS, aSectionOffset);
+        const Standard_Size aSectionOffset = (Standard_Size)theDevice->Tell();
+        WriteSection (aSection.Name(), theDocument, theDevice);
+        aSection.Write (theDevice, aSectionOffset);
       }
 
 // End of processing: close structures and check the status
@@ -157,17 +143,13 @@ void BinLDrivers_DocumentStorageDriver::Write
       myRelocTable.Clear();
     }
 
-    if (!anOS) {
-      // A problem with the stream
-#ifdef OCCT_DEBUG
-      TCollection_ExtendedString anErrorStr ("Error: ");
-      WriteMessage (anErrorStr + "BinLDrivers_DocumentStorageDriver, Problem with the file stream, rdstate="
-                    + (Standard_Integer )anOS.rdstate());
-#endif
+    if (!theDevice->CanWrite()) {
+      WriteMessage ("Error: BinLDrivers_DocumentStorageDriver, Problem with the file stream.") ;
       SetIsError(Standard_True);
       SetStoreStatus(PCDM_SS_WriteFailure);
     }
 
+    theDevice->Close();
   }
 }
 
@@ -196,9 +178,8 @@ void BinLDrivers_DocumentStorageDriver::UnsupportedAttrMsg
 //purpose  :
 //=======================================================================
 
-void BinLDrivers_DocumentStorageDriver::WriteSubTree
-                        (const TDF_Label&          theLabel,
-                         Standard_OStream&         theOS)
+void BinLDrivers_DocumentStorageDriver::WriteSubTree(const TDF_Label&          theLabel,
+                                                     const Handle(Storage_IODevice)& theDevice)
 {
   // Skip empty labels
   if (!myEmptyLabels.IsEmpty() && myEmptyLabels.First() == theLabel) {
@@ -211,11 +192,11 @@ void BinLDrivers_DocumentStorageDriver::WriteSubTree
 #if DO_INVERSE
   aTag = InverseInt (aTag);
 #endif
-  theOS.write ((char*)&aTag, sizeof(Standard_Integer));
+  theDevice->Write ((char*)&aTag, sizeof(Standard_Integer));
 
   // Write attributes
   TDF_AttributeIterator itAtt (theLabel);
-  for ( ; itAtt.More() && theOS; itAtt.Next()) {
+  for ( ; itAtt.More() && theDevice->CanWrite(); itAtt.Next()) {
     const Handle(TDF_Attribute)& tAtt = itAtt.Value();
     const Handle(Standard_Type)& aType = tAtt->DynamicType();
     // Get type ID and driver
@@ -231,14 +212,15 @@ void BinLDrivers_DocumentStorageDriver::WriteSubTree
       aDriver->Paste (tAtt, myPAtt, myRelocTable);
 
       // Write data to the stream -->!!!
-      theOS << myPAtt;
+      //theOS << myPAtt;
+      myPAtt.Write( theDevice );
     }
 #ifdef OCCT_DEBUG
     else
       UnsupportedAttrMsg (aType);
 #endif
   }
-  if (!theOS) {
+  if (!theDevice->CanWrite()) {
     // Problem with the stream
     return;
   }
@@ -248,14 +230,14 @@ void BinLDrivers_DocumentStorageDriver::WriteSubTree
 #if DO_INVERSE
   anEndAttr = (BinLDrivers_Marker) InverseInt (anEndAttr);
 #endif
-  theOS.write ((char*)&anEndAttr, sizeof(anEndAttr));
+  theDevice->Write ((char*)&anEndAttr, sizeof(anEndAttr));
 
   // Process sub-labels
   TDF_ChildIterator itChld (theLabel);
   for ( ; itChld.More(); itChld.Next())
   {
     const TDF_Label& aChildLab = itChld.Value();
-    WriteSubTree (aChildLab, theOS);
+    WriteSubTree (aChildLab, theDevice);
   }
 
   // Write the end label marker
@@ -263,8 +245,7 @@ void BinLDrivers_DocumentStorageDriver::WriteSubTree
 #if DO_INVERSE
   anEndLabel = (BinLDrivers_Marker) InverseInt (anEndLabel);
 #endif
-  theOS.write ((char*)&anEndLabel, sizeof(anEndLabel));
-
+  theDevice->Write( (Standard_Address)&anEndLabel, sizeof(anEndLabel));
 }
 
 //=======================================================================
@@ -352,13 +333,13 @@ void BinLDrivers_DocumentStorageDriver::FirstPass
 #define END_TYPES "END_TYPES"
 
 void BinLDrivers_DocumentStorageDriver::WriteInfoSection
-                         (const Handle(CDM_Document)&    theDocument,
-                          const TCollection_AsciiString& theFileName)
+                         (const Handle(CDM_Document)& theDocument,
+                         const Handle(Storage_IODevice)& theDevice)
 {
   FSD_BinaryFile aFileDriver;
-  if (aFileDriver.Open( theFileName, Storage_VSWrite ) != Storage_VSOk) {
-    WriteMessage (TCollection_ExtendedString("Error: Cannot open file ") +
-                  theFileName);
+  if (aFileDriver.Open( theDevice, Storage_VSWrite ) != Storage_VSOk) {
+    WriteMessage (TCollection_ExtendedString("Error: Cannot open the device ") +
+                  theDevice->Name());
     SetIsError(Standard_True);
     return;
   }
@@ -369,7 +350,7 @@ void BinLDrivers_DocumentStorageDriver::WriteInfoSection
     Handle(Storage_Data) theData = new Storage_Data;
     PCDM_ReadWriter::WriteFileFormat( theData, theDocument );
     PCDM_ReadWriter::Writer()->WriteReferenceCounter(theData,theDocument);
-    PCDM_ReadWriter::Writer()->WriteReferences(theData,theDocument,theFileName);
+    PCDM_ReadWriter::Writer()->WriteReferences(theData,theDocument,theDevice);
     PCDM_ReadWriter::Writer()->WriteExtensions(theData,theDocument);
     PCDM_ReadWriter::Writer()->WriteVersion(theData,theDocument);
 
@@ -414,7 +395,7 @@ void BinLDrivers_DocumentStorageDriver::WriteInfoSection
   }
   else {
     WriteMessage(TCollection_ExtendedString("Error: Problem writing header "
-                                            "into file ") + theFileName);
+                                            "into file ") + theDevice->Name());
     SetIsError(Standard_True);
   }
 #ifdef OCCT_DEBUG
@@ -455,9 +436,9 @@ void BinLDrivers_DocumentStorageDriver::AddSection
 //=======================================================================
 
 void BinLDrivers_DocumentStorageDriver::WriteSection
-                                (const TCollection_AsciiString& /*theName*/,
-                                 const Handle(CDM_Document)&     /*theDocument*/,
-                                 Standard_OStream&              /*theOS*/)
+                                (const TCollection_AsciiString&  /*theName*/,
+                                 const Handle(CDM_Document)&     /*theDoc*/,
+                                 const Handle(Storage_IODevice)& /*theDevice*/)
 {
   // empty; should be redefined in subclasses
 }
@@ -467,9 +448,12 @@ void BinLDrivers_DocumentStorageDriver::WriteSection
 //purpose  : defines WriteShapeSection
 //=======================================================================
 void BinLDrivers_DocumentStorageDriver::WriteShapeSection
-                                (BinLDrivers_DocumentSection&   theSection,
-                                 Standard_OStream&              theOS)
+                                (BinLDrivers_DocumentSection& theDocSection,
+                                const Handle(Storage_IODevice)& theDevice)
 {
-  const Standard_Size aShapesSectionOffset = (Standard_Size) theOS.tellp();
-  theSection.Write (theOS, aShapesSectionOffset);
+  if (theDevice->CanWrite())
+  {
+    const Standard_Size aShapesSectionOffset = theDevice->Tell();
+    theDocSection.Write (theDevice, aShapesSectionOffset);
+  }
 }
index 7bb68fffa4c165ecb51bcae3c5f47fb4c13ded8c..41f3c0d19ca58b6306ec5f891fe276e9c8787051 100644 (file)
@@ -43,6 +43,10 @@ is
     class PatternStdDriver;
 
     class ShapeDriver; 
+
+    class PresentationDriver;
+
+    class PositionDriver;
      
 
     AddDrivers (theDriverTable : ADriverTable  from BinMDF;
index 545ba817a4843af83a309842168b2e0edcaa9dce..f5b571fce358e71635e3459ab6bb5fa1ac4ce59e 100644 (file)
@@ -24,6 +24,8 @@
 #include <BinMDataXtd_AxisDriver.hxx>
 #include <BinMDataXtd_PlaneDriver.hxx>
 #include <BinMDataXtd_PlacementDriver.hxx>
+#include <BinMDataXtd_PresentationDriver.hxx>
+#include <BinMDataXtd_PositionDriver.hxx>
 
 static Standard_Integer myDocumentVersion = -1;
 //=======================================================================
@@ -42,6 +44,8 @@ void BinMDataXtd::AddDrivers (const Handle(BinMDF_ADriverTable)& theDriverTable,
   theDriverTable->AddDriver (new BinMDataXtd_AxisDriver        (theMsgDriver) );
   theDriverTable->AddDriver (new BinMDataXtd_PlaneDriver       (theMsgDriver) );
   theDriverTable->AddDriver (new BinMDataXtd_PlacementDriver   (theMsgDriver) );
+  theDriverTable->AddDriver (new BinMDataXtd_PresentationDriver(theMsgDriver) );
+  theDriverTable->AddDriver (new BinMDataXtd_PositionDriver    (theMsgDriver) );
 
 }
 
diff --git a/src/BinMDataXtd/BinMDataXtd_PositionDriver.cdl b/src/BinMDataXtd/BinMDataXtd_PositionDriver.cdl
new file mode 100644 (file)
index 0000000..938c5da
--- /dev/null
@@ -0,0 +1,43 @@
+-- Created on: 2004-05-17
+-- Created by: Sergey ZARITCHNY <szy@opencascade.com>
+-- Copyright (c) 2004-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class PositionDriver from BinMDataXtd inherits ADriver from BinMDF
+
+       ---Purpose: Position Attribute Driver.
+
+uses
+    SRelocationTable from BinObjMgt,
+    RRelocationTable from BinObjMgt,
+    Persistent       from BinObjMgt,
+    MessageDriver    from CDM,
+    Attribute        from TDF
+
+is
+
+    Create (theMessageDriver:MessageDriver from CDM)
+    returns PositionDriver from BinMDataXtd;
+
+    NewEmpty (me)  returns Attribute from TDF;
+
+    Paste(me; Source     : Persistent from BinObjMgt;
+              Target     : Attribute from TDF;
+              RelocTable : out RRelocationTable from BinObjMgt)
+        returns Boolean from Standard;
+
+    Paste(me; Source     : Attribute from TDF;
+              Target     : in out Persistent from BinObjMgt;
+              RelocTable : out SRelocationTable from BinObjMgt);
+
+end PositionDriver;
diff --git a/src/BinMDataXtd/BinMDataXtd_PositionDriver.cxx b/src/BinMDataXtd/BinMDataXtd_PositionDriver.cxx
new file mode 100644 (file)
index 0000000..bc87cc8
--- /dev/null
@@ -0,0 +1,88 @@
+// Created on: 2004-05-17
+// Created by: Sergey ZARITCHNY
+// Copyright (c) 2004-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+// modified     13.04.2009 Sergey ZARITCHNY
+
+#include <BinMDataXtd_PositionDriver.ixx>
+#include <gp_Pnt.hxx>
+#include <TDataXtd_Position.hxx>
+#include <CDM_MessageDriver.hxx>
+
+//=======================================================================
+//function : BinMDataStd_PositionDriver
+//purpose  : Constructor
+//=======================================================================
+
+BinMDataXtd_PositionDriver::BinMDataXtd_PositionDriver
+                        (const Handle(CDM_MessageDriver)& theMsgDriver)
+: BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataXtd_Position)->Name())
+{
+}
+
+//=======================================================================
+//function : NewEmpty
+//purpose  : 
+//=======================================================================
+
+Handle(TDF_Attribute) BinMDataXtd_PositionDriver::NewEmpty() const
+{
+  return new TDataXtd_Position();
+}
+
+//=======================================================================
+//function : Paste
+//purpose  : persistent -> transient (retrieve)
+//=======================================================================
+
+Standard_Boolean BinMDataXtd_PositionDriver::Paste
+                                (const BinObjMgt_Persistent&  theSource,
+                                 const Handle(TDF_Attribute)& theTarget,
+                                 BinObjMgt_RRelocationTable&  ) const
+{
+  Handle(TDataXtd_Position) anAtt = Handle(TDataXtd_Position)::DownCast(theTarget);
+  Standard_Real aValue;
+  Standard_Boolean ok = theSource >> aValue;
+  if (!ok) return ok;
+  gp_Pnt aPosition(0., 0., 0.);
+  aPosition.SetX(aValue);
+
+  ok = theSource >> aValue;
+  if (!ok) return ok;
+  aPosition.SetY(aValue);
+
+  ok = theSource >> aValue;
+  if (!ok) return ok;
+  aPosition.SetZ(aValue);
+
+  anAtt->SetPosition(aPosition);
+
+  return ok;
+}
+
+//=======================================================================
+//function : Paste
+//purpose  : transient -> persistent (store)
+//=======================================================================
+
+void BinMDataXtd_PositionDriver::Paste (const Handle(TDF_Attribute)& theSource,
+                                       BinObjMgt_Persistent&        theTarget,
+                                       BinObjMgt_SRelocationTable&  ) const
+{
+  Handle(TDataXtd_Position) anAtt = Handle(TDataXtd_Position)::DownCast(theSource);
+  
+  theTarget << anAtt->GetPosition().X();
+  theTarget << anAtt->GetPosition().Y();
+  theTarget << anAtt->GetPosition().Z();
+}
diff --git a/src/BinMDataXtd/BinMDataXtd_PresentationDriver.cdl b/src/BinMDataXtd/BinMDataXtd_PresentationDriver.cdl
new file mode 100644 (file)
index 0000000..cfd57e2
--- /dev/null
@@ -0,0 +1,44 @@
+-- Created on: 2004-05-17
+-- Created by: Sergey ZARITCHNY <szy@opencascade.com>
+-- Copyright (c) 2004-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class PresentationDriver from BinMDataXtd inherits ADriver from BinMDF
+
+       ---Purpose: Presentation Attribute Driver.
+
+uses
+    SRelocationTable from BinObjMgt,
+    RRelocationTable from BinObjMgt,
+    Persistent       from BinObjMgt,
+    MessageDriver    from CDM,
+    Attribute        from TDF
+
+is
+
+    Create (theMessageDriver:MessageDriver from CDM)
+        returns PresentationDriver from BinMDataXtd;
+
+    NewEmpty (me)  returns Attribute from TDF;
+
+    Paste(me; Source     : Persistent from BinObjMgt;
+              Target     : Attribute from TDF;
+              RelocTable : out RRelocationTable from BinObjMgt)
+    returns Boolean from Standard;
+
+    Paste(me; Source     : Attribute from TDF;
+              Target     : in out Persistent from BinObjMgt;
+              RelocTable : out SRelocationTable from BinObjMgt);
+
+
+end PresentationDriver;
diff --git a/src/BinMDataXtd/BinMDataXtd_PresentationDriver.cxx b/src/BinMDataXtd/BinMDataXtd_PresentationDriver.cxx
new file mode 100644 (file)
index 0000000..5332009
--- /dev/null
@@ -0,0 +1,155 @@
+// Created on: 2004-05-17
+// Created by: Sergey ZARITCHNY
+// Copyright (c) 2004-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <BinMDataXtd_PresentationDriver.ixx>
+#include <TDataXtd_Presentation.hxx>
+#include <CDM_MessageDriver.hxx>
+
+//=======================================================================
+//function : BinMDataStd_AISPresentationDriver
+//purpose  : Constructor
+//=======================================================================
+BinMDataXtd_PresentationDriver::BinMDataXtd_PresentationDriver
+                          (const Handle(CDM_MessageDriver)& theMsgDriver)
+: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(TDataXtd_Presentation)->Name())
+{
+}
+
+//=======================================================================
+//function : NewEmpty
+//purpose  : 
+//=======================================================================
+
+Handle(TDF_Attribute) BinMDataXtd_PresentationDriver::NewEmpty() const
+{
+  return new TDataXtd_Presentation();
+}
+
+//=======================================================================
+//function : Paste
+//purpose  : persistent -> transient (retrieve)
+//=======================================================================
+
+Standard_Boolean BinMDataXtd_PresentationDriver::Paste
+                                  (const BinObjMgt_Persistent&  theSource,
+                                   const Handle(TDF_Attribute)& theTarget,
+                                   BinObjMgt_RRelocationTable&  /*theRT*/) const
+{
+  Standard_Boolean ok = Standard_False;
+  Handle(TDataXtd_Presentation) anAttribute = Handle(TDataXtd_Presentation)::DownCast(theTarget);
+
+  // Display status
+  Standard_Integer aValue;
+  ok = theSource >> aValue;
+  if (!ok) return ok;
+  anAttribute->SetDisplayed(static_cast<Standard_Boolean>(aValue));
+
+  // GUID
+  Standard_GUID aGUID;
+  ok = theSource >> aGUID;
+  if (!ok) return ok;
+  anAttribute->SetDriverGUID(aGUID);
+
+  // Color
+  ok = theSource >> aValue;
+  if (!ok) return ok;
+  if ( aValue != -1 )
+    anAttribute->SetColor(aValue);
+  else
+    anAttribute->UnsetColor();
+
+  // Material
+  ok = theSource >> aValue;
+  if ( !ok ) return ok;
+  if (aValue != -1)
+    anAttribute->SetMaterial(aValue);
+  else
+    anAttribute->UnsetMaterial();
+
+  // Transparency
+  Standard_Real aRValue;
+  ok = theSource >> aRValue;
+  if ( !ok ) return ok;
+  if ( aRValue != -1. )
+    anAttribute->SetTransparency(aRValue);
+  else
+    anAttribute->UnsetTransparency();
+
+  // Width
+  ok = theSource >> aRValue;
+  if ( !ok ) return ok;
+  if ( aRValue != -1. )
+    anAttribute->SetWidth(aRValue);
+  else
+    anAttribute->UnsetWidth();
+
+  // Mode
+  ok = theSource >> aValue;
+  if ( !ok ) return ok;
+  if ( aValue != -1 )
+    anAttribute->SetMode(aValue);
+  else
+    anAttribute->UnsetMode();
+
+  return ok;
+}
+
+//=======================================================================
+//function : Paste
+//purpose  : transient -> persistent (store)
+//=======================================================================
+
+void BinMDataXtd_PresentationDriver::Paste(const Handle(TDF_Attribute)& theSource,
+                                           BinObjMgt_Persistent&        theTarget,
+                                           BinObjMgt_SRelocationTable&  /*theSRT*/) const
+{
+  Handle(TDataXtd_Presentation) anAttribute = Handle(TDataXtd_Presentation)::DownCast(theSource);
+
+  // Display status
+  theTarget.PutBoolean(anAttribute->IsDisplayed());
+
+  // GUID
+  theTarget.PutGUID(anAttribute->GetDriverGUID());
+
+  // Color
+  if (anAttribute->IsHasOwnColor())
+    theTarget.PutInteger(anAttribute->Color());
+  else
+    theTarget.PutInteger(-1);
+
+  // Material
+  if (anAttribute->IsHasOwnMaterial())
+    theTarget.PutInteger(anAttribute->Material());
+  else
+    theTarget.PutInteger(-1);
+
+  // Transparency
+  if (anAttribute->IsHasOwnTransparency())
+    theTarget.PutReal(anAttribute->Transparency());
+  else
+    theTarget.PutReal(-1.);
+
+  // Width
+  if (anAttribute->IsHasOwnWidth())
+    theTarget.PutReal(anAttribute->Width());
+  else
+    theTarget.PutReal(-1.);
+
+  // Mode
+  if (anAttribute->IsHasOwnMode())
+    theTarget.PutInteger(anAttribute->Mode());
+  else
+    theTarget.PutInteger(-1);
+}
index e94fa36e78fc1767f3f9ac146e6dc4f0857c2cc7..eaa8fa5f348f794cef9c3da3578b084656503fd5 100644 (file)
@@ -22,7 +22,8 @@ uses BinMDF,
      BRepTools, 
      BinTools,
      TDF,
-     CDM
+     CDM,
+     Storage
 
 is 
 
index 601c8ec417ba8e95d2aac0f23d2f7e894dbe9d1f..5a1c08693e8d3b438789f64e806bcf152b950b0b 100644 (file)
@@ -24,7 +24,8 @@ uses
     MessageDriver    from CDM,
     Attribute        from TDF, 
     ShapeSet         from BinTools,
-    LocationSet      from BinTools
+    LocationSet      from BinTools,
+    IODevice         from Storage
 
 is
     Create (theMessageDriver:MessageDriver from CDM)
@@ -43,10 +44,10 @@ is
     
     ReadShapeSection (me: mutable; theIS: in out IStream from Standard);
       ---Purpose: Input the shapes from Bin Document file
-
+      
     WriteShapeSection (me: mutable; theOS: in out OStream from Standard);
       ---Purpose: Output the shapes into Bin Document file
-
+      
     Clear (me:mutable);
       ---Purpose: Clear myShapeSet 
        
index a1cbaf641d4bfa07a3835fb9674f401770c38370..fd9200ba0de59f8711b09a26244baa45ff112f93 100644 (file)
@@ -25,6 +25,8 @@
 #include <TCollection_AsciiString.hxx>
 #include <BinTools_ShapeSet.hxx>
 #include <TopAbs_Orientation.hxx>
+#include <Storage_IStream.hxx>
+#include <Storage_OStream.hxx>
 
 #define SHAPESET "SHAPE_SECTION"
 #define FORMAT_NUMBER 3
@@ -304,4 +306,3 @@ void BinMNaming_NamedShapeDriver::ReadShapeSection (Standard_IStream& theIS)
   else
     theIS.seekg(aPos); // no shape section is present, try to return to initial point
 }
-
diff --git a/src/BinMPrsStd/BinMPrsStd.cdl b/src/BinMPrsStd/BinMPrsStd.cdl
deleted file mode 100644 (file)
index f434bbc..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
--- Created on: 2004-05-17
--- Created by: Sergey ZARITCHNY <szy@opencascade.com>
--- Copyright (c) 2004-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-package BinMPrsStd 
-
-       ---Purpose: 
-
-uses 
-    BinObjMgt, 
-    TDF, 
-    BinMDF,
-    CDM
-is
-        ---Category: Storage-Retrieval drivers for graphic attributes from
-        --           TPrsStd
-
-       class AISPresentationDriver; 
-       
-       class PositionDriver;   
-       
-    AddDrivers(theDriverTable   : ADriverTable  from BinMDF;
-              theMessageDriver : MessageDriver from CDM);
-       ---Purpose: Adds the attribute storage-retrieval driver to <theDriverTable>.
-
-end BinMPrsStd;
diff --git a/src/BinMPrsStd/BinMPrsStd.cxx b/src/BinMPrsStd/BinMPrsStd.cxx
deleted file mode 100644 (file)
index 2f3a3a4..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-// Created on: 2004-05-17
-// Created by: Sergey ZARITCHNY
-// Copyright (c) 2004-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <BinMPrsStd.ixx>
-#include <CDM_MessageDriver.hxx>
-#include <BinMDF_ADriverTable.hxx>
-#include <BinMPrsStd_AISPresentationDriver.hxx>
-#include <BinMPrsStd_PositionDriver.hxx>
-
-//=======================================================================
-//function : AddDrivers
-//purpose  : 
-//=======================================================================
-
-void BinMPrsStd::AddDrivers (const Handle(BinMDF_ADriverTable)& aDriverTable,
-                                   const Handle(CDM_MessageDriver)&   aMessageDriver)
-{
-  aDriverTable->AddDriver (new BinMPrsStd_AISPresentationDriver(aMessageDriver));
-  aDriverTable->AddDriver (new BinMPrsStd_PositionDriver(aMessageDriver));
-}
diff --git a/src/BinMPrsStd/BinMPrsStd_AISPresentationDriver.cdl b/src/BinMPrsStd/BinMPrsStd_AISPresentationDriver.cdl
deleted file mode 100644 (file)
index 71e7ee2..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
--- Created on: 2004-05-17
--- Created by: Sergey ZARITCHNY <szy@opencascade.com>
--- Copyright (c) 2004-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class AISPresentationDriver from BinMPrsStd inherits ADriver from BinMDF
-
-       ---Purpose: AISPresentation Attribute Driver.
-
-uses
-    SRelocationTable from BinObjMgt,
-    RRelocationTable from BinObjMgt,
-    Persistent       from BinObjMgt,
-    MessageDriver    from CDM,
-    Attribute        from TDF
-
-is
-
-    Create (theMessageDriver:MessageDriver from CDM)
-        returns AISPresentationDriver from BinMPrsStd;
-
-    NewEmpty (me)  returns Attribute from TDF;
-
-    Paste(me; Source     : Persistent from BinObjMgt;
-              Target     : Attribute from TDF;
-              RelocTable : out RRelocationTable from BinObjMgt)
-        returns Boolean from Standard;
-
-    Paste(me; Source     : Attribute from TDF;
-              Target     : in out Persistent from BinObjMgt;
-              RelocTable : out SRelocationTable from BinObjMgt);
-    
-
-end AISPresentationDriver;
diff --git a/src/BinMPrsStd/BinMPrsStd_AISPresentationDriver.cxx b/src/BinMPrsStd/BinMPrsStd_AISPresentationDriver.cxx
deleted file mode 100644 (file)
index 687224a..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-// Created on: 2004-05-17
-// Created by: Sergey ZARITCHNY
-// Copyright (c) 2004-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <BinMPrsStd_AISPresentationDriver.ixx>
-#include <TPrsStd_AISPresentation.hxx>
-#include <Graphic3d_NameOfMaterial.hxx>
-#include <Quantity_NameOfColor.hxx>
-#include <CDM_MessageDriver.hxx>
-//=======================================================================
-//function : BinMDataStd_AISPresentationDriver
-//purpose  : Constructor
-//=======================================================================
-
-BinMPrsStd_AISPresentationDriver::BinMPrsStd_AISPresentationDriver
-                        (const Handle(CDM_MessageDriver)& theMsgDriver)
-     : BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TPrsStd_AISPresentation)->Name())
-{
-}
-
-//=======================================================================
-//function : NewEmpty
-//purpose  : 
-//=======================================================================
-
-Handle(TDF_Attribute) BinMPrsStd_AISPresentationDriver::NewEmpty() const
-{
-  return new TPrsStd_AISPresentation();
-}
-
-//=======================================================================
-//function : Paste
-//purpose  : persistent -> transient (retrieve)
-//=======================================================================
-
-Standard_Boolean BinMPrsStd_AISPresentationDriver::Paste
-                                (const BinObjMgt_Persistent&  theSource,
-                                 const Handle(TDF_Attribute)& theTarget,
-                                 BinObjMgt_RRelocationTable&  ) const
-{
-  Handle(TPrsStd_AISPresentation) anAtt = Handle(TPrsStd_AISPresentation)::DownCast(theTarget);
-  Standard_Integer aValue;
-//Display status
-  Standard_Boolean ok = theSource >> aValue;
-  if (!ok) return ok;
-  anAtt->SetDisplayed((Standard_Boolean)aValue);
-
-//GUID
-  Standard_GUID aGUID;
-  ok = theSource >> aGUID;
-  if (!ok) return ok;
-  anAtt->SetDriverGUID(aGUID);
-
-//Color
-  ok = theSource >> aValue;
-  if (!ok) return ok;
-  if(aValue != -1)  anAtt->SetColor( (Quantity_NameOfColor)(aValue) );
-  else anAtt->UnsetColor();
-
-//Material
-  ok = theSource >> aValue;
-  if (!ok) return ok;
-  if(aValue != -1)  anAtt->SetMaterial( (Graphic3d_NameOfMaterial)(aValue) );
-  else anAtt->UnsetMaterial();
-
-//Transparency
-  Standard_Real aRValue;
-  ok = theSource >> aRValue;
-  if (!ok) return ok;
-  if(aRValue != -1.)  anAtt->SetTransparency(aRValue);
-  else anAtt->UnsetTransparency(); 
-
-//Width
-  ok = theSource >> aRValue;
-  if (!ok) return ok;
-  if(aRValue != -1.)  anAtt->SetWidth( aRValue );
-  else anAtt->UnsetWidth(); 
-
-//Mode
-  ok = theSource >> aValue;
-  if (!ok) return ok;
-  if(aValue != -1)  anAtt->SetMode(aValue);
-  else anAtt->UnsetMode();
-
-  return ok;
-}
-
-//=======================================================================
-//function : Paste
-//purpose  : transient -> persistent (store)
-//=======================================================================
-
-void BinMPrsStd_AISPresentationDriver::Paste (const Handle(TDF_Attribute)& theSource,
-                                       BinObjMgt_Persistent&        theTarget,
-                                       BinObjMgt_SRelocationTable&  ) const
-{
-  Handle(TPrsStd_AISPresentation) anAtt = Handle(TPrsStd_AISPresentation)::DownCast(theSource);
-//1
-  theTarget.PutBoolean(anAtt->IsDisplayed());//Bool
-//2
-  theTarget.PutGUID(anAtt->GetDriverGUID());//GUID
-//3
-  if(anAtt->HasOwnColor()) 
-    theTarget.PutInteger((Standard_Integer)anAtt->Color());//Color
-  else theTarget.PutInteger(-1);
-//4
- if(anAtt->HasOwnMaterial())
-   theTarget.PutInteger((Standard_Integer)anAtt->Material());
- else theTarget.PutInteger(-1);
-//5
-  if(anAtt->HasOwnTransparency())
-    theTarget.PutReal(anAtt->Transparency()); //Real
-  else theTarget.PutReal(-1.);
-//6
-  if(anAtt->HasOwnWidth())
-    theTarget.PutReal(anAtt->Width());// Real
-  else theTarget.PutReal(-1.);
-//7
-  if(anAtt->HasOwnMode())
-    theTarget.PutInteger(anAtt->Mode()); //Int
-  else theTarget.PutInteger(-1);
-}
diff --git a/src/BinMPrsStd/BinMPrsStd_PositionDriver.cdl b/src/BinMPrsStd/BinMPrsStd_PositionDriver.cdl
deleted file mode 100644 (file)
index e2ed922..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
--- Created on: 2004-05-17
--- Created by: Sergey ZARITCHNY <szy@opencascade.com>
--- Copyright (c) 2004-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class PositionDriver from BinMPrsStd inherits ADriver from BinMDF
-
-       ---Purpose: Position Attribute Driver.
-
-uses
-    SRelocationTable from BinObjMgt,
-    RRelocationTable from BinObjMgt,
-    Persistent       from BinObjMgt,
-    MessageDriver    from CDM,
-    Attribute        from TDF
-
-is
-
-Create (theMessageDriver:MessageDriver from CDM)
-        returns PositionDriver from BinMPrsStd;
-
-    NewEmpty (me)  returns Attribute from TDF;
-
-    Paste(me; Source     : Persistent from BinObjMgt;
-              Target     : Attribute from TDF;
-              RelocTable : out RRelocationTable from BinObjMgt)
-        returns Boolean from Standard;
-
-    Paste(me; Source     : Attribute from TDF;
-              Target     : in out Persistent from BinObjMgt;
-              RelocTable : out SRelocationTable from BinObjMgt);
-
-end PositionDriver;
diff --git a/src/BinMPrsStd/BinMPrsStd_PositionDriver.cxx b/src/BinMPrsStd/BinMPrsStd_PositionDriver.cxx
deleted file mode 100644 (file)
index 792a5cd..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-// Created on: 2004-05-17
-// Created by: Sergey ZARITCHNY
-// Copyright (c) 2004-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// modified     13.04.2009 Sergey ZARITCHNY
-
-#include <BinMPrsStd_PositionDriver.ixx>
-#include <gp_Pnt.hxx>
-#include <TDataXtd_Position.hxx>
-#include <CDM_MessageDriver.hxx>
-
-//=======================================================================
-//function : BinMDataStd_PositionDriver
-//purpose  : Constructor
-//=======================================================================
-
-BinMPrsStd_PositionDriver::BinMPrsStd_PositionDriver
-                        (const Handle(CDM_MessageDriver)& theMsgDriver)
-     : BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TDataXtd_Position)->Name())
-{
-}
-
-//=======================================================================
-//function : NewEmpty
-//purpose  : 
-//=======================================================================
-
-Handle(TDF_Attribute) BinMPrsStd_PositionDriver::NewEmpty() const
-{
-  return new TDataXtd_Position();
-}
-
-//=======================================================================
-//function : Paste
-//purpose  : persistent -> transient (retrieve)
-//=======================================================================
-
-Standard_Boolean BinMPrsStd_PositionDriver::Paste
-                                (const BinObjMgt_Persistent&  theSource,
-                                 const Handle(TDF_Attribute)& theTarget,
-                                 BinObjMgt_RRelocationTable&  ) const
-{
-  Handle(TDataXtd_Position) anAtt = Handle(TDataXtd_Position)::DownCast(theTarget);
-  Standard_Real aValue;
-  Standard_Boolean ok = theSource >> aValue;
-  if (!ok) return ok;
-  gp_Pnt aPosition(0., 0., 0.);
-  aPosition.SetX(aValue);
-
-  ok = theSource >> aValue;
-  if (!ok) return ok;
-  aPosition.SetY(aValue);
-
-  ok = theSource >> aValue;
-  if (!ok) return ok;
-  aPosition.SetZ(aValue);
-
-  anAtt->SetPosition(aPosition);
-
-  return ok;
-}
-
-//=======================================================================
-//function : Paste
-//purpose  : transient -> persistent (store)
-//=======================================================================
-
-void BinMPrsStd_PositionDriver::Paste (const Handle(TDF_Attribute)& theSource,
-                                       BinObjMgt_Persistent&        theTarget,
-                                       BinObjMgt_SRelocationTable&  ) const
-{
-  Handle(TDataXtd_Position) anAtt = Handle(TDataXtd_Position)::DownCast(theSource);
-  
-  theTarget << anAtt->GetPosition().X();
-  theTarget << anAtt->GetPosition().Y();
-  theTarget << anAtt->GetPosition().Z();
-}
index 419d2156d692f3173e0aec9f970cf826511d71f4..adfcee6ba926c60795f2aaaceb76e59f6a160061 100644 (file)
@@ -21,6 +21,7 @@ package BinObjMgt
 uses
     TDF,
     Standard,
+    Storage,
     TCollection,
     TColStd
 
index fb7d82ae7920ec7ff4552e65fb0b07ee1dac7303..584779fc58b8340c605b3bcb966b334d79fbd82d 100644 (file)
@@ -26,6 +26,7 @@ uses
     Address             from Standard,
     OStream             from Standard,
     IStream             from Standard,
+    IODevice            from Storage,
     SequenceOfAddress   from TColStd,
     AsciiString         from TCollection,
     ExtendedString      from TCollection,
@@ -317,12 +318,17 @@ is
         --          inline Standard_OStream& operator<< (Standard_OStream&,
         --          BinObjMgt_Persistent&) is also available
 
+    Write (me: in out; theDevice: IODevice from Storage) is static;
+
     Read (me: in out; theIS: in out IStream from Standard)
         returns IStream from Standard is static;
         ---C++: return &
         ---Purpose: Retrieves <me> from the stream.
         --          inline Standard_IStream& operator>> (Standard_IStream&,
         --          BinObjMgt_Persistent&) is also available
+        
+    Read (me: in out; theDevice:IODevice from Storage) is static;
+        ---Purpose: Retrieves <me> from the Storage_IODevice.
 
     Destroy (me: in out);
         ---C++: alias ~
index b8a522f3633c1eb79acd3e2bd86aa8dc58e8d33e..f8579aa949cf9ed649eccd7605dbc377297ebcf5 100644 (file)
@@ -18,6 +18,7 @@
 #include <TDF_Tool.hxx>
 #include <TColStd_ListIteratorOfListOfInteger.hxx>
 #include <FSD_FileHeader.hxx>
+#include <Storage_OStream.hxx>
 
 #define BP_INTSIZE         ((Standard_Integer)sizeof(Standard_Integer))
 #define BP_EXTCHARSIZE     ((Standard_Integer)sizeof(Standard_ExtCharacter))
@@ -103,6 +104,34 @@ Standard_OStream& BinObjMgt_Persistent::Write (Standard_OStream& theOS)
   return theOS;
 }
 
+//=======================================================================
+//function : Write
+//purpose  : Stores <me> to the device.
+//=======================================================================
+
+void BinObjMgt_Persistent::Write (const Handle(Storage_IODevice)& theDevice)
+{
+  Standard_Integer nbWritten = 0;
+  Standard_Integer *aData = (Standard_Integer*) myData(1);
+  // update data length
+  aData[2] = mySize - BP_HEADSIZE;
+#if DO_INVERSE
+  aData[0] = InverseInt (aData[0]);
+  aData[1] = InverseInt (aData[1]);
+  aData[2] = InverseInt (aData[2]);
+#endif
+  for (Standard_Integer i=1; theDevice->CanWrite() && nbWritten < mySize && i <= myData.Length(); i++)
+  {
+    Standard_Integer nbToWrite = Min(mySize - nbWritten, BP_PIECESIZE);
+    theDevice->Write( (Standard_Address)myData(i), nbToWrite );
+    nbWritten += nbToWrite;
+  }
+  myIndex = 1;
+  myOffset = BP_HEADSIZE;
+  mySize = BP_HEADSIZE;
+  myIsError = Standard_False;
+}
+
 //=======================================================================
 //function : Read
 //purpose  : Retrieves <me> from the stream.
@@ -163,6 +192,62 @@ Standard_IStream& BinObjMgt_Persistent::Read (Standard_IStream& theIS)
   return theIS;
 }
 
+//=======================================================================
+//function : Read
+//purpose  : 
+//=======================================================================
+
+void BinObjMgt_Persistent::Read (const Handle(Storage_IODevice)& aDevice)
+{
+  myIndex = 1;
+  myOffset = BP_HEADSIZE;
+  mySize = BP_HEADSIZE;
+  myIsError = Standard_False;
+
+  Standard_Integer *aData = (Standard_Integer*) myData(1);
+  aData[0] = 0;         // Type Id
+  aData[1] = 0;         // Object Id
+  aData[2] = 0;         // Data length
+
+  // read TypeId
+  aDevice->Read ((char*) &aData[0], BP_INTSIZE);
+#if DO_INVERSE
+  aData[0] = InverseInt (aData[0]);
+#endif
+  if (aDevice->CanRead() && aData[0] > 0) {
+    // read Id and Length
+    aDevice->Read ((char*)&aData[1], 2 * BP_INTSIZE);
+#if DO_INVERSE
+    aData[1] = InverseInt (aData[1]);
+    aData[2] = InverseInt (aData[2]);
+#endif
+    if (aDevice->CanRead() && aData[1] > 0 && aData[2] > 0) {
+      mySize += aData[2];
+      // read remaining data
+      Standard_Integer nbRead = BP_HEADSIZE;
+      for (Standard_Integer i=1; aDevice->CanRead() && nbRead < mySize; i++)
+      {
+        if (i > myData.Length()) {
+          // grow myData dynamically
+          Standard_Address aPiece = Standard::Allocate (BP_PIECESIZE);
+          myData.Append (aPiece);
+        }
+        Standard_Integer nbToRead = Min (mySize - nbRead, BP_PIECESIZE);
+        char *ptr = (char*)myData(i);
+        if (i == 1) {
+          // 1st piece: reduce the number of bytes by header size
+          ptr += BP_HEADSIZE;
+          if (nbToRead == BP_PIECESIZE) nbToRead -= BP_HEADSIZE;
+        }
+        aDevice->Read (ptr, nbToRead);
+        nbRead += nbToRead;
+      }
+    }
+    else
+      aData[2] = 0;
+  }
+}
+
 //=======================================================================
 //function : Destroy
 //purpose  : Frees the allocated memory
index d03adbc6fad647df8f3b20b1af117d7229bee501..7c49e9b5dabf6eef7de2e4014095a3dbdbd8e4d9 100644 (file)
@@ -17,7 +17,7 @@
 package CDF
 
 
-uses CDM, PCDM, TCollection, TColStd, Storage, Resource, Quantity, OSD
+uses CDM, PCDM, TCollection, TColStd, Storage, Resource, Quantity, OSD, Storage
 
 is
     class Directory;
index b321ab31c0c25e2123c38bbd7ac1b057f1a0e909..02da51d3996b2262387b0cdf68a91c6dbba3a06b 100644 (file)
@@ -29,7 +29,8 @@ uses
     TypeOfActivation from CDF, 
     SequenceOfExtendedString from TColStd, 
     CanCloseStatus from CDM,  
-    AsciiString from TCollection 
+    AsciiString from TCollection,
+    IODevice from Storage
     
 raises NoSuchObject from Standard
 is
@@ -69,7 +70,7 @@ is
     ---Purpose: removes the document of the current session directory 
     --          and closes the document;
     
-    Retrieve (me: mutable; aFolder, aName: ExtendedString from TCollection; UseStorageConfiguration: Boolean from Standard = Standard_True)
+    Retrieve (me: mutable; aDevice: in out IODevice from Storage; UseStorageConfiguration: Boolean from Standard = Standard_True)
     returns Document from CDM;
     ---Purpose: This method retrieves a document from the database. 
     --          If the Document references other documents which have
@@ -91,7 +92,7 @@ is
 --  A link is kept with the database through an instance of CDM_MetaData
 
 
-    Retrieve (me: mutable; aFolder, aName, aVersion: ExtendedString from TCollection; UseStorageConfiguration: Boolean from Standard = Standard_True)
+    Retrieve (me: mutable; aDevice: in out IODevice from Storage; aVersion: ExtendedString from TCollection; UseStorageConfiguration: Boolean from Standard = Standard_True)
     returns Document from CDM;
     ---Purpose:  This method retrieves  a  document from the database.
     --          If the  Document references other documents which have
@@ -108,17 +109,17 @@ is
 --             A link is kept with the database through an instance 
 --             of CDM_MetaData
 
-
-    CanRetrieve(me: mutable; aFolder, aName: ExtendedString from TCollection)
+    CanRetrieve(me: mutable; aDevice: in out IODevice from Storage)
     ---Purpose:
     returns ReaderStatus from PCDM;
     
-    CanRetrieve(me: mutable; aFolder, aName, aVersion: ExtendedString from TCollection)
+    CanRetrieve(me: mutable; aDevice: in out IODevice from Storage; aVersion: ExtendedString from TCollection)
     ---Purpose:
     returns ReaderStatus from PCDM;
-       
+
     Formats(me: mutable; Formats: out SequenceOfExtendedString from TColStd) 
     is deferred;
+
 ---Category: CurrentDocument methods.
 --           
 
@@ -148,11 +149,10 @@ is
  ---Category:  methods to get storage/retrieval driver.
  --           
  --           
-    FindReader(me: mutable; aFileName: ExtendedString from TCollection)
+    FindReader(me: mutable; aDevice: IODevice from Storage)
     returns Boolean from Standard;
 
-
-    Reader(me: mutable; aFileName: ExtendedString from TCollection) 
+    Reader(me: mutable; aDevice: IODevice from Storage) 
     returns Reader from PCDM
     raises NoSuchObject from Standard;
     
@@ -165,15 +165,13 @@ is
 
     ---Purpose: 
 
-    Format (me : mutable; aFileName :     ExtendedString from TCollection
+    Format (me : mutable; aDevice : IODevice from Storage
                           theFormat : out ExtendedString from TCollection)
     ---Purpose: try to  retrieve a Format  directly in the  file or in
     --           application   resource  by using   extension. returns
     --          True if found;
     returns Boolean from Standard;
     
-
-
 ---Category: Default Storage folder
 --           
     DefaultFolder(me: mutable) returns ExtString from Standard;
@@ -196,7 +194,7 @@ is
     returns Integer from Standard
     is private;
 
-    FindReader(me: mutable; aFileName: ExtendedString from TCollection; PluginIn: out GUID from Standard; ResourceName: out ExtendedString from TCollection)
+    FindReader(me: mutable; aDevice: IODevice from Storage; PluginIn: out GUID from Standard; ResourceName: out ExtendedString from TCollection)
     returns Boolean from Standard
     is private;
     
@@ -212,6 +210,7 @@ is
     CanRetrieve(me: mutable; aMetaData: MetaData from CDM)
     returns ReaderStatus from PCDM
     is private;
+    
 fields
 
     myDefaultFolder: ExtendedString from TCollection; 
index bbabfd17f84d87eaf93467d40db2ab03c330e5a1..b7ddf1620fdb80f7b7d5cbba5208ac5a8e8c9172 100644 (file)
@@ -86,31 +86,31 @@ void CDF_Application::Close(const Handle(CDM_Document)& aDocument) {
 //function : Retrieve
 //purpose  : 
 //=======================================================================
-Handle(CDM_Document) CDF_Application::Retrieve(const TCollection_ExtendedString& aFolder, 
-                                    const TCollection_ExtendedString& aName, 
-                                    const Standard_Boolean UseStorageConfiguration) {
+Handle(CDM_Document) CDF_Application::Retrieve(Handle(Storage_IODevice)& aDevice,
+                                               const Standard_Boolean UseStorageConfiguration)
+{
   TCollection_ExtendedString nullVersion;
-  return Retrieve(aFolder,aName,nullVersion,UseStorageConfiguration);
+  return Retrieve(aDevice, nullVersion, UseStorageConfiguration);
 }
 
 //=======================================================================
 //function : Retrieve
 //purpose  : 
 //=======================================================================
-Handle(CDM_Document)  CDF_Application::Retrieve(const TCollection_ExtendedString& aFolder
-                                    const TCollection_ExtendedString& aName,
-                                    const TCollection_ExtendedString& aVersion,
-                                    const Standard_Boolean UseStorageConfiguration) {
+Handle(CDM_Document) CDF_Application::Retrieve(Handle(Storage_IODevice)& aDevice
+                                               const TCollection_ExtendedString& aVersion,
+                                               const Standard_Boolean UseStorageConfiguration)
+{
 #ifdef OCCT_DEBUG
   CDF_Timer theTimer;
 #endif
 
   Handle(CDM_MetaData) theMetaData; 
   
-  if(aVersion.Length() == 0) 
-    theMetaData=theMetaDataDriver->MetaData(aFolder,aName);
-  else 
-    theMetaData=theMetaDataDriver->MetaData(aFolder,aName,aVersion);
+  if(aVersion.Length() == 0)
+    theMetaData = theMetaDataDriver->MetaData(aDevice);
+  else
+    theMetaData = theMetaDataDriver->MetaData(aDevice, aVersion);
 
 #ifdef OCCT_DEBUG
   theTimer.ShowAndRestart("Getting MetaData: ");
@@ -140,31 +140,42 @@ Handle(CDM_Document)  CDF_Application::Retrieve(const TCollection_ExtendedString
 //function : CanRetrieve
 //purpose  : 
 //=======================================================================
-PCDM_ReaderStatus CDF_Application::CanRetrieve(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString&  aName) {
+PCDM_ReaderStatus CDF_Application::CanRetrieve(Handle(Storage_IODevice)& aDevice)
+{
  TCollection_ExtendedString aVersion;
- return CanRetrieve(aFolder,aName,aVersion);
+ return CanRetrieve(aDevice, aVersion);
 }
 
 //=======================================================================
 //function : CanRetrieve
 //purpose  : 
 //=======================================================================
-PCDM_ReaderStatus CDF_Application::CanRetrieve(const TCollection_ExtendedString&  aFolder, const TCollection_ExtendedString&  aName, const TCollection_ExtendedString&  aVersion) {
-  
+PCDM_ReaderStatus CDF_Application::CanRetrieve(Handle(Storage_IODevice)& aDevice, const TCollection_ExtendedString& aVersion)
+{
 #ifdef OCCT_DEBUG
   CDF_Timer theTimer;
 #endif
+  if ( aDevice.IsNull() || aDevice->Open( Storage_VSRead ) != Storage_VSOk )
+      return PCDM_RS_OpenError;
+
+  Standard_Boolean canRead = aDevice->CanRead();
 
+  aDevice->Close();
+
+  if ( !canRead )
+    return PCDM_RS_PermissionDenied;
+  /*  
   if (!theMetaDataDriver->Find(aFolder,aName,aVersion))
     return PCDM_RS_UnknownDocument;
   else if (!theMetaDataDriver->HasReadPermission(aFolder,aName,aVersion))
     return PCDM_RS_PermissionDenied;
+  */
   else {
 #ifdef OCCT_DEBUG
     theTimer.ShowAndRestart("theMetaDataDriver->Find: ");
 #endif
 
-    Handle(CDM_MetaData) theMetaData = theMetaDataDriver->MetaData(aFolder,aName,aVersion);
+    Handle(CDM_MetaData) theMetaData = theMetaDataDriver->MetaData(aDevice, aVersion);
 
 #ifdef OCCT_DEBUG
     theTimer.ShowAndStop("Getting MetaData: ");
@@ -175,10 +186,9 @@ PCDM_ReaderStatus CDF_Application::CanRetrieve(const TCollection_ExtendedString&
        ? PCDM_RS_AlreadyRetrievedAndModified : PCDM_RS_AlreadyRetrieved;
     }
     else {
-      TCollection_ExtendedString theFileName=theMetaData->FileName();
-      TCollection_ExtendedString theFormat=PCDM_ReadWriter::FileFormat(theFileName);
+      TCollection_ExtendedString theFormat=PCDM_ReadWriter::FileFormat(theMetaData->Device());
       if(theFormat.Length()==0) {
-       TCollection_ExtendedString ResourceName=UTL::Extension(theFileName);
+       TCollection_ExtendedString ResourceName=UTL::Extension(theMetaData->Device()->Name());
        ResourceName+=".FileFormat";
        if(UTL::Find(Resources(),ResourceName))  {
          theFormat=UTL::Value(Resources(),ResourceName);
@@ -189,12 +199,10 @@ PCDM_ReaderStatus CDF_Application::CanRetrieve(const TCollection_ExtendedString&
       if(!FindReaderFromFormat(theFormat)) return PCDM_RS_NoDriver;
     }
   }
+
   return PCDM_RS_OK;
-  
 }
 
-
-
 //=======================================================================
 //function : Activate
 //purpose  : 
@@ -265,12 +273,12 @@ Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMeta
     Standard_SStream aMsg;
     switch (CanRetrieve(aMetaData)) {
     case PCDM_RS_UnknownDocument: 
-      aMsg << "could not find the referenced document: " << aMetaData->Path() << "; not found."  <<(char)0 << endl;
+      aMsg << "could not find the referenced document: " << aMetaData->Device() << "; not found."  <<(char)0 << endl;
       myRetrievableStatus = PCDM_RS_UnknownDocument;
       Standard_Failure::Raise(aMsg);
       break;
     case PCDM_RS_PermissionDenied:      
-      aMsg << "Could not find the referenced document: " << aMetaData->Path() << "; permission denied. " <<(char)0 << endl;
+      aMsg << "Could not find the referenced document: " << aMetaData->Device() << "; permission denied. " <<(char)0 << endl;
       myRetrievableStatus = PCDM_RS_PermissionDenied;
       Standard_Failure::Raise(aMsg);
       break;
@@ -285,7 +293,7 @@ Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMeta
   if(Modified) myRetrievableStatus = PCDM_RS_AlreadyRetrievedAndModified;
   if(!AlreadyRetrieved || Modified) {
 
-    Handle(PCDM_Reader) theReader=Reader(aMetaData->FileName());
+    Handle(PCDM_Reader) theReader = Reader(aMetaData->Device());
     
     
     Handle(CDM_Document) theDocument;
@@ -297,14 +305,14 @@ Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMeta
     else
       theDocument=theReader->CreateDocument();
     
-    SetReferenceCounter(theDocument,PCDM_RetrievalDriver::ReferenceCounter(aMetaData->FileName(), MessageDriver()));
+    SetReferenceCounter(theDocument,PCDM_RetrievalDriver::ReferenceCounter(aMetaData->Device(), MessageDriver()));
     
     SetDocumentVersion(theDocument,aMetaData);
     theMetaDataDriver->ReferenceIterator()->LoadReferences(theDocument,aMetaData,this,UseStorageConfiguration);
 
     try {    
       OCC_CATCH_SIGNALS
-      theReader->Read(aMetaData->FileName(),theDocument,this);
+      theReader->Read(aMetaData->Device(),theDocument,this);
     } 
     catch (Standard_Failure) {
       myRetrievableStatus = theReader->GetStatus();
@@ -331,7 +339,7 @@ Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMeta
 //=======================================================================
 Standard_Integer CDF_Application::DocumentVersion(const Handle(CDM_MetaData)& theMetaData) {
 //  const Handle(CDM_MessageDriver)& aMsgDriver = MessageDriver();
-  return PCDM_RetrievalDriver::DocumentVersion(theMetaData->FileName(), MessageDriver());
+  return PCDM_RetrievalDriver::DocumentVersion(theMetaData->Device(), MessageDriver());
 }
 
 //=======================================================================
@@ -360,25 +368,25 @@ CDF_TypeOfActivation CDF_Application::TypeOfActivation(const Handle(CDM_MetaData
 //function : FindReader
 //purpose  : 
 //=======================================================================
-Standard_Boolean CDF_Application::FindReader(const TCollection_ExtendedString& aFileName) {
+Standard_Boolean CDF_Application::FindReader(const Handle(Storage_IODevice)& aDevice) {
   Standard_GUID voidGUID;
   TCollection_ExtendedString voidResourceName;
-  return FindReader(aFileName,voidGUID,voidResourceName);
+  return FindReader(aDevice,voidGUID,voidResourceName);
 }
 
 //=======================================================================
 //function : Reader
 //purpose  : code dp
 //=======================================================================
-Handle(PCDM_Reader) CDF_Application::Reader (const TCollection_ExtendedString& aFileName) {
+Handle(PCDM_Reader) CDF_Application::Reader (const Handle(Storage_IODevice)& aDevice) {
   TCollection_ExtendedString theFormat;
-  if (!Format(aFileName,theFormat)) {
+  if (!Format(aDevice,theFormat)) {
     Standard_SStream aMsg; 
     aMsg << "Could not found the format" <<(char)0;
     Standard_NoSuchObject::Raise(aMsg);
 
   }
-  return ReaderFromFormat (theFormat);
+  return ReaderFromFormat(theFormat);
 }
 
 //=======================================================================
@@ -429,14 +437,14 @@ Handle(PCDM_Reader) CDF_Application::ReaderFromFormat(const TCollection_Extended
 //function : FindReader
 //purpose  : 
 //=======================================================================
-Standard_Boolean CDF_Application::FindReader(const TCollection_ExtendedString& aFileName, Standard_GUID& thePluginId, TCollection_ExtendedString& ResourceName) {
+Standard_Boolean CDF_Application::FindReader(const Handle(Storage_IODevice)& aDevice, Standard_GUID& thePluginId, TCollection_ExtendedString& ResourceName) {
   
-  TCollection_ExtendedString theFormat=PCDM_ReadWriter::FileFormat(aFileName);
+  TCollection_ExtendedString theFormat=PCDM_ReadWriter::FileFormat(aDevice);
 
 // It is good if the format is in the file. Otherwise base on the extension.
   
   if(theFormat.Length()==0) {
-    ResourceName=UTL::Extension(aFileName);
+    ResourceName=UTL::Extension(aDevice->Name());
     ResourceName+=".FileFormat";
     
     if(UTL::Find(Resources(),ResourceName))  {
@@ -452,15 +460,15 @@ Standard_Boolean CDF_Application::FindReader(const TCollection_ExtendedString& a
 //function : Format
 //purpose  : dp 
 //=======================================================================
-Standard_Boolean CDF_Application::Format(const TCollection_ExtendedString& aFileName, 
+Standard_Boolean CDF_Application::Format(const Handle(Storage_IODevice)& aDevice, 
                                         TCollection_ExtendedString& theFormat)
 {
   
-  theFormat = PCDM_ReadWriter::FileFormat(aFileName);
+  theFormat = PCDM_ReadWriter::FileFormat(aDevice);
 // It is good if the format is in the file. Otherwise base on the extension.
   if(theFormat.Length()==0) {
     TCollection_ExtendedString ResourceName;
-    ResourceName=UTL::Extension(aFileName);
+    ResourceName=UTL::Extension(aDevice->Name());
     ResourceName+=".FileFormat";
     
     if(UTL::Find(Resources(),ResourceName))  {
@@ -500,8 +508,9 @@ Standard_Boolean CDF_Application::FindReaderFromFormat(const TCollection_Extende
 //purpose  : 
 //=======================================================================
 PCDM_ReaderStatus CDF_Application::CanRetrieve(const Handle(CDM_MetaData)& aMetaData) {
+  Handle(Storage_IODevice) aDevice = aMetaData->Device();
   if(aMetaData->HasVersion())
-    return CanRetrieve(aMetaData->Folder(),aMetaData->Name(),aMetaData->Version());
+    return CanRetrieve(aDevice, aMetaData->Version());
   else
-    return CanRetrieve(aMetaData->Folder(),aMetaData->Name());
+    return CanRetrieve(aDevice);
 }
index 1bf7d4d881977b14ceeac948b887649906d57c5d..70ee29516fdd9b5658f52ea5700ca3266285e5a8 100644 (file)
@@ -18,7 +18,9 @@ class FWOSDriver from CDF  inherits MetaDataDriver from CDF
 uses
     MetaData from CDM,
     Document from CDM,
-    ExtendedString from TCollection
+    ExtendedString from TCollection,
+    IODevice from Storage
+    
 is
     Create
     returns FWOSDriver from CDF;
@@ -34,20 +36,19 @@ is
     returns Boolean from Standard;
 
     
-    MetaData(me: mutable; aFolder, aName, aVersion: ExtendedString from TCollection)
+    MetaData(me: mutable; aDevice: IODevice from Storage; aVersion: ExtendedString from TCollection)
     returns MetaData from CDM
     is  private;
     
-    CreateMetaData(me: mutable; aDocument: Document from CDM;
-                aFileName: ExtendedString from TCollection)
-    returns  MetaData from CDM
-    is  private;
+    CreateMetaData(me: mutable; aDocument: Document from CDM)
+    returns MetaData from CDM
+    is private;
     
     FindFolder(me: mutable; aFolder: ExtendedString from TCollection)
     returns Boolean from Standard;
 
 
-   DefaultFolder(me: mutable) returns ExtendedString from TCollection;
+    DefaultFolder(me: mutable) returns ExtendedString from TCollection;
    
    BuildFileName(me: mutable; aDocument: Document from CDM)
    returns ExtendedString from TCollection;
@@ -57,9 +58,9 @@ is
    is private;
 
 
-   BuildMetaData(me: mutable; aFileName: ExtendedString from TCollection)
+   BuildMetaData(me: mutable; aDevice: IODevice from Storage)
    returns MetaData from CDM
-   is  private;
+   is private;
 
    SetName(me: mutable; aDocument: Document from CDM; aName: ExtendedString from TCollection)
    returns ExtendedString from TCollection
index 434c6f7438668c78bace3c09a4b58a03484dded0..75a63b101f94ffaec9bd524d182d9693ee84e33f 100644 (file)
@@ -96,24 +96,20 @@ Standard_Boolean CDF_FWOSDriver::HasReadPermission(const TCollection_ExtendedStr
 //function : MetaData
 //purpose  :
 //==============================================================================
-Handle(CDM_MetaData) CDF_FWOSDriver::MetaData(const TCollection_ExtendedString& aFolder,
-                                                 const TCollection_ExtendedString& aName,
-                                                 const TCollection_ExtendedString& /*aVersion*/)
+Handle(CDM_MetaData) CDF_FWOSDriver::MetaData(const Handle(Storage_IODevice)& aDevice,
+                                              const TCollection_ExtendedString& /*aVersion*/)
 {
-  TCollection_ExtendedString p = Concatenate(aFolder,aName);
-  return CDM_MetaData::LookUp(aFolder,aName,p,p,UTL::IsReadOnly(p));
+  //  TCollection_ExtendedString p = Concatenate(aFolder,aName);
+  return CDM_MetaData::LookUp(aDevice,!aDevice->CanWrite());
 }
 
 //==============================================================================
 //function : CreateMetaData
 //purpose  :
 //==============================================================================
-Handle(CDM_MetaData) CDF_FWOSDriver::CreateMetaData(const Handle(CDM_Document)& aDocument,
-                                                       const TCollection_ExtendedString& aFileName)
+Handle(CDM_MetaData) CDF_FWOSDriver::CreateMetaData(const Handle(CDM_Document)& aDocument)
 {
-  return CDM_MetaData::LookUp(aDocument->RequestedFolder(),aDocument->RequestedName(),
-                              Concatenate(aDocument->RequestedFolder(),aDocument->RequestedName()),
-                              aFileName,UTL::IsReadOnly(aFileName));
+  return CDM_MetaData::LookUp(aDocument->RequestedDevice(),!aDocument->RequestedDevice()->CanWrite());
 }
 
 //==============================================================================
@@ -122,11 +118,13 @@ Handle(CDM_MetaData) CDF_FWOSDriver::CreateMetaData(const Handle(CDM_Document)&
 //==============================================================================
 TCollection_ExtendedString CDF_FWOSDriver::BuildFileName(const Handle(CDM_Document)& aDocument)
 {
-
+/*
   TCollection_ExtendedString retstr = TCollection_ExtendedString(aDocument->RequestedFolder());
   PutSlash(retstr);
   retstr += aDocument->RequestedName();
   return retstr;
+*/
+  return aDocument->RequestedDevice()->Name();
 }
 
 //==============================================================================
@@ -191,9 +189,9 @@ TCollection_ExtendedString CDF_FWOSDriver::DefaultFolder()
 //function : BuildMetaData
 //purpose  :
 //==============================================================================
-Handle(CDM_MetaData) CDF_FWOSDriver::BuildMetaData(const TCollection_ExtendedString& aFileName)
+Handle(CDM_MetaData) CDF_FWOSDriver::BuildMetaData(const Handle(Storage_IODevice)& aDevice)
 {
-
+/*
   OSD_Path p = UTL::Path(aFileName);
   
   TCollection_ExtendedString f = UTL::Trek(p);
@@ -202,6 +200,8 @@ Handle(CDM_MetaData) CDF_FWOSDriver::BuildMetaData(const TCollection_ExtendedStr
   n += UTL::Extension(p);
 
   return CDM_MetaData::LookUp(f,n,aFileName,aFileName,UTL::IsReadOnly(aFileName));
+*/
+  return CDM_MetaData::LookUp(aDevice,!aDevice->CanWrite());
 }
 
 //==============================================================================
index 106bc35432d1241d6c0fe8fe8e24034d2b28913a..5665d8dcd0acfa6b2760c71a5c628a5d144f83f6 100644 (file)
@@ -21,7 +21,8 @@ deferred class MetaDataDriver from CDF inherits Transient from Standard
 uses
     Document from CDM, MetaData from CDM,
     ExtendedString from TCollection,
-    ReferenceIterator from PCDM
+    ReferenceIterator from PCDM,
+    IODevice from Storage
     
 raises 
     NotImplemented from Standard
@@ -81,7 +82,7 @@ is
     returns Boolean from Standard
     is deferred;
     
-    MetaData(me: mutable; aFolder, aName, aVersion: ExtendedString from TCollection)
+    MetaData(me: mutable; aDevice: IODevice from Storage; aVersion: ExtendedString from TCollection)
     returns MetaData from CDM
     ---Purpose: should return the MetaData stored in the DBMS with the meta-data
     --          corresponding to the Data. If the MetaDataDriver has version management capabilities
@@ -110,8 +111,7 @@ is
 
 
     
-    CreateMetaData(me: mutable; aDocument: Document from CDM;
-                aFileName: ExtendedString from TCollection)
+    CreateMetaData(me: mutable; aDocument: Document from CDM)
     ---Purpose:  should create meta-data corresponding to aData and maintaining a meta-link
     --           between these meta-data and aFileName
     --           CreateMetaData is called by CreateData
@@ -134,14 +134,12 @@ is
     returns ReferenceIterator from PCDM
     is virtual;
     
-
     Find(me: mutable; aFolder, aName: ExtendedString from TCollection)
     returns Boolean from Standard;
     ---Purpose: calls Find with an empty version
 
-    MetaData(me: mutable; aFolder, aName: ExtendedString from TCollection)
+    MetaData(me: mutable; aDevice: IODevice from Storage)
     returns MetaData from CDM;
     ---Purpose: calls MetaData with an empty version
-    
 
 end MetaDataDriver from CDF;
index 28b584844add5ba1bef8576bb6a249a8e694167a..efb541fceed5aa3f3f4d96bd98b345eaea98ed10 100644 (file)
@@ -86,10 +86,11 @@ Standard_Boolean CDF_MetaDataDriver::Find(const TCollection_ExtendedString& aFol
 //purpose  : 
 //=======================================================================
 
-Handle(CDM_MetaData) CDF_MetaDataDriver::MetaData(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName) {
+Handle(CDM_MetaData) CDF_MetaDataDriver::MetaData(const Handle(Storage_IODevice)& aDevice) {
   TCollection_ExtendedString aVersion;
-  return MetaData(aFolder,aName,aVersion);
+  return MetaData(aDevice,aVersion);
 }
+
 //=======================================================================
 //function : LastVersion
 //purpose  : 
index def5dfd3b0385214cb3dfb839a800304bf0bc6b2..3dbcac7eb7f1b76d6fac679ae7d619c846c86d13 100644 (file)
@@ -23,11 +23,10 @@ uses Document from CDM,
      ExtendedString from TCollection,
      StoreList from CDF,
      StoreStatus from PCDM,
-     ExtendedString from TCollection
-    
+     ExtendedString from TCollection,
+     IODevice from Storage
 is
   
-  
     Create  is private;
     
     Create (aDocument: Document from CDM)
@@ -65,8 +64,8 @@ is
     --            
     --            The store list contains one or more documents. One of them is the current document.
     --            
-    Folder(me) 
-    returns ExtString from Standard;
+    Device(me) 
+    returns IODevice from Storage;
     ---Purpose: returns the folder in which the current document will be stored.
     
     Name(me) returns ExtString from Standard;
@@ -91,16 +90,16 @@ is
 
 ---Category: Set methods
 --           
-    SetFolder(me: in out; aFolder: ExtendedString from TCollection)
+    SetDevice(me: in out; aDevice: IODevice from Storage)
     ---Purpose: defines the   folder in which  the document  should be
     --          stored.  returns  Standard_True if  the Folder exists,
     --          Standard_False otherwise.
     returns Boolean from Standard;
     
                           
-    SetName(me: in out; aName: ExtString from Standard)
-    ---Purpose: defines the name under which the document should be stored.
-    returns StoreSetNameStatus  from CDF;
+--    SetName(me: in out; aName: ExtString from Standard)
+--    ---Purpose: defines the name under which the document should be stored.
+--    returns StoreSetNameStatus  from CDF;
     
     SetComment(me: in out; aComment: ExtString from Standard);
     
@@ -116,12 +115,13 @@ is
     
     Realize(me: in out);
 
-    Path(me) returns ExtString from Standard;
-    ---Purpose: returns the complete path of the created meta-data.
+--    Path(me) returns ExtString from Standard;
+--    ---Purpose: returns the complete path of the created meta-data.
 
-    MetaDataPath(me) returns ExtString from Standard;
+    MetaDataDevice(me) returns IODevice from Storage;
     ---Purpose: returns the path of  the previous store is the object
     --          is already stored, otherwise an empty string;
+
     Description(me) returns ExtString from Standard;
     ---Purpose: returns the description of the format of the main object.
 
@@ -167,17 +167,17 @@ is
 
     Init(me: in out) is private;
 
-    SetName(me: in out; aName: ExtendedString from TCollection)
-    ---Purpose: defines the name under which the document should be stored.
-    returns StoreSetNameStatus  from CDF;
+--    SetName(me: in out; aName: ExtendedString from TCollection)
+--    ---Purpose: defines the name under which the document should be stored.
+--    returns StoreSetNameStatus  from CDF;
     
     
 ---Category: compatibility
-    SetFolder(me: in out; aFolder: ExtString from Standard)
-    ---Purpose: defines the   folder in which  the document  should be
-    --          stored.  returns  Standard_True if  the Folder exists,
-    --          Standard_False otherwise.
-    returns Boolean from Standard;
+--    SetFolder(me: in out; aFolder: ExtString from Standard)
+--    ---Purpose: defines the   folder in which  the document  should be
+--    --          stored.  returns  Standard_True if  the Folder exists,
+--    --          Standard_False otherwise.
+--    returns Boolean from Standard;
     
                           
 fields
@@ -189,9 +189,8 @@ fields
     
     myLastName: ExtendedString from TCollection;
 
-    myPath: ExtendedString from TCollection;
+--    myPath: ExtendedString from TCollection;
     myText: ExtendedString from TCollection;
     myStatus: StoreStatus from PCDM;
     
-
 end Store from CDF;
index e1430859b6ca7d9949cd9a3ed52b4c0488066b84..7b276b7fdf47bc82bfe7505e9d98097a013b5416 100644 (file)
@@ -90,100 +90,46 @@ Standard_ExtString CDF_Store::LastName() const {
   return myLastName.ToExtString();
 }
 
-Standard_ExtString CDF_Store::Folder() const {
-  static TCollection_ExtendedString retv;
-  if(myCurrentDocument->HasRequestedFolder())
-    retv =  myCurrentDocument->RequestedFolder();
-  else
-    retv= blank;
-  return retv.ToExtString();
+Handle(Storage_IODevice) CDF_Store::Device() const {
+  Handle(Storage_IODevice) retv;
+  if( myCurrentDocument->HasRequestedDevice() )
+    retv = myCurrentDocument->RequestedDevice();
+
+  return retv;
 }
 
 Standard_ExtString CDF_Store::Name() const {
   static TCollection_ExtendedString retv;
-  retv = myCurrentDocument->RequestedName();
+  Handle(Storage_IODevice) dev = myCurrentDocument->RequestedDevice();
+  if ( !dev.IsNull() )
+    retv = dev->Name();
+  else
+    retv = blank;
   return retv.ToExtString();
 }
 
-
-Standard_Boolean  CDF_Store::SetFolder(const Standard_ExtString aFolder) {
-  TCollection_ExtendedString f(aFolder);
-  return SetFolder(f);
-}
-Standard_Boolean  CDF_Store::SetFolder(const TCollection_ExtendedString& aFolder) {
-
-  TCollection_ExtendedString theFolder(aFolder);
-  Standard_Integer l = theFolder.Length();
-
-  // if the last character is the folder separator (which is always the first character)
-  // it is removed.
-       // This is correct for Unix systems but not for Windows! VMS and MAC? Thomas Haller, 23.11.01
-  if(l > 1) {
-#ifndef WNT
-    if(theFolder.Value(l) == theFolder.Value(1)) theFolder.Trunc(l-1);
-#else
-       if (theFolder.Value(l) == '/' || theFolder.Value(l) == '\\')
-               theFolder.Trunc(l-1);
-#endif
-  }
-
-  if(theMetaDataDriver->FindFolder(theFolder))  {
-    myCurrentDocument->SetRequestedFolder(theFolder);
-    return Standard_True;
-  }
-  return Standard_False;
+Standard_Boolean CDF_Store::SetDevice(const Handle(Storage_IODevice)& aDevice) {
+  myCurrentDocument->SetRequestedDevice(aDevice);
+  return Standard_True;
 }
 
-
 CDF_StoreSetNameStatus CDF_Store::RecheckName () {
-   return SetName(myCurrentDocument->RequestedName());
-}
-
-CDF_StoreSetNameStatus CDF_Store::SetName(const TCollection_ExtendedString&  aName)
-{
-  TCollection_ExtendedString theName=theMetaDataDriver->SetName(myCurrentDocument,aName);
-
-  if(myCurrentDocument->IsStored ()) { 
-    Handle(CDM_MetaData)  E = myCurrentDocument->MetaData();
-    if(   E->Folder() == myCurrentDocument->RequestedFolder() 
-       && E->Name()   == theName) return CDF_SSNS_OK;
-  }
-  
-  if(myCurrentDocument->HasRequestedFolder()) {
-    if (theMetaDataDriver->Find(myCurrentDocument->RequestedFolder(),theName)) {
-      if(theMetaDataDriver->MetaData(myCurrentDocument->RequestedFolder(),theName)->IsRetrieved())
-       return CDF_SSNS_OpenDocument;
-      else {
-       myCurrentDocument->SetRequestedName(theName);
-       return CDF_SSNS_ReplacingAnExistentDocument;
-      }
-    }
-  }
-  myCurrentDocument->SetRequestedName(theName);
-  return  CDF_SSNS_OK;
-}
-CDF_StoreSetNameStatus CDF_Store::SetName(const Standard_ExtString aName)
-{
-  TCollection_ExtendedString theName(aName);
-  return SetName(theName);
+  //   return SetName(myCurrentDocument->RequestedName());
+  return CDF_SSNS_OK;
 }
 
 void CDF_Store::Realize() {
   Standard_ProgramError_Raise_if(!myList->IsConsistent(),"information are missing");
   Handle(CDM_MetaData) m;
   myText = "";
+
   myStatus = myList->Store(m,myText);
-  if(myStatus==PCDM_SS_OK) myPath = m->Path();
-}
-Standard_ExtString CDF_Store::Path() const {
-  return myPath.ToExtString();
 }
-Standard_ExtString CDF_Store::MetaDataPath() const {
-  static TCollection_ExtendedString retv;
-  retv="";
-  if(myCurrentDocument->IsStored()) retv=myCurrentDocument->MetaData()->Path();
-  return retv.ToExtString();
+
+Handle(Storage_IODevice) CDF_Store::MetaDataDevice() const {
+  return myCurrentDocument->MetaData()->Device();
 }
+
 Standard_ExtString CDF_Store::Description() const {
   static TCollection_ExtendedString retv;
 
@@ -203,7 +149,7 @@ Standard_Boolean CDF_Store::IsModified() const {
 }
 Standard_Boolean CDF_Store::CurrentIsConsistent() const {
   if(!myCurrentDocument->IsStored())
-    return myCurrentDocument->HasRequestedFolder();
+    return myCurrentDocument->HasRequestedDevice();
   return Standard_True;
 }
 
@@ -225,14 +171,14 @@ Standard_ExtString CDF_Store::PreviousVersion() const {
 
 Standard_Boolean CDF_Store::SetPreviousVersion (const Standard_ExtString aPreviousVersion) {
   if(theMetaDataDriver->HasVersionCapability()) {
-    if(myCurrentDocument->HasRequestedFolder()) {
-      if(theMetaDataDriver->Find(myCurrentDocument->RequestedFolder(),myCurrentDocument->RequestedName(),aPreviousVersion)){
+    if(myCurrentDocument->HasRequestedDevice()) {
+      // if(theMetaDataDriver->Find(myCurrentDocument->RequestedFolder(),myCurrentDocument->RequestedName(),aPreviousVersion)){
        
        myCurrentDocument->SetRequestedPreviousVersion(aPreviousVersion);
        return Standard_True;
-      }
-      else
-       return Standard_False;
+        //      }
+        //      else
+        //     return Standard_False;
     }
     else 
       return Standard_False;
@@ -285,7 +231,7 @@ CDF_SubComponentStatus CDF_Store::SubComponentStatus(const Standard_ExtString aP
    Handle(CDM_Document) d = CDM_Document::FindFromPresentation(aPresentation);
 
   if(!d->IsStored()) 
-    return d->HasRequestedFolder()? CDF_SCS_Consistent : CDF_SCS_Unconsistent;
+    return d->HasRequestedDevice()? CDF_SCS_Consistent : CDF_SCS_Unconsistent;
 
   if(d->IsModified()) return CDF_SCS_Modified;
   return CDF_SCS_Stored;
@@ -303,9 +249,9 @@ Standard_ExtString CDF_Store::AssociatedStatusText() const {
 
 void CDF_Store::FindDefault() {
   if (!myCurrentDocument->IsStored ()) {
-    myCurrentDocument->SetRequestedFolder(CDF_Session::CurrentSession()->CurrentApplication()->DefaultFolder());
+//    myCurrentDocument->SetRequestedFolder(CDF_Session::CurrentSession()->CurrentApplication()->DefaultFolder());
 //    myCurrentDocument->SetRequestedName(theMetaDataDriver->SetName(myCurrentDocument,myCurrentDocument->Presentation()));
-    myCurrentDocument->SetRequestedName(theMetaDataDriver->SetName(myCurrentDocument,myCurrentDocument->RequestedName()));
+//    myCurrentDocument->SetRequestedName(theMetaDataDriver->SetName(myCurrentDocument,myCurrentDocument->RequestedName()));
   }
 }
 void CDF_Store::SetComment(const Standard_ExtString aComment) {
index c78c79a4bc6f0a2adfd730c61529eec2ef5e3ee3..8f111c10b9ce125d8536c7db869f6fe11e7e9f41 100644 (file)
@@ -57,13 +57,14 @@ Standard_Boolean CDF_StoreList::IsConsistent () const {
   Standard_Boolean yes = Standard_True;
   CDM_MapIteratorOfMapOfDocument it (myItems); 
   for ( ; it.More() && yes ; it.Next()) {
-    yes = it.Key()->HasRequestedFolder();
+    yes = it.Key()->HasRequestedDevice();
   }
-  return yes && myMainDocument->HasRequestedFolder();
+  return yes && myMainDocument->HasRequestedDevice();
 }
 void CDF_StoreList::Init() {
   myIterator = CDM_MapIteratorOfMapOfDocument(myItems);
 }
+
 Standard_Boolean CDF_StoreList::More() const {
   return myIterator.More();
 }
@@ -93,23 +94,25 @@ PCDM_StoreStatus CDF_StoreList::Store (Handle(CDM_MetaData)& aMetaData, TCollect
             aMsg <<"No storage driver does exist for this format: " << theDocument->StorageFormat() << (char)0;
             Standard_Failure::Raise(aMsg);
           }
-
+          /*
           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);
           }
           TCollection_ExtendedString theName=theMetaDataDriver->BuildFileName(theDocument);
+          */
 
           CDF_Timer theTimer;
+          Handle(Storage_IODevice) aDevice = theDocument->RequestedDevice();
           Handle(PCDM_StorageDriver) aDocumentStorageDriver = PCDM::StorageDriver(theDocument);
 
-          aDocumentStorageDriver->Write(theDocument,theName);
+          aDocumentStorageDriver->Write(theDocument, aDevice);
           status = aDocumentStorageDriver->GetStoreStatus();
 
           theTimer.ShowAndRestart("Driver->Write: ");
 
-          aMetaData = theMetaDataDriver->CreateMetaData(theDocument,theName);
+          aMetaData = theMetaDataDriver->CreateMetaData(theDocument);
           theTimer.ShowAndStop("metadata creating: ");
 
           theDocument->SetMetaData(aMetaData);
index 7e5198e8471953cfb91262fddff22c13c62e8a05..ee557b7eb50b682dde6b32ac1eca43d27d0510ee 100644 (file)
@@ -17,7 +17,7 @@
 package CDM
 
 
-uses TCollection,TColStd,Resource
+uses TCollection, TColStd, Resource, Storage
 
 is
 
index c9170923ef1a0f6ec4af567cb781dc974152b96d..036fe2d019e39902658ed552c30f16bbd4c956fc 100644 (file)
@@ -51,13 +51,18 @@ inherits Transient from Standard
 --           the retrieving of the referenced documents.
 
 uses
+    MetaData from CDM,
     Reference from CDM,
+    Application from CDM,
+    CanCloseStatus from CDM,
+    ListOfReferences from CDM,
     ReferenceIterator from CDM,
-    ExtendedString from TCollection,MetaData from CDM, Application from CDM,
-    ListOfReferences from CDM, SequenceOfExtendedString from TColStd,
-    GUID from Standard,Manager from Resource,CanCloseStatus from CDM 
-    
-
+    ExtendedString from TCollection,
+    SequenceOfExtendedString from TColStd,
+    GUID from Standard,
+    Manager from Resource,
+    IODevice from Storage
 raises NoSuchObject from Standard,Failure from Standard,DomainError from Standard
 is
 
@@ -290,7 +295,7 @@ is
     MetaData(me) returns MetaData from CDM
     raises NoSuchObject from Standard;
     
-    Folder(me) returns ExtendedString from TCollection
+    Device(me) returns IODevice from Storage
     raises NoSuchObject from Standard;
     ---Warning: if the object is not stored;
 
@@ -300,20 +305,16 @@ is
 
                           
     
-    SetRequestedFolder(me: mutable; aFolder: ExtendedString from TCollection);
+    SetRequestedDevice(me: mutable; aDevice: IODevice from Storage);
     ---Purpose: defines the folder in which the object should be stored.
 
-    RequestedFolder(me) returns ExtendedString from TCollection
-    raises NoSuchObject from Standard;
+    RequestedDevice(me) returns IODevice from Storage;
     
+    HasRequestedDevice(me) returns Boolean from Standard;
+  
     
-    HasRequestedFolder(me) returns Boolean from Standard;
     
     
-    
-    
-    SetRequestedName(me: mutable; aName: ExtendedString from TCollection);
-    ---Purpose: defines the name under which the object should be stored.
     RequestedName(me:mutable) returns ExtendedString from TCollection;
     ---Purpose: determines  under  which the document  is  going to be
     --           store.  By default the name of the document wil be --
@@ -332,7 +333,6 @@ is
     ---Purpose: defines the Comment with  which the object should be stored.
 
     RequestedComment(me) returns ExtendedString from TCollection;
-    
 
 ---Category: resource reading methods
 --           
@@ -507,11 +507,7 @@ fields
 
     myRequestedComment: ExtendedString from TCollection;
 
-    myRequestedFolder: ExtendedString from TCollection;
-    myRequestedFolderIsDefined: Boolean from Standard;
-
-    myRequestedName: ExtendedString from TCollection;
-    myRequestedNameIsDefined: Boolean from Standard;
+    myRequestedDevice: IODevice from Storage;
 
     myRequestedPreviousVersionIsDefined:  Boolean from Standard;
     myRequestedPreviousVersion:  ExtendedString from TCollection;
index 70bfca2c381cd574b096641b3ff283fed88dd902..f95c3919287f6afbee80c701b0ffdd1fdecea95d 100644 (file)
@@ -50,8 +50,6 @@ CDM_Document::CDM_Document():
   myActualReferenceIdentifier   (0),
   myStorageVersion              (0),
   myRequestedComment            (""),
-  myRequestedFolderIsDefined    (Standard_False),
-  myRequestedNameIsDefined      (Standard_False),
   myRequestedPreviousVersionIsDefined(Standard_False),
   myFileExtensionWasFound       (Standard_False),
   myDataTypeWasFound            (Standard_False),
@@ -681,8 +679,9 @@ void CDM_Document::SetMetaData(const Handle(CDM_MetaData)& aMetaData)
   
   myMetaData = aMetaData;
   
-  SetRequestedFolder(aMetaData->Folder());
-  if(aMetaData->HasVersion()) SetRequestedPreviousVersion(aMetaData->Version());
+  SetRequestedDevice( aMetaData->Device() );
+  if ( aMetaData->HasVersion() )
+      SetRequestedPreviousVersion( aMetaData->Version() );
 }
 
 //=======================================================================
@@ -732,62 +731,45 @@ TCollection_ExtendedString CDM_Document::RequestedComment() const
 }
 
 //=======================================================================
-//function : Folder
+//function : Device
 //purpose  : 
 //=======================================================================
 
-TCollection_ExtendedString CDM_Document::Folder() const {
+Handle(Storage_IODevice) CDM_Document::Device() const {
   if(myMetaData.IsNull())
     Standard_NoSuchObject::Raise("cannot furnish the folder of an object "
                                  "which is not stored");
-  return myMetaData->Folder();
+  return myMetaData->Device();
 }
 
 //=======================================================================
-//function : SetRequestedFolder
+//function : SetRequestedDevice
 //purpose  : 
 //=======================================================================
 
-void CDM_Document::SetRequestedFolder(const TCollection_ExtendedString& aFolder)
+void CDM_Document::SetRequestedDevice(const Handle(Storage_IODevice)& aDevice)
 {
-  TCollection_ExtendedString f(aFolder);
-  if(f.Length() != 0) {
-    myRequestedFolderIsDefined=Standard_True;
-    myRequestedFolder=aFolder;
-  }
-}
-
-//=======================================================================
-//function : RequestedFolder
-//purpose  : 
-//=======================================================================
-
-TCollection_ExtendedString CDM_Document::RequestedFolder() const
-{
-  Standard_NoSuchObject_Raise_if (!myRequestedFolderIsDefined,
-                                  "storage folder is undefined for this document");
-  return myRequestedFolder;
+  myRequestedDevice=aDevice;
 }
 
 //=======================================================================
-//function : HasRequestedFolder
+//function : RequestedDevice
 //purpose  : 
 //=======================================================================
 
-Standard_Boolean CDM_Document::HasRequestedFolder() const
+Handle(Storage_IODevice) CDM_Document::RequestedDevice() const
 {
-  return myRequestedFolderIsDefined;
+  return myRequestedDevice;
 }
 
 //=======================================================================
-//function : SetRequestedName
+//function : HasRequestedDevice
 //purpose  : 
 //=======================================================================
 
-void CDM_Document::SetRequestedName(const TCollection_ExtendedString& aName)
+Standard_Boolean CDM_Document::HasRequestedDevice() const
 {
-  myRequestedName=aName;
-  myRequestedNameIsDefined=Standard_True;
+  return !myRequestedDevice.IsNull();
 }
 
 //=======================================================================
@@ -797,14 +779,16 @@ void CDM_Document::SetRequestedName(const TCollection_ExtendedString& aName)
 
 TCollection_ExtendedString CDM_Document::RequestedName()
 {
-  if(!myRequestedNameIsDefined) {
-    if(!myMetaData.IsNull())
-      myRequestedName=myMetaData->Name();
-    else
-      myRequestedName=Presentation();
-  }
-  myRequestedNameIsDefined=Standard_True;
-  return myRequestedName;
+  TCollection_ExtendedString aName;
+
+  if ( !myRequestedDevice.IsNull() )
+    aName = myRequestedDevice->Name();
+  else if ( !myMetaData.IsNull() )
+    aName = myMetaData->Name();
+  else
+    aName = Presentation();
+
+  return aName;
 }
 
 //=======================================================================
index c5119c37033fbb3e8b9fea832a5bf4662589b50f..0d9386c9ee49fa33951f623b2d4c304198e226a5 100644 (file)
 
 class MetaData from CDM inherits Transient from Standard
 
-uses ExtendedString from TCollection,Document from CDM,MetaDataLookUpTable from CDM, DocumentPointer from CDM,
-Application from CDM
+uses ExtendedString from TCollection,
+     Document from CDM,
+     MetaDataLookUpTable from CDM,
+     DocumentPointer from CDM,
+     Application from CDM,
+     IODevice from Storage
+     
 raises NoSuchObject from Standard
 
 is
     
-    Create(aFolder,aName, aPath: ExtendedString from TCollection;
-           aFileName: ExtendedString from TCollection; ReadOnly:Boolean from Standard)
-    returns  MetaData from CDM is private;
-
-    Create(aFolder,aName, aPath, aVersion: ExtendedString from TCollection;
-           aFileName: ExtendedString from TCollection; ReadOnly:Boolean from Standard)
-    returns  MetaData from CDM is private;
-
-
-
-    LookUp(myclass; aFolder,aName, aPath: ExtendedString from TCollection; 
-           aFileName: ExtendedString from TCollection; ReadOnly:Boolean from Standard)
-    returns  MetaData from CDM;
-
-    LookUp(myclass; aFolder,aName, aPath, aVersion: ExtendedString from TCollection; aFileName: ExtendedString from TCollection; ReadOnly:Boolean from Standard)
-    returns  MetaData from CDM;
+    Create(aDevice: IODevice from Storage; ReadOnly:Boolean from Standard)
+    returns MetaData from CDM is private;
 
+    Create(aDevice: IODevice from Storage; aVersion: ExtendedString from TCollection; ReadOnly:Boolean from Standard)
+    returns MetaData from CDM is private;
 
+    LookUp(myclass; aDevice: IODevice from Storage; ReadOnly:Boolean from Standard)
+    returns MetaData from CDM;
 
+    LookUp(myclass; aDevice: IODevice from Storage; aVersion: ExtendedString from TCollection; ReadOnly:Boolean from Standard)
+    returns MetaData from CDM;
 
     IsRetrieved(me) returns Boolean from Standard;
 
     Document(me) returns Document from CDM;
     
-    Folder(me) returns ExtendedString from TCollection;
+--    Folder(me) returns ExtendedString from TCollection;
     ---Purpose: returns the folder in which the meta-data has to be created 
     --          or has to be found.
     --          
@@ -65,7 +62,7 @@ is
     ---Purpose: indicates that the version has to be taken into account when
     --          searching the corresponding meta-data.
 
-    FileName(me) returns ExtendedString from TCollection;
+--    FileName(me) returns ExtendedString from TCollection;
     ---Category: programming facility
     --           
     Print(me; anOStream:  in out OStream from Standard)
@@ -74,8 +71,9 @@ is
     ---C++: alias "Standard_OStream& operator << (Standard_OStream& anOStream);"
     --      
 
-    Path(me) returns ExtendedString from TCollection;
-    
+--    Path(me) returns ExtendedString from TCollection;
+
+    Device(me) returns IODevice from Storage;
    
     ---Category: methods to modify the metadata.
     --           
@@ -100,15 +98,17 @@ is
 fields
     myIsRetrieved: Boolean from Standard;
     myDocument: DocumentPointer from CDM;
-    myFolder: ExtendedString from TCollection;
+
+--    myFolder: ExtendedString from TCollection;
     myName: ExtendedString from TCollection;
 
     myVersion: ExtendedString from TCollection;
     myHasVersion: Boolean from Standard;
 
-    myFileName: ExtendedString from TCollection;
-    myPath: ExtendedString from TCollection;
+--    myFileName: ExtendedString from TCollection;
+--    myPath: ExtendedString from TCollection;
 
+    myDevice : IODevice from Storage;
 
     myDocumentVersion: Integer from Standard;
     
index 2f945a82b34e44751728a2f6ef966077dbf72c52..ca848d6ae1d25a8ce4494c2a5b250d355868f537 100644 (file)
 #include <CDM_MetaData.ixx>
 #include <CDM_MetaDataLookUpTable.hxx>
 
+#include <TCollection_AsciiString.hxx>
+
 static CDM_MetaDataLookUpTable& getLookUpTable(){
   static CDM_MetaDataLookUpTable theLookUpTable;
   return theLookUpTable;
 }
-CDM_MetaData::CDM_MetaData(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aPath,const TCollection_ExtendedString& aFileName,const Standard_Boolean ReadOnly):
+
+CDM_MetaData::CDM_MetaData(const Handle(Storage_IODevice)& aDevice, const Standard_Boolean ReadOnly):
 myIsRetrieved(Standard_False),
-myFolder(aFolder),
-myName(aName),
+//myFolder(aFolder),
+//myName(aName),
 myHasVersion(Standard_False),
-myFileName(aFileName),
-myPath(aPath),
+//myFileName(aFileName),
+//myPath(aPath),
+myDevice(aDevice),
 myDocumentVersion(0),
 myIsReadOnly(ReadOnly) 
-{}
+{
+}
 
-CDM_MetaData::CDM_MetaData(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aPath,const TCollection_ExtendedString& aVersion,const TCollection_ExtendedString& aFileName,const Standard_Boolean ReadOnly):
+CDM_MetaData::CDM_MetaData(const Handle(Storage_IODevice)& aDevice, const TCollection_ExtendedString& aVersion, const Standard_Boolean ReadOnly):
 myIsRetrieved(Standard_False),
-myFolder(aFolder),
-myName(aName),
+//myFolder(aFolder),
+//myName(aName),
 myVersion(aVersion),
 myHasVersion(Standard_True),
-myFileName(aFileName),
-myPath(aPath),
+//myFileName(aFileName),
+//myPath(aPath),
+myDevice(aDevice),
 myDocumentVersion(0),
 myIsReadOnly(ReadOnly)  
-{}
+{
+}
 
 Standard_Boolean CDM_MetaData::IsRetrieved() const {
   return myIsRetrieved;
@@ -59,60 +66,81 @@ void CDM_MetaData::SetDocument(const Handle(CDM_Document)& aDocument) {
 void CDM_MetaData::UnsetDocument() {
   myIsRetrieved = Standard_False;
 }
-Handle(CDM_MetaData) CDM_MetaData::LookUp(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aPath,const TCollection_ExtendedString& aFileName,const Standard_Boolean ReadOnly) {
+
+Handle(CDM_MetaData) CDM_MetaData::LookUp(const Handle(Storage_IODevice)& aDevice, const Standard_Boolean ReadOnly) {
   Handle(CDM_MetaData) theMetaData;
-  TCollection_ExtendedString aConventionalPath=aPath;
-  aConventionalPath.ChangeAll('\\','/');
-  if(!getLookUpTable().IsBound(aConventionalPath)) {
-    theMetaData = new CDM_MetaData(aFolder,aName,aPath,aFileName,ReadOnly);
-    getLookUpTable().Bind(aConventionalPath,theMetaData);
+  TCollection_AsciiString aSig;
+  if ( !aDevice.IsNull() )
+    aSig = aDevice->Signature();
+
+  if ( aSig.IsEmpty() || !getLookUpTable().IsBound(aSig) ) {
+    theMetaData = new CDM_MetaData(aDevice, ReadOnly);
+    if ( !aSig.IsEmpty() )
+        getLookUpTable().Bind(aSig, theMetaData);
   }
   else
-    theMetaData = getLookUpTable()(aConventionalPath);
-  
+    theMetaData = getLookUpTable()(aSig);
+
   return theMetaData;
 }
-Handle(CDM_MetaData) CDM_MetaData::LookUp(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aPath, const TCollection_ExtendedString& aVersion, const TCollection_ExtendedString& aFileName,const Standard_Boolean ReadOnly) {
+
+Handle(CDM_MetaData) CDM_MetaData::LookUp(const Handle(Storage_IODevice)& aDevice, const TCollection_ExtendedString& aVersion, const Standard_Boolean ReadOnly) {
   Handle(CDM_MetaData) theMetaData;
-  TCollection_ExtendedString aConventionalPath=aPath;
-  aConventionalPath.ChangeAll('\\','/');
-  if(!getLookUpTable().IsBound(aConventionalPath)) {
-    theMetaData = new CDM_MetaData(aFolder,aName,aPath,aVersion,aFileName,ReadOnly);
-    getLookUpTable().Bind(aConventionalPath,theMetaData);
+  TCollection_AsciiString aSig;
+  if ( !aDevice.IsNull() )
+    aSig = aDevice->Signature();
+
+  if ( aSig.IsEmpty() || !getLookUpTable().IsBound(aSig) ) {
+    theMetaData = new CDM_MetaData(aDevice, aVersion, ReadOnly);
+    if ( !aSig.IsEmpty() )
+        getLookUpTable().Bind(aSig, theMetaData);
   }
   else
-    theMetaData = getLookUpTable()(aConventionalPath);
-  
+    theMetaData = getLookUpTable()(aSig);
+
   return theMetaData;
 }
-
+/*
 TCollection_ExtendedString CDM_MetaData::Folder() const {
   return myFolder;
 }
+*/
 TCollection_ExtendedString CDM_MetaData::Name() const {
-  return myName;
+  TCollection_ExtendedString aName;
+  if ( !Device().IsNull() )
+    aName = Device()->Name();
+  return aName;
 }
+
 TCollection_ExtendedString CDM_MetaData::Version() const {
   Standard_NoSuchObject_Raise_if(!myHasVersion,"Document has no version");
   return myVersion;
 }
+
 Standard_Boolean CDM_MetaData::HasVersion() const {
   return myHasVersion;
 }
-
+/*
 TCollection_ExtendedString CDM_MetaData::FileName() const {
   return myFileName;
 }
 TCollection_ExtendedString CDM_MetaData::Path() const {
   return myPath;
 }
+*/
+
+Handle(Storage_IODevice) CDM_MetaData::Device() const
+{
+    return myDevice;
+}
+
 Standard_OStream& CDM_MetaData::Print(Standard_OStream& anOStream) const {
   anOStream << "*CDM_MetaData*";
-  anOStream <<  myFolder << "," << myName; 
+  //  anOStream <<  myFolder << "," << myName; 
   if(HasVersion()) anOStream << "," << myVersion ;
-  anOStream << "; Physical situation: ";
-  anOStream << myFileName;
-  anOStream << endl;
+  //  anOStream << "; Physical situation: ";
+  //  anOStream << myFileName;
+  //  anOStream << endl;
   return anOStream;
 }
 Standard_OStream& CDM_MetaData::operator << (Standard_OStream& anOStream) {
index 820fbed5199e41c8ddf3f760b407cc4a9957b93d..b2faa3b5ba815e16e50dd30bec15573f0483de76 100644 (file)
@@ -55,8 +55,7 @@
 #include <TDF_RelocationTable.hxx>
 #include <TDF_Tool.hxx>
 
-#include <DDF_IOStream.hxx>
-
+#include <Storage_Error.hxx>
 
 //=======================================================================
 //function : Children
diff --git a/src/DDF/DDF_IOStream.cxx b/src/DDF/DDF_IOStream.cxx
deleted file mode 100644 (file)
index 46cd875..0000000
+++ /dev/null
@@ -1,1356 +0,0 @@
-// Created by: DAUTRY Philippe
-// Copyright (c) 1997-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//             ----------------
-
-// Version:    0.0
-//Version      Date            Purpose
-//             0.0     Aug 22 1997     Creation
-
-#include <Standard_Stream.hxx>
-
-#include <DDF_IOStream.hxx>
-
-// This file has been written using FSD_File.cxx as template.
-// This is a specific adaptation for Draw use (save & restore commands).
-// It is not sure at all this code is portable on any other plateform than
-// SUN OS. Don't use it anywhere else.
-// Thanks for comprehension. (22 august 97)
-
-
-#include <Storage_StreamTypeMismatchError.hxx>
-#include <Storage_StreamFormatError.hxx>
-#include <Storage_StreamWriteError.hxx>
-#include <Storage_StreamExtCharParityError.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-
-#include <TColStd_SequenceOfAsciiString.hxx>
-#include <TColStd_SequenceOfExtendedString.hxx>
-
-const Standard_CString MAGICNUMBER = "FSDFILE";
-
-
-//=======================================================================
-//function : DDF_IOStream
-//purpose  : 
-//=======================================================================
-
-DDF_IOStream::DDF_IOStream() : 
-       myIStream(NULL),
-       myOStream(NULL)
-{}
-
-//=======================================================================
-//function : Open
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::Open(const TCollection_AsciiString& aName,const Storage_OpenMode aMode)
-{
-  //myIStream = NULL;
-  //myOStream = NULL;
-  //return Storage_VSOk;
-
-  Storage_Error result = Storage_VSOk;
-
-  SetName(aName);
-
-  if (OpenMode() == Storage_VSNone) {
-    if (aMode == Storage_VSRead) {
-      if (myIStream != NULL) delete myIStream;
-      myIStream = new ifstream(aName.ToCString(),ios::in); // ios::nocreate is not portable
-      if (myIStream->fail()) {
-       result = Storage_VSOpenError;
-      }
-      else {
-       myIStream->precision(17);
-        myIStream->imbue (std::locale::classic()); // always use C locale
-       SetOpenMode(aMode);
-      }
-    }
-    else if (aMode == Storage_VSWrite) {
-      if (myOStream != NULL) delete myOStream;
-      myOStream = new ofstream(aName.ToCString(),ios::out);
-      if (myOStream->fail()) {
-       result = Storage_VSOpenError;
-      }
-      else {
-       myOStream->precision(17);
-        myOStream->imbue (std::locale::classic()); // make sure to always use C locale
-       SetOpenMode(aMode);
-      }
-    }
-  }
-  else {
-    result = Storage_VSAlreadyOpen;
-  }
-
-  return result;
-}
-
-//=======================================================================
-//function : Open
-//purpose  : "Opens" an istream.
-//=======================================================================
-
-Storage_Error DDF_IOStream::Open(istream* anIStream)
-{
-  myOStream = NULL;
-  SetOpenMode(Storage_VSRead);
-  myIStream = anIStream;
-  myIStream->precision(17);
-  myIStream->imbue (std::locale::classic()); // use always C locale
-  SetName("DDF_IOStream");
-  return Storage_VSOk; // ou Storage_VSAlreadyOpen ?
-}
-
-//=======================================================================
-//function : Open
-//purpose  : "Opens" an ostream.
-//=======================================================================
-
-Storage_Error DDF_IOStream::Open(ostream* anOStream)
-{
-  myIStream = NULL;
-  SetOpenMode(Storage_VSWrite);
-  myOStream = anOStream;
-  myOStream->precision(17);
-  myOStream->imbue (std::locale::classic()); // use always C locale
-  SetName("DDF_IOStream");
-  return Storage_VSOk; // ou Storage_VSAlreadyOpen ?
-}
-
-//=======================================================================
-//function : IsEnd
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean DDF_IOStream::IsEnd()
-{
-  if (OpenMode() == Storage_VSRead) return myIStream->eof();
-  else                              return myOStream->eof();
-}
-
-//=======================================================================
-//function : Close
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::Close()
-{ return Storage_VSOk; }
-
-
-// ------------------ PROTECTED
-
-
-//=======================================================================
-//function : MagicNumber
-//purpose  : 
-//=======================================================================
-
-const Standard_CString DDF_IOStream::MagicNumber()
-{ return MAGICNUMBER; }
-
-//=======================================================================
-//function : FlushEndOfLine
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::FlushEndOfLine()
-{
-  static char Buffer[8192];
-  char c;
-  Standard_Boolean IsEnd = Standard_False;
-
-  while (!IsEnd && !DDF_IOStream::IsEnd()) {
-    Buffer[0] = '\0';
-    myIStream->get(Buffer,8192,'\n');
-
-    if (myIStream->get(c) && c != '\n') {
-    }
-    else {
-      IsEnd = Standard_True;
-    }
-  }
-}
-
-//=======================================================================
-//function : ReadLine
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadLine(TCollection_AsciiString& buffer)
-{
-  static char Buffer[8193];
-  char c;
-  Standard_Boolean IsEnd = Standard_False;
-  
-  buffer.Clear();
-
-  while (!IsEnd && !DDF_IOStream::IsEnd()) {
-    Buffer[0] = '\0';
-    myIStream->get(Buffer,8192,'\n');
-    
-    if (myIStream->get(c) && c != '\n') {
-      buffer += Buffer;
-      buffer += c;
-    }
-    else {
-      buffer += Buffer;
-      IsEnd = Standard_True;
-    }
-  }
-}
-
-
-//=======================================================================
-//function : WriteExtendedLine
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::WriteExtendedLine(const TCollection_ExtendedString& buffer)
-{
-  Standard_ExtString extBuffer;
-  Standard_Integer   i,c,d;
-
-  extBuffer = buffer.ToExtString();
-
-  for (i = 0; i < buffer.Length(); i++) {
-    c = (extBuffer[i] & 0x0000FF00 ) >> 8 ;
-    d = extBuffer[i] & 0x000000FF;
-
-    *myOStream << (char)c << (char)d;
-  }
-
-  *myOStream << (char)0 << "\n";
-}
-
-//=======================================================================
-//function : ReadExtendedLine
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadExtendedLine(TCollection_ExtendedString& buffer)
-{
-  char c = '\0';
-  Standard_ExtCharacter i = 0,j,check = 0;
-  Standard_Boolean fin = Standard_False;
-
-  buffer.Clear();
-
-  while (!fin && !IsEnd()) {
-    myIStream->get(c);
-    check++; 
-//    if (!(check % 2)) Storage_StreamExtCharParityError::Raise();
-    i = (Standard_ExtCharacter)c;
-    if (c == '\0') fin = Standard_True;
-    i = (i << 8);
-
-    myIStream->get(c);
-    check++;
-//    if ((check % 2) != 0) Storage_StreamExtCharParityError::Raise();
-//    cout << check << endl;
-    j = (Standard_ExtCharacter)c;
-    if (c != '\n') fin = Standard_False;
-    i |= (0x00FF & j);
-    buffer += (Standard_ExtCharacter)i;
-  }
-
-//  if ((check % 2) != 0) Storage_StreamExtCharParityError::Raise();
-//  cout << check << endl;
-}
-
-//=======================================================================
-//function : ReadChar
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadChar(TCollection_AsciiString& buffer, const Standard_Integer rsize)
-{
-  char             c;
-  Standard_Integer ccount = 0;
-
-  buffer.Clear();
-
-  while (!IsEnd() && (ccount < rsize)) {
-    myIStream->get(c);
-    buffer += c;
-    ccount++;
-  }
-}
-
-//=======================================================================
-//function : ReadString
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadString(TCollection_AsciiString& buffer)
-{
-  char c = '\0';
-  Standard_Boolean IsEnd = Standard_False;
-
-  buffer.Clear();
-
-  while (!IsEnd && !DDF_IOStream::IsEnd()) {
-    myIStream->get(c);
-    if ((c != ' ') && (c != '\n')) IsEnd = Standard_True;
-  }
-
-  IsEnd = Standard_False;
-
-  while (!IsEnd && !DDF_IOStream::IsEnd()) {
-    buffer += c;
-    myIStream->get(c);
-    if (c == '\n') IsEnd = Standard_True;
-  }
-}
-
-//=======================================================================
-//function : ReadWord
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadWord(TCollection_AsciiString& buffer)
-{
-  char c = '\0';
-  Standard_Boolean IsEnd = Standard_False;
-
-  buffer.Clear();
-
-  while (!IsEnd && !DDF_IOStream::IsEnd()) {
-    myIStream->get(c);
-    if ((c != ' ') && (c != '\n')) IsEnd = Standard_True;
-  }
-
-  IsEnd = Standard_False;
-
-  while (!IsEnd && !DDF_IOStream::IsEnd()) {
-    buffer += c;
-    myIStream->get(c);
-    if ((c == '\n') || (c == ' ')) IsEnd = Standard_True;
-  }
-}
-
-//=======================================================================
-//function : FindTag
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::FindTag(const Standard_CString aTag)
-{
-  TCollection_AsciiString l;
-  
-  ReadString(l);
-
-  while ((strcmp(l.ToCString(),aTag) != 0) && !IsEnd()) {
-    ReadString(l);
-  }
-
-  if (IsEnd()) {
-    return Storage_VSSectionNotFound;
-  }
-  else {
-    return Storage_VSOk;
-  }
-}
-
-//=======================================================================
-//function : SkipObject
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::SkipObject()
-{
-  FlushEndOfLine();
-}
-
-
-// ---------------------- PUBLIC : PUT
-
-
-//=======================================================================
-//function : PutReference
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::PutReference(const Standard_Integer aValue)
-{
-  *myOStream << aValue << " ";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise("PutReference");
-  return *this;
-}
-
-//=======================================================================
-//function : PutCharacter
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::PutCharacter(const Standard_Character aValue)
-{
-  *myOStream << aValue << " ";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise("PutCharacter");
-  return *this;
-}
-
-//=======================================================================
-//function : PutExtCharacter
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::PutExtCharacter(const Standard_ExtCharacter aValue)
-{
-  *myOStream << aValue << " ";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise("PutExtCharacter");
-  return *this;
-}
-
-//=======================================================================
-//function : PutInteger
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::PutInteger(const Standard_Integer aValue)
-{
-  *myOStream << aValue << " ";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise("PutInteger");
-  return *this;
-}
-
-//=======================================================================
-//function : PutBoolean
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::PutBoolean(const Standard_Boolean aValue)
-{
-  *myOStream << ((Standard_Integer)aValue) << " ";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise("PutBoolean");
-  return *this;
-}
-
-//=======================================================================
-//function : PutReal
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::PutReal(const Standard_Real aValue)
-{
-  *myOStream << ((Standard_Real)aValue) << " ";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise("PutReal");
-  return *this;
-}
-
-//=======================================================================
-//function : PutShortReal
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::PutShortReal(const Standard_ShortReal aValue)
-{
-  *myOStream << aValue << " ";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise("PutShortReal");
-  return *this;
-}
-
-
-// ----------------- PUBLIC : GET
-
-
-//=======================================================================
-//function : GetReference
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::GetReference(Standard_Integer& aValue)
-{
-  if (!(*myIStream >> aValue)) Storage_StreamTypeMismatchError::Raise("GetReference");
-  return *this;
-}
-
-//=======================================================================
-//function : GetCharacter
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::GetCharacter(Standard_Character& aValue)
-{
-  if (!(*myIStream >> aValue)) Storage_StreamTypeMismatchError::Raise("GetCharacter");
-  return *this;
-}
-
-//=======================================================================
-//function : GetExtCharacter
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::GetExtCharacter(Standard_ExtCharacter& aValue)
-{
-  if (!(*myIStream >> aValue)) Storage_StreamTypeMismatchError::Raise("GetExtCharacter");
-  return *this;
-}
-
-//=======================================================================
-//function : GetInteger
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::GetInteger(Standard_Integer& aValue)
-{
-  if (!(*myIStream >> aValue)) Storage_StreamTypeMismatchError::Raise("GetInteger");
-  return *this;
-}
-
-//=======================================================================
-//function : GetBoolean
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::GetBoolean(Standard_Boolean& aValue)
-{
-  if (!(*myIStream >> aValue)) Storage_StreamTypeMismatchError::Raise("GetBoolean");
-  return *this;
-}
-
-//=======================================================================
-//function : GetReal
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::GetReal(Standard_Real& aValue)
-{
-  if (!(*myIStream >> aValue)) Storage_StreamTypeMismatchError::Raise("GetReal");
-  return *this;
-}
-
-//=======================================================================
-//function : GetShortReal
-//purpose  : 
-//=======================================================================
-
-Storage_BaseDriver& DDF_IOStream::GetShortReal(Standard_ShortReal& aValue)
-{
-  if (!(*myIStream >> aValue)) Storage_StreamTypeMismatchError::Raise("GetShortReal");
-  return *this;
-}
-
-// -------------------------- DESTROY
-
-//=======================================================================
-//function : Destroy
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::Destroy()
-{
-  if (OpenMode() != Storage_VSNone) Close();
-}
-
-
-// -------------------------- INFO : WRITE
-
-
-//=======================================================================
-//function : BeginWriteInfoSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginWriteInfoSection() 
-{
-  *myOStream << DDF_IOStream::MagicNumber() << '\n';
-  *myOStream << "BEGIN_INFO_SECTION\n";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-
-  return Storage_VSOk;
-}
-
-//=======================================================================
-//function : WriteInfo
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::WriteInfo(const Standard_Integer nbObj,
-                        const TCollection_AsciiString& dbVersion,
-                        const TCollection_AsciiString& date,
-                        const TCollection_AsciiString& schemaName,
-                        const TCollection_AsciiString& schemaVersion,
-                        const TCollection_ExtendedString& appName,
-                        const TCollection_AsciiString& appVersion,
-                        const TCollection_ExtendedString& dataType,
-                        const TColStd_SequenceOfAsciiString& userInfo) 
-{
-  Standard_Integer i;
-//  char *extBuffer;
-
-  *myOStream << nbObj;
-  *myOStream << "\n";
-  *myOStream << dbVersion.ToCString() << "\n";
-  *myOStream << date.ToCString() << "\n";
-  *myOStream << schemaName.ToCString() << "\n";
-  *myOStream << schemaVersion.ToCString() << "\n";
-  WriteExtendedLine(appName);
-  *myOStream << appVersion.ToCString() << "\n";
-  WriteExtendedLine(dataType);
-  *myOStream << userInfo.Length() << "\n";
-
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-
-  for (i = 1; i <= userInfo.Length(); i++) {
-    *myOStream << userInfo.Value(i).ToCString() << "\n";
-    if (myOStream->bad()) Storage_StreamWriteError::Raise();
-  }
-}
-
-
-//=======================================================================
-//function : EndWriteInfoSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndWriteInfoSection() 
-{
-  *myOStream << "END_INFO_SECTION\n";
-  if (myOStream->bad())  Storage_StreamWriteError::Raise();
-  return Storage_VSOk;
-}
-
-//=======================================================================
-//function : BeginReadInfoSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginReadInfoSection() 
-{
-  Storage_Error s;
-  TCollection_AsciiString l;
-  Standard_Integer        len = (Standard_Integer) strlen(DDF_IOStream::MagicNumber());
-
-  // Added because of Draw:
-  // It don't go to next line after reading its own header line information!
-  FlushEndOfLine();
-  ReadChar(l,len);
-  
-  if (strncmp(DDF_IOStream::MagicNumber(),l.ToCString(),len) != 0) {
-#ifdef OCCT_DEBUG
-    cout<<"BeginReadInfoSection: format error"<<endl;
-#endif
-    s = Storage_VSFormatError;
-  }
-  else {
-    s = FindTag("BEGIN_INFO_SECTION");
-  }
-
-  return s;
-}
-
-
-// ------------------- INFO : READ
-
-
-//=======================================================================
-//function : ReadInfo
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadInfo(Standard_Integer& nbObj,
-                       TCollection_AsciiString& dbVersion,
-                       TCollection_AsciiString& date,
-                       TCollection_AsciiString& schemaName,
-                       TCollection_AsciiString& schemaVersion,
-                       TCollection_ExtendedString& appName,
-                       TCollection_AsciiString& appVersion,
-                       TCollection_ExtendedString& dataType,
-                       TColStd_SequenceOfAsciiString& userInfo) 
-{
-  if (!(*myIStream >> nbObj)) Storage_StreamTypeMismatchError::Raise("ReadInfo 1");
-
-  FlushEndOfLine();
-
-  ReadLine(dbVersion);
-  ReadLine(date);
-  ReadLine(schemaName);
-  ReadLine(schemaVersion);
-  ReadExtendedLine(appName);
-  ReadLine(appVersion);
-  ReadExtendedLine(dataType);
-
-  Standard_Integer i,len = 0;
-
-  if (!(*myIStream >> len)) Storage_StreamTypeMismatchError::Raise("ReadInfo 2");
-
-  FlushEndOfLine();
-
-  TCollection_AsciiString line;
-
-  for (i = 1; i <= len && !IsEnd(); i++) {
-    ReadLine(line);
-    userInfo.Append(line);
-    line.Clear();
-  }
-}
-
-//=======================================================================
-//function : EndReadInfoSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndReadInfoSection() 
-{ return FindTag("END_INFO_SECTION"); }
-
-
-// ---------------- COMMENTS : WRITE
-
-
-//=======================================================================
-//function : BeginWriteCommentSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginWriteCommentSection() 
-{
-  *myOStream << "BEGIN_COMMENT_SECTION\n";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-  return Storage_VSOk;
-}
-
-//=======================================================================
-//function : WriteComment
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::WriteComment(const TColStd_SequenceOfExtendedString& aCom)
-{
- Standard_Integer i,aSize;
-
- aSize = aCom.Length();
- *myOStream << aSize << "\n";
- if (myOStream->bad()) Storage_StreamWriteError::Raise();
-
- for (i = 1; i <= aSize; i++) {
-   WriteExtendedLine(aCom.Value(i));
-   if (myOStream->bad()) Storage_StreamWriteError::Raise();
- }
-}
-
-//=======================================================================
-//function : EndWriteCommentSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndWriteCommentSection() 
-{
-  *myOStream << "END_COMMENT_SECTION\n";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-  return Storage_VSOk;
-}
-
-
-// ---------------- COMMENTS : READ
-
-
-//=======================================================================
-//function : BeginReadCommentSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginReadCommentSection() 
-{
-  return FindTag("BEGIN_COMMENT_SECTION");
-}
-
-//=======================================================================
-//function : ReadComment
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadComment(TColStd_SequenceOfExtendedString& aCom)
-{
-  TCollection_ExtendedString line;
-  Standard_Integer           len,i;
-
-  if (!(*myIStream >> len)) Storage_StreamTypeMismatchError::Raise("ReadComment");
-  
-  FlushEndOfLine();  
-
-  for (i = 1; i <= len && !IsEnd(); i++) {
-    ReadExtendedLine(line);
-    aCom.Append(line);
-    line.Clear();
-  }
-}
-
-//=======================================================================
-//function : EndReadCommentSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndReadCommentSection() 
-{ return FindTag("END_COMMENT_SECTION"); }
-
-
-// --------------- TYPE : WRITE
-
-
-//=======================================================================
-//function : BeginWriteTypeSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginWriteTypeSection() 
-{
-  *myOStream << "BEGIN_TYPE_SECTION\n";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-  return Storage_VSOk;
-}
-
-//=======================================================================
-//function : SetTypeSectionSize
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::SetTypeSectionSize(const Standard_Integer aSize) 
-{
-  *myOStream << aSize << "\n";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-}
-
-//=======================================================================
-//function : WriteTypeInformations
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::WriteTypeInformations(const Standard_Integer typeNum,
-                                     const TCollection_AsciiString& typeName) 
-{
-  *myOStream << typeNum << " " << typeName.ToCString() << "\n";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-}
-
-//=======================================================================
-//function : EndWriteTypeSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndWriteTypeSection() 
-{
-  *myOStream << "END_TYPE_SECTION\n";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-  return Storage_VSOk;
-}
-
-
-// ------------------- TYPE : READ
-
-
-//=======================================================================
-//function : BeginReadTypeSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginReadTypeSection() 
-{ return FindTag("BEGIN_TYPE_SECTION"); }
-
-//=======================================================================
-//function : TypeSectionSize
-//purpose  : 
-//=======================================================================
-
-Standard_Integer DDF_IOStream::TypeSectionSize() 
-{
-  Standard_Integer i;
-
-  if (!(*myIStream >> i)) Storage_StreamTypeMismatchError::Raise("TypeSectionSize");
-
-  FlushEndOfLine();
-
-  return i;
-}
-
-//=======================================================================
-//function : ReadTypeInformations
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadTypeInformations(Standard_Integer& typeNum,
-                                   TCollection_AsciiString& typeName) 
-{
-  if (!(*myIStream >> typeNum)) Storage_StreamTypeMismatchError::Raise("ReadTypeInformations 1");
-  if (!(*myIStream >> typeName)) Storage_StreamTypeMismatchError::Raise("ReadTypeInformations 2");
-  FlushEndOfLine();
-}
-
-//=======================================================================
-//function : EndReadTypeSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndReadTypeSection() 
-{
-  return FindTag("END_TYPE_SECTION");
-}
-
-
-// -------------------- ROOT : WRITE
-
-
-//=======================================================================
-//function : BeginWriteRootSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginWriteRootSection() 
-{
-  *myOStream << "BEGIN_ROOT_SECTION\n";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-  return Storage_VSOk;
-}
-
-//=======================================================================
-//function : SetRootSectionSize
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::SetRootSectionSize(const Standard_Integer aSize) 
-{
-  *myOStream << aSize << "\n";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-}
-
-//=======================================================================
-//function : WriteRoot
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::WriteRoot(const TCollection_AsciiString& rootName, const Standard_Integer aRef, const TCollection_AsciiString& rootType) 
-{
-  *myOStream << aRef << " " << rootName.ToCString() << " " << rootType.ToCString() << "\n";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-}
-
-//=======================================================================
-//function : EndWriteRootSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndWriteRootSection() 
-{
-  *myOStream << "END_ROOT_SECTION\n";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-  return Storage_VSOk;
-}
-
-
-// ----------------------- ROOT : READ
-
-
-//=======================================================================
-//function : BeginReadRootSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginReadRootSection() 
-{ return FindTag("BEGIN_ROOT_SECTION"); }
-
-//=======================================================================
-//function : RootSectionSize
-//purpose  : 
-//=======================================================================
-
-Standard_Integer DDF_IOStream::RootSectionSize() 
-{
-  Standard_Integer i;
-
-  if (!(*myIStream >> i)) Storage_StreamTypeMismatchError::Raise("RootSectionSize");
-  
-  FlushEndOfLine();
-  
-  return i;
-}
-
-//=======================================================================
-//function : ReadRoot
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadRoot(TCollection_AsciiString& rootName, Standard_Integer& aRef,TCollection_AsciiString& rootType) 
-{
-  if (!(*myIStream >> aRef)) Storage_StreamTypeMismatchError::Raise("ReadRoot");
-  ReadWord(rootName);
-  ReadWord(rootType);
-}
-
-//=======================================================================
-//function : EndReadRootSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndReadRootSection() 
-{ return FindTag("END_ROOT_SECTION"); }
-
-
-// -------------------------- REF : WRITE
-
-
-//=======================================================================
-//function : BeginWriteRefSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginWriteRefSection() 
-{
-  *myOStream << "BEGIN_REF_SECTION\n";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-  return Storage_VSOk;
-}
-
-//=======================================================================
-//function : SetRefSectionSize
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::SetRefSectionSize(const Standard_Integer aSize) 
-{
-  *myOStream << aSize << "\n";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-}
-
-//=======================================================================
-//function : WriteReferenceType
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::WriteReferenceType(const Standard_Integer reference,
-                                 const Standard_Integer typeNum) 
-{
-  *myOStream << reference << " " << typeNum << "\n";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-}
-
-//=======================================================================
-//function : EndWriteRefSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndWriteRefSection() 
-{
-  *myOStream << "END_REF_SECTION\n";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-  return Storage_VSOk;
-}
-
-
-// ----------------------- REF : READ
-
-
-//=======================================================================
-//function : BeginReadRefSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginReadRefSection() 
-{ return FindTag("BEGIN_REF_SECTION"); }
-
-//=======================================================================
-//function : RefSectionSize
-//purpose  : 
-//=======================================================================
-
-Standard_Integer DDF_IOStream::RefSectionSize() 
-{
-  Standard_Integer i;
-
-  if (!(*myIStream >> i)) Storage_StreamTypeMismatchError::Raise("RefSectionSize");
-  FlushEndOfLine();
-
-  return i;
-}
-
-//=======================================================================
-//function : ReadReferenceType
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadReferenceType(Standard_Integer& reference,
-                                Standard_Integer& typeNum) 
-{
-  if (!(*myIStream >> reference)) Storage_StreamTypeMismatchError::Raise("ReadReferenceType 1");
-  if (!(*myIStream >> typeNum)) Storage_StreamTypeMismatchError::Raise("ReadReferenceType 2");
-  FlushEndOfLine();
-}
-
-//=======================================================================
-//function : EndReadRefSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndReadRefSection() 
-{
-  return FindTag("END_REF_SECTION");
-}
-
-
-// -------------------- DATA : WRITE
-
-
-//=======================================================================
-//function : BeginWriteDataSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginWriteDataSection() 
-{
-  *myOStream << "BEGIN_DATA_SECTION";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-  return Storage_VSOk;
-}
-
-//=======================================================================
-//function : WritePersistentObjectHeader
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::WritePersistentObjectHeader(const Standard_Integer aRef,
-                                          const Standard_Integer aType) 
-{
-  *myOStream << "\n#" << aRef << "=%" << aType;
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-}
-
-//=======================================================================
-//function : BeginWritePersistentObjectData
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::BeginWritePersistentObjectData() 
-{
-  *myOStream << "( ";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-}
-
-//=======================================================================
-//function : BeginWriteObjectData
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::BeginWriteObjectData() 
-{
-  *myOStream << "( ";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-}
-
-//=======================================================================
-//function : EndWriteObjectData
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::EndWriteObjectData() 
-{
-  *myOStream << ") ";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-}
-
-//=======================================================================
-//function : EndWritePersistentObjectData
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::EndWritePersistentObjectData() 
-{
-  *myOStream << ")";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-}
-
-//=======================================================================
-//function : EndWriteDataSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndWriteDataSection() 
-{
-  *myOStream << "\nEND_DATA_SECTION\n";
-  if (myOStream->bad()) Storage_StreamWriteError::Raise();
-  return Storage_VSOk;
-}
-
-
-// ---------------------- DATA : READ
-
-
-//=======================================================================
-//function : BeginReadDataSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::BeginReadDataSection() 
-{ return FindTag("BEGIN_DATA_SECTION"); }
-
-//=======================================================================
-//function : ReadPersistentObjectHeader
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::ReadPersistentObjectHeader(Standard_Integer& aRef,
-                                         Standard_Integer& aType) 
-{
-  char c;
-
-  myIStream->get(c);
-
-  while (c != '#') {
-    if (IsEnd() || (c != ' ') || (c == '\n')) {
-      Storage_StreamFormatError::Raise();
-    }
-    myIStream->get(c);
-  }
-
-  if (!(*myIStream >> aRef)) Storage_StreamTypeMismatchError::Raise("ReadPersistentObjectHeader 1");
-  myIStream->get(c);
-
-  while (c != '=') {
-    if (IsEnd() || (c != ' ') || (c == '\n')) {
-      Storage_StreamFormatError::Raise();
-    }
-    myIStream->get(c);
-  }
-
-  myIStream->get(c);
-
-  while (c != '%') {
-    if (IsEnd() || (c != ' ') || (c == '\n')) {
-      Storage_StreamFormatError::Raise();
-    }
-    myIStream->get(c);
-  }
-
-  if (!(*myIStream >> aType)) Storage_StreamTypeMismatchError::Raise("ReadPersistentObjectHeader 2");
-}
-
-//=======================================================================
-//function : BeginReadPersistentObjectData
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::BeginReadPersistentObjectData() 
-{
-  char c;
-  myIStream->get(c);
-  while (c != '(') {
-    if (IsEnd() || (c != ' ') || (c == '\n')) {
-      Storage_StreamFormatError::Raise();
-    }
-    myIStream->get(c);
-  }
-}
-
-//=======================================================================
-//function : BeginReadObjectData
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::BeginReadObjectData() 
-{
-  char c;
-  myIStream->get(c);
-  while (c != '(') {
-    if (IsEnd() || (c != ' ') || (c == '\n')) {
-      Storage_StreamFormatError::Raise("BeginReadObjectData");
-    }
-    myIStream->get(c);
-  }
-}
-
-//=======================================================================
-//function : EndReadObjectData
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::EndReadObjectData() 
-{
-  char c;
-  myIStream->get(c);
-  while (c != ')') {
-    if (IsEnd() || (c != ' ') || (c == '\n')) {
-      Storage_StreamFormatError::Raise("EndReadObjectData");
-    }
-    myIStream->get(c);
-  }
-}
-
-//=======================================================================
-//function : EndReadPersistentObjectData
-//purpose  : 
-//=======================================================================
-
-void DDF_IOStream::EndReadPersistentObjectData() 
-{
-  char c;
-
-  myIStream->get(c);
-  while (c != ')') {
-    if (IsEnd() || (c != ' ') || (c == '\n')) {
-      Storage_StreamFormatError::Raise("EndReadPersistentObjectData");
-    }
-    myIStream->get(c);
-  }
-
-  myIStream->get(c);
-  while (c != '\n') {
-    if (IsEnd() || (c != ' ')) {
-      Storage_StreamFormatError::Raise();
-    }
-    myIStream->get(c);
-  }
-}
-
-//=======================================================================
-//function : EndReadDataSection
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::EndReadDataSection() 
-{ return FindTag("END_DATA_SECTION"); }
-
-//=======================================================================
-//function : IsGoodFileType
-//purpose  : 
-//=======================================================================
-
-Storage_Error DDF_IOStream::IsGoodFileType(istream* anIStream)
-{
-  DDF_IOStream      f;
-  Storage_Error s;
-
-  s = f.Open(anIStream);
-
-  if (s == Storage_VSOk) {
-    TCollection_AsciiString l;
-    Standard_Integer        len = (Standard_Integer) strlen(DDF_IOStream::MagicNumber());
-
-    f.ReadChar(l,len);
-
-    f.Close();
-
-    if (strncmp(DDF_IOStream::MagicNumber(),l.ToCString(),len) != 0) {
-#ifdef OCCT_DEBUG
-    cout<<"IsGoodFileType: format error"<<endl;
-#endif
-      s = Storage_VSFormatError;
-    }
-  }
-
-  return s;
-}
-
diff --git a/src/DDF/DDF_IOStream.hxx b/src/DDF/DDF_IOStream.hxx
deleted file mode 100644 (file)
index 38fc0a1..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-// Created on: 1997-08-22
-// Created by: DAUTRY Philippe
-// Copyright (c) 1997-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// This file has been written using FSD_File.hxx as template.
-// This is a specific adaptation for Draw use (save & restore commands).
-// It is not sure at all this code is portable on any other plateform than
-// SUN OS. Don't use it anywhere else.
-// Thanks for comprehension. (22 august 97)
-
-
-#ifndef DDF_IOStream_HeaderFile
-#define DDF_IOStream_HeaderFile
-
-#include <stdio.h>
-
-#include <Storage_BaseDriver.hxx>
-#include <Storage_Error.hxx>
-#include <Storage_OpenMode.hxx>
-#include <Storage_Position.hxx>
-
-class Storage_StreamTypeMismatchError;
-class Storage_StreamFormatError;
-class Storage_StreamWriteError;
-class Storage_StreamExtCharParityError;
-
-class TColStd_SequenceOfExtendedString;
-
-#ifndef Standard_EXPORT
-#ifdef WNT
-#define Standard_EXPORT __declspec(dllexport)
-#else
-#define Standard_EXPORT
-#endif
-#endif
-#ifdef WNT
-#pragma warning (disable : 4275)
-#endif
-
-class Standard_EXPORT DDF_IOStream  : public Storage_BaseDriver {
-
-public:
-
- // Methods PUBLIC
- // 
-DDF_IOStream();
-  Storage_Error Open(const TCollection_AsciiString& aName,const Storage_OpenMode aMode) ;
-  Storage_Error Open(istream* anIStream) ;
-  Storage_Error Open(ostream* anOStream) ;
-  Standard_Boolean IsEnd() ;
-  Storage_Position Tell() { return -1; }
-static  Storage_Error IsGoodFileType(istream* anIStream) ;
-  Storage_Error BeginWriteInfoSection() ;
-  void WriteInfo(const Standard_Integer nbObj,const TCollection_AsciiString& dbVersion,const TCollection_AsciiString& date,const TCollection_AsciiString& schemaName,const TCollection_AsciiString& schemaVersion,const TCollection_ExtendedString& appName,const TCollection_AsciiString& appVersion,const TCollection_ExtendedString& objectType,const TColStd_SequenceOfAsciiString& userInfo) ;
-  Storage_Error EndWriteInfoSection() ;
-  Storage_Error BeginReadInfoSection() ;
-  void ReadInfo(Standard_Integer& nbObj,TCollection_AsciiString& dbVersion,TCollection_AsciiString& date,TCollection_AsciiString& schemaName,TCollection_AsciiString& schemaVersion,TCollection_ExtendedString& appName,TCollection_AsciiString& appVersion,TCollection_ExtendedString& objectType,TColStd_SequenceOfAsciiString& userInfo) ;
-  Storage_Error EndReadInfoSection() ;
-  Storage_Error BeginWriteCommentSection() ;
-  void WriteComment(const TColStd_SequenceOfExtendedString& userComments) ;
-  Storage_Error EndWriteCommentSection() ;
-  Storage_Error BeginReadCommentSection() ;
-  void ReadComment(TColStd_SequenceOfExtendedString& userComments) ;
-  Storage_Error EndReadCommentSection() ;
-  Storage_Error BeginWriteTypeSection() ;
-  void SetTypeSectionSize(const Standard_Integer aSize) ;
-  void WriteTypeInformations(const Standard_Integer typeNum,const TCollection_AsciiString& typeName) ;
-  Storage_Error EndWriteTypeSection() ;
-  Storage_Error BeginReadTypeSection() ;
-  Standard_Integer TypeSectionSize() ;
-  void ReadTypeInformations(Standard_Integer& typeNum,TCollection_AsciiString& typeName) ;
-  Storage_Error EndReadTypeSection() ;
-  Storage_Error BeginWriteRootSection() ;
-  void SetRootSectionSize(const Standard_Integer aSize) ;
-  void WriteRoot(const TCollection_AsciiString& rootName,const Standard_Integer aRef,const TCollection_AsciiString& aType) ;
-  Storage_Error EndWriteRootSection() ;
-  Storage_Error BeginReadRootSection() ;
-  Standard_Integer RootSectionSize() ;
-  void ReadRoot(TCollection_AsciiString& rootName,Standard_Integer& aRef,TCollection_AsciiString& aType) ;
-  Storage_Error EndReadRootSection() ;
-  Storage_Error BeginWriteRefSection() ;
-  void SetRefSectionSize(const Standard_Integer aSize) ;
-  void WriteReferenceType(const Standard_Integer reference,const Standard_Integer typeNum) ;
-  Storage_Error EndWriteRefSection() ;
-  Storage_Error BeginReadRefSection() ;
-  Standard_Integer RefSectionSize() ;
-  void ReadReferenceType(Standard_Integer& reference,Standard_Integer& typeNum) ;
-  Storage_Error EndReadRefSection() ;
-  Storage_Error BeginWriteDataSection() ;
-  void WritePersistentObjectHeader(const Standard_Integer aRef,const Standard_Integer aType) ;
-  void BeginWritePersistentObjectData() ;
-  void BeginWriteObjectData() ;
-  void EndWriteObjectData() ;
-  void EndWritePersistentObjectData() ;
-  Storage_Error EndWriteDataSection() ;
-  Storage_Error BeginReadDataSection() ;
-  void ReadPersistentObjectHeader(Standard_Integer& aRef,Standard_Integer& aType) ;
-  void BeginReadPersistentObjectData() ;
-  void BeginReadObjectData() ;
-  void EndReadObjectData() ;
-  void EndReadPersistentObjectData() ;
-  Storage_Error EndReadDataSection() ;
-  void SkipObject() ;
-  Storage_BaseDriver& PutReference(const Standard_Integer aValue) ;
-  Storage_BaseDriver& PutCharacter(const Standard_Character aValue) ;
-  Storage_BaseDriver& operator <<(const Standard_Character aValue) 
-{
-  return PutCharacter(aValue);
-}
-
-  Storage_BaseDriver& PutExtCharacter(const Standard_ExtCharacter aValue) ;
-  Storage_BaseDriver& operator <<(const Standard_ExtCharacter aValue) 
-{
-  return PutExtCharacter(aValue);
-}
-
-  Storage_BaseDriver& PutInteger(const Standard_Integer aValue) ;
-  Storage_BaseDriver& operator <<(const Standard_Integer aValue) 
-{
-  return PutInteger(aValue);
-}
-
-  Storage_BaseDriver& PutBoolean(const Standard_Boolean aValue) ;
-  Storage_BaseDriver& operator <<(const Standard_Boolean aValue) 
-{
-  return PutBoolean(aValue);
-}
-
-  Storage_BaseDriver& PutReal(const Standard_Real aValue) ;
-  Storage_BaseDriver& operator <<(const Standard_Real aValue) 
-{
-  return PutReal(aValue);
-}
-
-  Storage_BaseDriver& PutShortReal(const Standard_ShortReal aValue) ;
-  Storage_BaseDriver& operator <<(const Standard_ShortReal aValue) 
-{
-  return PutShortReal(aValue);
-}
-
-  Storage_BaseDriver& GetReference(Standard_Integer& aValue) ;
-  Storage_BaseDriver& GetCharacter(Standard_Character& aValue) ;
-  Storage_BaseDriver& operator >>(Standard_Character& aValue) 
-{
-  return GetCharacter(aValue);
-}
-
-  Storage_BaseDriver& GetExtCharacter(Standard_ExtCharacter& aValue) ;
-  Storage_BaseDriver& operator >>(Standard_ExtCharacter& aValue) 
-{
-  return GetExtCharacter(aValue);
-}
-
-  Storage_BaseDriver& GetInteger(Standard_Integer& aValue) ;
-  Storage_BaseDriver& operator >>(Standard_Integer& aValue) 
-{
-  return GetInteger(aValue);
-}
-
-  Storage_BaseDriver& GetBoolean(Standard_Boolean& aValue) ;
-  Storage_BaseDriver& operator >>(Standard_Boolean& aValue) 
-{
-  return GetBoolean(aValue);
-}
-
-  Storage_BaseDriver& GetReal(Standard_Real& aValue) ;
-  Storage_BaseDriver& operator >>(Standard_Real& aValue) 
-{
-  return GetReal(aValue);
-}
-
-  Storage_BaseDriver& GetShortReal(Standard_ShortReal& aValue) ;
-  Storage_BaseDriver& operator >>(Standard_ShortReal& aValue) 
-{
-  return GetShortReal(aValue);
-}
-
-  Storage_Error Close() ;
-  void Destroy() ;
-~DDF_IOStream()
-{
-  Destroy();
-}
-
-
-
-
-
-
-protected:
-
- // Methods PROTECTED
- // 
-  void ReadLine(TCollection_AsciiString& buffer) ;
-  void ReadWord(TCollection_AsciiString& buffer) ;
-  void ReadExtendedLine(TCollection_ExtendedString& buffer) ;
-  void WriteExtendedLine(const TCollection_ExtendedString& buffer) ;
-  void ReadChar(TCollection_AsciiString& buffer,const Standard_Integer rsize) ;
-  void ReadString(TCollection_AsciiString& buffer) ;
-  void FlushEndOfLine() ;
-  Storage_Error FindTag(const Standard_CString aTag) ;
-
-
- // Fields PROTECTED
- //
-
-
-private: 
-
- // Methods PRIVATE
- // 
-static const Standard_CString MagicNumber() ;
-
-
- // Fields PRIVATE
- //
-//FSD_FStream myStream;
-istream* myIStream;
-ostream* myOStream;
-
-
-};
-
-#ifdef WNT
-#pragma warning (default : 4275)
-#endif
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-#endif
index 5266a2b34a34c6ec2dafa67c5766823eff72a299..3f241001529207e3219538ddb708b26bd83cf6e1 100755 (executable)
@@ -4,6 +4,4 @@ DDF_BasicCommands.cxx
 DDF_DataCommands.cxx
 DDF_TransactionCommands.cxx
 DDF_BrowserCommands.cxx
-DDF_IOStream.cxx
-DDF_IOStream.hxx
 FILES
index f096a5cc2a25d0045b2ac0dce8354b5a5b5adabb..8b3ee2f8646832f76498f6b398a925b1a6d42c9a 100644 (file)
@@ -21,6 +21,7 @@ inherits BaseDriver from Storage
 uses Position    from Storage,
      Error       from Storage,
      OpenMode    from Storage,
+     IODevice    from Storage,
      AsciiString from TCollection,
      SequenceOfAsciiString from TColStd,
      SequenceOfExtendedString from TColStd,
@@ -36,15 +37,16 @@ raises StreamTypeMismatchError from Storage,
 is
     Create returns BinaryFile from FSD;
     
-    Open(me : in out; aName : AsciiString from TCollection; aMode : OpenMode from Storage) returns Error from Storage;
+    Open(me : in out; aDevice : IODevice from Storage; aMode : OpenMode from Storage)
+    returns Error from Storage is redefined;
         
     IsEnd(me : in out) returns Boolean from Standard;
 
     Tell( me : in out ) returns Position from Storage;
         ---Purpose: return position in the file. Return -1 upon error.
 
-    IsGoodFileType(myclass; aName : AsciiString from TCollection)
-       returns Error from Storage;
+    IsGoodFileType(myclass; aDevice : IODevice from Storage)
+    returns Error from Storage;
     
     -- INFO SECTION
     -- write
@@ -316,8 +318,7 @@ is
     WriteExtendedString(me : in out; buffer : ExtendedString from TCollection) is protected;
     ---Purpose: write string at the current position.    
     
-    fields
+fields
     
-       myStream    : BStream from FSD;
        myHeader    : FileHeader from FSD;
 end;
index bb90cd171f37139d762314a58f8f95f6a288c588..4a19f3d0c82e3765b1babff4a043cb28f206efa7 100644 (file)
@@ -23,8 +23,7 @@ const Standard_CString MAGICNUMBER = "BINFILE";
 //purpose  : 
 //=======================================================================
 
-FSD_BinaryFile::FSD_BinaryFile() :
-myStream(0L)
+FSD_BinaryFile::FSD_BinaryFile()
 {
   myHeader.testindian  = -1;
   myHeader.binfo       = -1;
@@ -47,12 +46,12 @@ myStream(0L)
 //           write
 //=======================================================================
 
-Storage_Error FSD_BinaryFile::IsGoodFileType(const TCollection_AsciiString& aName)
+Storage_Error FSD_BinaryFile::IsGoodFileType(const Handle(Storage_IODevice)& aDevice)
 {
   FSD_BinaryFile      f;
   Storage_Error s;
 
-  s = f.Open(aName,Storage_VSRead);
+  s = f.Open(aDevice, Storage_VSRead);
 
   if (s == Storage_VSOk) {
     TCollection_AsciiString l;
@@ -75,8 +74,16 @@ Storage_Error FSD_BinaryFile::IsGoodFileType(const TCollection_AsciiString& aNam
 //purpose  : 
 //=======================================================================
 
-Storage_Error FSD_BinaryFile::Open(const TCollection_AsciiString& aName,const Storage_OpenMode aMode)
+Storage_Error FSD_BinaryFile::Open(const Handle(Storage_IODevice)& aDevice, const Storage_OpenMode aMode)
 {
+  SetDevice(aDevice);
+
+  if ( Device().IsNull() )
+    return Storage_VSOpenError;
+
+  return Device()->Open(aMode);
+  
+/*
   Storage_Error result = Storage_VSOk;
 
   SetName(aName);
@@ -104,6 +111,7 @@ Storage_Error FSD_BinaryFile::Open(const TCollection_AsciiString& aName,const St
   }
 
   return result;
+*/
 }
 
 //=======================================================================
@@ -113,7 +121,7 @@ Storage_Error FSD_BinaryFile::Open(const TCollection_AsciiString& aName,const St
 
 Standard_Boolean FSD_BinaryFile::IsEnd()
 {
-  return (feof(myStream) != 0);
+  return !Device().IsNull() ? Device()->IsEnd() : Standard_True;
 }
 
 //=======================================================================
@@ -126,8 +134,9 @@ Storage_Error FSD_BinaryFile::Close()
   Storage_Error result = Storage_VSOk;
 
   if (OpenMode() != Storage_VSNone) {
-    fclose(myStream);
-    SetOpenMode(Storage_VSNone);
+    Device()->Close();
+    //    fclose(myStream);
+    //    SetOpenMode(Storage_VSNone);
   }
   else {
     result = Storage_VSNotOpen;
@@ -159,7 +168,7 @@ void FSD_BinaryFile::ReadChar(TCollection_AsciiString& buffer, const Standard_Si
   buffer.Clear();
 
   while (!IsEnd() && (ccount < rsize)) {
-    fread(&c, sizeof(char),1, myStream);
+    Device()->Read((Standard_Address)&c, sizeof(char));
     buffer += c;
     ccount++;
   }
@@ -182,13 +191,18 @@ void FSD_BinaryFile::SkipObject()
 
 Storage_BaseDriver& FSD_BinaryFile::PutReference(const Standard_Integer aValue)
 {
+  if ( Device().IsNull() )
+    Storage_StreamWriteError::Raise();
+
 #if DO_INVERSE
   Standard_Integer t = InverseInt (aValue);
-  
-  if (!fwrite(&t,sizeof(Standard_Integer),1,myStream)) Storage_StreamWriteError::Raise();
 #else
-  if (!fwrite(&aValue,sizeof(Standard_Integer),1,myStream)) Storage_StreamWriteError::Raise();
+  Standard_Integer t = aValue;
 #endif
+
+  if ( Device()->Write( (Standard_Address)&t, sizeof(Standard_Integer) ) != sizeof(Standard_Integer) )
+    Storage_StreamWriteError::Raise();
+
   return *this;
 }
 
@@ -199,7 +213,11 @@ Storage_BaseDriver& FSD_BinaryFile::PutReference(const Standard_Integer aValue)
 
 Storage_BaseDriver& FSD_BinaryFile::PutCharacter(const Standard_Character aValue)
 {
-  if (!fwrite(&aValue,sizeof(Standard_Character),1,myStream)) Storage_StreamWriteError::Raise();
+  if ( Device().IsNull() )
+    Storage_StreamWriteError::Raise();
+
+  if ( Device()->Write((Standard_Address)&aValue,sizeof(Standard_Character)) != sizeof(Standard_Character) )
+    Storage_StreamWriteError::Raise();
   return *this;
 }
 
@@ -210,13 +228,18 @@ Storage_BaseDriver& FSD_BinaryFile::PutCharacter(const Standard_Character aValue
 
 Storage_BaseDriver& FSD_BinaryFile::PutExtCharacter(const Standard_ExtCharacter aValue)
 {
+  if ( Device().IsNull() )
+    Storage_StreamWriteError::Raise();
+
 #if DO_INVERSE
   Standard_ExtCharacter t = InverseExtChar (aValue);
-
-  if (!fwrite(&t,sizeof(Standard_ExtCharacter),1,myStream)) Storage_StreamWriteError::Raise();
 #else
-  if (!fwrite(&aValue,sizeof(Standard_ExtCharacter),1,myStream)) Storage_StreamWriteError::Raise();
+  Standard_ExtCharacter t = aValue;
 #endif
+
+  if ( Device()->Write((Standard_Address)&t, sizeof(Standard_ExtCharacter)) != sizeof(Standard_ExtCharacter) )
+    Storage_StreamWriteError::Raise();
+
   return *this;
 }
 
@@ -227,13 +250,17 @@ Storage_BaseDriver& FSD_BinaryFile::PutExtCharacter(const Standard_ExtCharacter
 
 Storage_BaseDriver& FSD_BinaryFile::PutInteger(const Standard_Integer aValue)
 {
+  if ( Device().IsNull() )
+    Storage_StreamWriteError::Raise();
+
 #if DO_INVERSE
-  Standard_Integer t = InverseInt (aValue);
-  
-  if (!fwrite(&t,sizeof(Standard_Integer),1,myStream)) Storage_StreamWriteError::Raise();
+  Standard_Integer t = InverseInt(aValue);
 #else
-  if (!fwrite(&aValue,sizeof(Standard_Integer),1,myStream)) Storage_StreamWriteError::Raise();
+  Standard_Integer t = aValue;
 #endif
+  
+  if ( Device()->Write((Standard_Address)&t,sizeof(Standard_Integer)) != sizeof(Standard_Integer))
+    Storage_StreamWriteError::Raise();
 
   return *this;
 }
@@ -245,13 +272,18 @@ Storage_BaseDriver& FSD_BinaryFile::PutInteger(const Standard_Integer aValue)
 
 Storage_BaseDriver& FSD_BinaryFile::PutBoolean(const Standard_Boolean aValue)
 {
+  if ( Device().IsNull() )
+    Storage_StreamWriteError::Raise();
+
 #if DO_INVERSE
   Standard_Integer t = InverseInt ((Standard_Integer) aValue);
-  
-  if (!fwrite(&t,sizeof(Standard_Integer),1,myStream)) Storage_StreamWriteError::Raise();
 #else
-  if (!fwrite(&aValue,sizeof(Standard_Boolean),1,myStream)) Storage_StreamWriteError::Raise();
+  Standard_Integer t = (Standard_Integer)aValue;
 #endif
+  
+  if ( Device()->Write((Standard_Address)&t,sizeof(Standard_Integer)) != sizeof(Standard_Integer) )
+    Storage_StreamWriteError::Raise();
+
   return *this;
 }
 
@@ -262,13 +294,18 @@ Storage_BaseDriver& FSD_BinaryFile::PutBoolean(const Standard_Boolean aValue)
 
 Storage_BaseDriver& FSD_BinaryFile::PutReal(const Standard_Real aValue)
 {
+  if ( Device().IsNull() )
+    Storage_StreamWriteError::Raise();
+
 #if DO_INVERSE
   Standard_Real t = InverseReal (aValue);
-  
-  if (!fwrite(&t,sizeof(Standard_Real),1,myStream)) Storage_StreamWriteError::Raise();
 #else
-  if (!fwrite(&aValue,sizeof(Standard_Real),1,myStream)) Storage_StreamWriteError::Raise();
+  Standard_Real t = aValue;
 #endif
+  
+  if ( Device()->Write((Standard_Address)&t,sizeof(Standard_Real)) != sizeof(Standard_Real) )
+    Storage_StreamWriteError::Raise();
+
   return *this;
 }
 
@@ -279,13 +316,18 @@ Storage_BaseDriver& FSD_BinaryFile::PutReal(const Standard_Real aValue)
 
 Storage_BaseDriver& FSD_BinaryFile::PutShortReal(const Standard_ShortReal aValue)
 {
+  if ( Device().IsNull() )
+    Storage_StreamWriteError::Raise();
+
 #if DO_INVERSE
   Standard_ShortReal t = InverseShortReal (aValue);
-
-  if (!fwrite(&t,sizeof(Standard_ShortReal),1,myStream)) Storage_StreamWriteError::Raise();
 #else
-  if (!fwrite(&aValue,sizeof(Standard_ShortReal),1,myStream)) Storage_StreamWriteError::Raise();
+  Standard_ShortReal t = aValue;
 #endif
+
+  if ( Device()->Write((Standard_Address)&t,sizeof(Standard_ShortReal)) != sizeof(Standard_ShortReal) )
+    Storage_StreamWriteError::Raise();
+
   return *this;
 }
 
@@ -296,7 +338,10 @@ Storage_BaseDriver& FSD_BinaryFile::PutShortReal(const Standard_ShortReal aValue
 
 Storage_BaseDriver& FSD_BinaryFile::GetReference(Standard_Integer& aValue)
 {
-  if (!fread(&aValue,sizeof(Standard_Integer),1,myStream))
+  if ( Device().IsNull() )
+    Storage_StreamReadError::Raise();
+
+  if ( Device()->Read( (Standard_Address)&aValue,sizeof(Standard_Integer)) != sizeof(Standard_Integer) )
     Storage_StreamTypeMismatchError::Raise();
 #if DO_INVERSE
   aValue = InverseInt (aValue);
@@ -311,8 +356,12 @@ Storage_BaseDriver& FSD_BinaryFile::GetReference(Standard_Integer& aValue)
 
 Storage_BaseDriver& FSD_BinaryFile::GetCharacter(Standard_Character& aValue)
 {
-  if (!fread(&aValue,sizeof(Standard_Character),1,myStream))
+  if ( Device().IsNull() )
+    Storage_StreamReadError::Raise();
+
+  if ( Device()->Read( (Standard_Address)&aValue,sizeof(Standard_Character)) != sizeof(Standard_Character) )
     Storage_StreamTypeMismatchError::Raise();
+
   return *this;
 }
 
@@ -323,7 +372,10 @@ Storage_BaseDriver& FSD_BinaryFile::GetCharacter(Standard_Character& aValue)
 
 Storage_BaseDriver& FSD_BinaryFile::GetExtCharacter(Standard_ExtCharacter& aValue)
 {
-  if (!fread(&aValue,sizeof(Standard_ExtCharacter),1,myStream))
+  if ( Device().IsNull() )
+    Storage_StreamReadError::Raise();
+
+  if ( Device()->Read( (Standard_Address)&aValue,sizeof(Standard_ExtCharacter)) != sizeof(Standard_ExtCharacter) )
     Storage_StreamTypeMismatchError::Raise();
 #if DO_INVERSE
   aValue = InverseExtChar (aValue);
@@ -338,7 +390,10 @@ Storage_BaseDriver& FSD_BinaryFile::GetExtCharacter(Standard_ExtCharacter& aValu
 
 Storage_BaseDriver& FSD_BinaryFile::GetInteger(Standard_Integer& aValue)
 {
-  if (!fread(&aValue,sizeof(Standard_Integer),1,myStream))
+  if ( Device().IsNull() )
+    Storage_StreamReadError::Raise();
+
+  if ( Device()->Read((Standard_Address)&aValue,sizeof(Standard_Integer)) != sizeof(Standard_Integer) )
     Storage_StreamTypeMismatchError::Raise();
 #if DO_INVERSE
   aValue = InverseInt (aValue);
@@ -353,7 +408,10 @@ Storage_BaseDriver& FSD_BinaryFile::GetInteger(Standard_Integer& aValue)
 
 Storage_BaseDriver& FSD_BinaryFile::GetBoolean(Standard_Boolean& aValue)
 {
-  if (!fread(&aValue,sizeof(Standard_Boolean),1,myStream))
+  if ( Device().IsNull() )
+    Storage_StreamReadError::Raise();
+
+  if ( Device()->Read((Standard_Address)&aValue,sizeof(Standard_Boolean)) != sizeof(Standard_Boolean) )
     Storage_StreamTypeMismatchError::Raise();
 #if DO_INVERSE
   aValue = InverseInt ((Standard_Integer) aValue);
@@ -368,7 +426,10 @@ Storage_BaseDriver& FSD_BinaryFile::GetBoolean(Standard_Boolean& aValue)
 
 Storage_BaseDriver& FSD_BinaryFile::GetReal(Standard_Real& aValue)
 {
-  if (!fread(&aValue,sizeof(Standard_Real),1,myStream))
+  if ( Device().IsNull() )
+    Storage_StreamReadError::Raise();
+
+  if ( Device()->Read((Standard_Address)&aValue,sizeof(Standard_Real)) != sizeof(Standard_Real))
     Storage_StreamTypeMismatchError::Raise();
 #if DO_INVERSE
   aValue = InverseReal (aValue);
@@ -383,7 +444,10 @@ Storage_BaseDriver& FSD_BinaryFile::GetReal(Standard_Real& aValue)
 
 Storage_BaseDriver& FSD_BinaryFile::GetShortReal(Standard_ShortReal& aValue)
 {
-  if (!fread(&aValue,sizeof(Standard_ShortReal),1,myStream))
+  if ( Device().IsNull() )
+    Storage_StreamReadError::Raise();
+
+  if ( Device()->Read((Standard_Address)&aValue,sizeof(Standard_ShortReal)) != sizeof(Standard_ShortReal))
     Storage_StreamTypeMismatchError::Raise();
 #if DO_INVERSE
   aValue = InverseShortReal (aValue);
@@ -416,13 +480,11 @@ Storage_Error FSD_BinaryFile::BeginWriteInfoSection()
   ti[2] = 3;
   ti[3] = 4;
   myHeader.testindian = *((int*)ti);
-  if (!fwrite(FSD_BinaryFile::MagicNumber(),
-              strlen(FSD_BinaryFile::MagicNumber()),
-              1,
-              myStream))
+  Standard_Size aLen = strlen(FSD_BinaryFile::MagicNumber());
+  if ( Device()->Write( (Standard_Address)FSD_BinaryFile::MagicNumber(), aLen ) != aLen )
     Storage_StreamWriteError::Raise();
   
-  myHeader.binfo = ftell(myStream);
+  myHeader.binfo = Device()->Tell();
   WriteHeader();
 
   return Storage_VSOk;
@@ -468,7 +530,7 @@ void FSD_BinaryFile::WriteInfo(const Standard_Integer nbObj,
 
 Storage_Error FSD_BinaryFile::EndWriteInfoSection() 
 {
-  myHeader.einfo = ftell(myStream);
+  myHeader.einfo = Device()->Tell();
 
   return Storage_VSOk;
 }
@@ -539,8 +601,10 @@ void FSD_BinaryFile::ReadInfo(Standard_Integer& nbObj,
 
 Storage_Error FSD_BinaryFile::EndReadInfoSection() 
 {
-  if (!fseek(myStream,myHeader.einfo,SEEK_SET)) return Storage_VSOk;
-  else return Storage_VSSectionNotFound;
+  if ( Device()->Seek(myHeader.einfo))
+    return Storage_VSOk;
+  else
+    return Storage_VSSectionNotFound;
 }
 
 //=======================================================================
@@ -550,7 +614,7 @@ Storage_Error FSD_BinaryFile::EndReadInfoSection()
 
 Storage_Error FSD_BinaryFile::BeginWriteCommentSection() 
 {
-  myHeader.bcomment = ftell(myStream);
+  myHeader.bcomment = Device()->Tell();
   return Storage_VSOk;
 }
 
@@ -577,7 +641,7 @@ void FSD_BinaryFile::WriteComment(const TColStd_SequenceOfExtendedString& aCom)
 
 Storage_Error FSD_BinaryFile::EndWriteCommentSection() 
 {
-  myHeader.ecomment = ftell(myStream);
+  myHeader.ecomment = Device()->Tell();
 
   return Storage_VSOk;
 }
@@ -589,8 +653,10 @@ Storage_Error FSD_BinaryFile::EndWriteCommentSection()
 
 Storage_Error FSD_BinaryFile::BeginReadCommentSection() 
 {
-  if (!fseek(myStream,myHeader.bcomment,SEEK_SET)) return Storage_VSOk;
-  else return Storage_VSSectionNotFound;
+  if ( Device()->Seek(myHeader.bcomment) )
+    return Storage_VSOk;
+  else
+    return Storage_VSSectionNotFound;
 }
 
 //=======================================================================
@@ -617,8 +683,10 @@ void FSD_BinaryFile::ReadComment(TColStd_SequenceOfExtendedString& aCom)
 
 Storage_Error FSD_BinaryFile::EndReadCommentSection() 
 {
-  if (!fseek(myStream,myHeader.ecomment,SEEK_SET)) return Storage_VSOk;
-  else return Storage_VSSectionNotFound;
+  if ( Device()->Seek(myHeader.ecomment) )
+    return Storage_VSOk;
+  else
+    return Storage_VSSectionNotFound;
 }
 
 //=======================================================================
@@ -628,7 +696,7 @@ Storage_Error FSD_BinaryFile::EndReadCommentSection()
 
 Storage_Error FSD_BinaryFile::BeginWriteTypeSection() 
 {
-  myHeader.btype = ftell(myStream);
+  myHeader.btype = Device()->Tell();
 
   return Storage_VSOk;
 }
@@ -662,7 +730,7 @@ void FSD_BinaryFile::WriteTypeInformations(const Standard_Integer typeNum,
 
 Storage_Error FSD_BinaryFile::EndWriteTypeSection() 
 {
-  myHeader.etype = ftell(myStream);
+  myHeader.etype = Device()->Tell();
 
   return Storage_VSOk;
 }
@@ -674,8 +742,10 @@ Storage_Error FSD_BinaryFile::EndWriteTypeSection()
 
 Storage_Error FSD_BinaryFile::BeginReadTypeSection() 
 {
- if (!fseek(myStream,myHeader.btype,SEEK_SET)) return Storage_VSOk;
-  else return Storage_VSSectionNotFound;
+  if ( Device()->Seek(myHeader.btype) )
+    return Storage_VSOk;
+  else
+    return Storage_VSSectionNotFound;
 }
 
 //=======================================================================
@@ -710,8 +780,10 @@ void FSD_BinaryFile::ReadTypeInformations(Standard_Integer& typeNum,TCollection_
 
 Storage_Error FSD_BinaryFile::EndReadTypeSection() 
 {
- if (!fseek(myStream,myHeader.etype,SEEK_SET)) return Storage_VSOk;
-  else return Storage_VSSectionNotFound;
+  if ( Device()->Seek(myHeader.etype) )
+    return Storage_VSOk;
+  else
+    return Storage_VSSectionNotFound;
 }
 
 //=======================================================================
@@ -721,7 +793,7 @@ Storage_Error FSD_BinaryFile::EndReadTypeSection()
 
 Storage_Error FSD_BinaryFile::BeginWriteRootSection() 
 {
-  myHeader.broot = ftell(myStream);
+  myHeader.broot = Device()->Tell();
 
   return Storage_VSOk;
 }
@@ -755,7 +827,7 @@ void FSD_BinaryFile::WriteRoot(const TCollection_AsciiString& rootName, const St
 
 Storage_Error FSD_BinaryFile::EndWriteRootSection() 
 {
-  myHeader.eroot = ftell(myStream);
+  myHeader.eroot = Device()->Tell();
 
   return Storage_VSOk;
 }
@@ -767,8 +839,10 @@ Storage_Error FSD_BinaryFile::EndWriteRootSection()
 
 Storage_Error FSD_BinaryFile::BeginReadRootSection() 
 {
- if (!fseek(myStream,myHeader.broot,SEEK_SET)) return Storage_VSOk;
-  else return Storage_VSSectionNotFound;
+  if ( Device()->Seek(myHeader.broot) )
+    return Storage_VSOk;
+  else
+    return Storage_VSSectionNotFound;
 }
 
 //=======================================================================
@@ -804,8 +878,10 @@ void FSD_BinaryFile::ReadRoot(TCollection_AsciiString& rootName, Standard_Intege
 
 Storage_Error FSD_BinaryFile::EndReadRootSection() 
 {
- if (!fseek(myStream,myHeader.eroot,SEEK_SET)) return Storage_VSOk;
-  else return Storage_VSSectionNotFound;
+  if ( Device()->Seek(myHeader.eroot) )
+    return Storage_VSOk;
+  else
+    return Storage_VSSectionNotFound;
 }
 
 //=======================================================================
@@ -815,7 +891,7 @@ Storage_Error FSD_BinaryFile::EndReadRootSection()
 
 Storage_Error FSD_BinaryFile::BeginWriteRefSection() 
 {
-  myHeader.bref = ftell(myStream);
+  myHeader.bref = Device()->Tell();
 
   return Storage_VSOk;
 }
@@ -848,7 +924,7 @@ void FSD_BinaryFile::WriteReferenceType(const Standard_Integer reference,const S
 
 Storage_Error FSD_BinaryFile::EndWriteRefSection() 
 {
-  myHeader.eref = ftell(myStream);
+  myHeader.eref = Device()->Tell();
 
   return Storage_VSOk;
 }
@@ -860,8 +936,10 @@ Storage_Error FSD_BinaryFile::EndWriteRefSection()
 
 Storage_Error FSD_BinaryFile::BeginReadRefSection() 
 {
- if (!fseek(myStream,myHeader.bref,SEEK_SET)) return Storage_VSOk;
-  else return Storage_VSSectionNotFound;
+  if ( Device()->Seek(myHeader.bref) )
+    return Storage_VSOk;
+  else
+    return Storage_VSSectionNotFound;
 }
 
 //=======================================================================
@@ -897,8 +975,10 @@ void FSD_BinaryFile::ReadReferenceType(Standard_Integer& reference,
 
 Storage_Error FSD_BinaryFile::EndReadRefSection() 
 {
- if (!fseek(myStream,myHeader.eref,SEEK_SET)) return Storage_VSOk;
-  else return Storage_VSSectionNotFound;
+  if ( Device()->Seek(myHeader.eref) )
+    return Storage_VSOk;
+  else
+    return Storage_VSSectionNotFound;
 }
 
 //=======================================================================
@@ -908,7 +988,7 @@ Storage_Error FSD_BinaryFile::EndReadRefSection()
 
 Storage_Error FSD_BinaryFile::BeginWriteDataSection() 
 {
-  myHeader.bdata = ftell(myStream);
+  myHeader.bdata = Device()->Tell();
 
   return Storage_VSOk;
 }
@@ -968,9 +1048,9 @@ void FSD_BinaryFile::EndWritePersistentObjectData()
 
 Storage_Error FSD_BinaryFile::EndWriteDataSection() 
 {
-  myHeader.edata = ftell(myStream);
+  myHeader.edata = Device()->Tell();
   
-  fseek(myStream,myHeader.binfo,SEEK_SET);
+  Device()->Seek(myHeader.binfo);
   WriteHeader();
   return Storage_VSOk;
 }
@@ -982,8 +1062,10 @@ Storage_Error FSD_BinaryFile::EndWriteDataSection()
 
 Storage_Error FSD_BinaryFile::BeginReadDataSection() 
 {
- if (!fseek(myStream,myHeader.bdata,SEEK_SET)) return Storage_VSOk;
-  else return Storage_VSSectionNotFound;
+  if ( Device()->Seek(myHeader.bdata) )
+    return Storage_VSOk;
+  else
+    return Storage_VSSectionNotFound;
 }
 
 //=======================================================================
@@ -1041,8 +1123,10 @@ void FSD_BinaryFile::EndReadPersistentObjectData()
 
 Storage_Error FSD_BinaryFile::EndReadDataSection() 
 {
- if (!fseek(myStream,myHeader.edata,SEEK_SET)) return Storage_VSOk;
-  else return Storage_VSSectionNotFound;
+  if ( Device()->Seek(myHeader.edata) )
+    return Storage_VSOk;
+  else
+    return Storage_VSSectionNotFound;
 }
 
 //=======================================================================
@@ -1059,7 +1143,8 @@ void FSD_BinaryFile::WriteString(const TCollection_AsciiString& aString)
   PutInteger(size);
 
   if (size > 0) {
-    if (!fwrite(aString.ToCString(),aString.Length(),1,myStream)) Storage_StreamWriteError::Raise();
+    if ( Device().IsNull() || Device()->Write((Standard_Address)aString.ToCString(),size) != (Standard_Size)size )
+      Storage_StreamWriteError::Raise();
   }
 }
 
@@ -1075,7 +1160,8 @@ void FSD_BinaryFile::ReadString(TCollection_AsciiString& aString)
   GetInteger(size);
   if (size > 0) {
     Standard_Character *c = (Standard_Character *)Standard::Allocate((size+1) * sizeof(Standard_Character));
-    if (!fread(c,size,1,myStream)) Storage_StreamWriteError::Raise();
+    if ( Device().IsNull() || Device()->Read((Standard_Address)c,size) != (Standard_Size)size )
+      Storage_StreamReadError::Raise();
     c[size] = '\0';
     aString = c;
     Standard::Free(c);
@@ -1113,7 +1199,8 @@ void FSD_BinaryFile::WriteExtendedString(const TCollection_ExtendedString& aStri
 #else
     anExtStr = aString.ToExtString();
 #endif
-    if (!fwrite(anExtStr,sizeof(Standard_ExtCharacter)*aString.Length(),1,myStream))
+    Standard_Size aSize = sizeof(Standard_ExtCharacter)*aString.Length();
+    if ( Device().IsNull() || Device()->Write((Standard_Address)anExtStr,aSize) != aSize )
       Storage_StreamWriteError::Raise();
   }
 }
@@ -1131,7 +1218,7 @@ void FSD_BinaryFile::ReadExtendedString(TCollection_ExtendedString& aString)
   if (size > 0) {
     Standard_ExtCharacter *c = (Standard_ExtCharacter *)
       Standard::Allocate((size+1) * sizeof(Standard_ExtCharacter));
-    if (!fread(c,size*sizeof(Standard_ExtCharacter),1,myStream))
+    if ( Device().IsNull() || Device()->Read((Standard_Address)c,size*sizeof(Standard_ExtCharacter)) != size*sizeof(Standard_ExtCharacter) )
       Storage_StreamWriteError::Raise();
     c[size] = '\0';
 #if DO_INVERSE
@@ -1198,5 +1285,5 @@ void FSD_BinaryFile::ReadHeader()
 
 Storage_Position FSD_BinaryFile::Tell()
 {
-  return (Storage_Position) ftell(myStream);
+  return Device()->Tell();
 }
index eb331861688fc18841bc366d6adecceab67229f3..9e1e45c39dfdeb4609b052259feb6779daa16c82 100644 (file)
@@ -21,6 +21,7 @@ inherits BaseDriver from Storage
 uses Position    from Storage,
      Error       from Storage,
      OpenMode    from Storage,
+     IODevice    from Storage,
      AsciiString from TCollection,
      SequenceOfAsciiString from TColStd,
      SequenceOfExtendedString from TColStd,
@@ -35,15 +36,16 @@ raises StreamTypeMismatchError from Storage,
 is
     Create returns CmpFile from FSD;
     
-    Open(me : in out; aName : AsciiString from TCollection; aMode : OpenMode from Storage) returns Error from Storage;
+    Open(me : in out; aDevice : IODevice from Storage; aMode : OpenMode from Storage)
+    returns Error from Storage is redefined;
         
     IsEnd(me : in out) returns Boolean from Standard;
 
     Tell( me : in out ) returns Position from Storage;
         ---Purpose: return position in the file. Return -1 upon error.
 
-    IsGoodFileType(myclass; aName : AsciiString from TCollection)
-       returns Error from Storage;
+    IsGoodFileType(myclass; aDevice : IODevice from Storage)
+    returns Error from Storage;
     
     -- INFO SECTION
     -- write
@@ -303,6 +305,9 @@ is
     raises StreamExtCharParityError 
     is protected;
     ---Purpose: read extended chars (unicode) from the current position to the end of line.
+    
+    WriteLine(me : in out; buffer : AsciiString from TCollection; putNewLine: Boolean from Standard = Standard_True) is protected;
+    ---Purpose: write the line.
 
     WriteExtendedLine(me : in out; buffer : ExtendedString from TCollection) is protected;
     ---Purpose: write from the current position to the end of line.
index f30fa25afd872848bcaa1503618207b39b0f0f66..3e669590cf5a4cb6ba4353882bcf18969612be9c 100644 (file)
@@ -37,12 +37,12 @@ FSD_CmpFile::FSD_CmpFile()
 //           write
 //=======================================================================
 
-Storage_Error FSD_CmpFile::IsGoodFileType(const TCollection_AsciiString& aName)
+Storage_Error FSD_CmpFile::IsGoodFileType(const Handle(Storage_IODevice)& aDevice)
 {
   FSD_CmpFile      f;
   Storage_Error s;
 
-  s = f.Open(aName,Storage_VSRead);
+  s = f.Open(aDevice,Storage_VSRead);
 
   if (s == Storage_VSOk) {
     TCollection_AsciiString l;
@@ -65,8 +65,16 @@ Storage_Error FSD_CmpFile::IsGoodFileType(const TCollection_AsciiString& aName)
 //purpose  : 
 //=======================================================================
 
-Storage_Error FSD_CmpFile::Open(const TCollection_AsciiString& aName,const Storage_OpenMode aMode)
+Storage_Error FSD_CmpFile::Open(const Handle(Storage_IODevice)& aDevice,const Storage_OpenMode aMode)
 {
+  SetDevice(aDevice);
+
+  if ( Device().IsNull() )
+    return Storage_VSOpenError;
+
+  return Device()->Open(aMode);
+
+  /*
   Storage_Error result = Storage_VSOk;
 
   SetName(aName);
@@ -119,6 +127,7 @@ Storage_Error FSD_CmpFile::Open(const TCollection_AsciiString& aName,const Stora
     result = Storage_VSAlreadyOpen;
   }
   return result;
+  */
 }
 
 //=======================================================================
@@ -128,7 +137,7 @@ Storage_Error FSD_CmpFile::Open(const TCollection_AsciiString& aName,const Stora
 
 Standard_Boolean FSD_CmpFile::IsEnd()
 {
-  return myStream.eof();
+  return !Device().IsNull() ? Device()->IsEnd() : Standard_True;
 }
 
 //=======================================================================
@@ -141,8 +150,7 @@ Storage_Error FSD_CmpFile::Close()
   Storage_Error result = Storage_VSOk;
 
   if (OpenMode() != Storage_VSNone) {
-    myStream.close();
-    SetOpenMode(Storage_VSNone);
+    Device()->Close();
   }
   else {
     result = Storage_VSNotOpen;
@@ -188,6 +196,22 @@ void FSD_CmpFile::FlushEndOfLine()
   */
 }
 
+//=======================================================================
+//function : WriteLine
+//purpose  : write the line.
+//=======================================================================
+
+void FSD_CmpFile::WriteLine(const TCollection_AsciiString& aStr, const Standard_Boolean putNewLine)
+{
+  TCollection_AsciiString buffer = aStr;
+  if ( putNewLine )
+    buffer += TCollection_AsciiString("\n");
+
+  if ( Device()->Write( (Standard_Address)buffer.ToCString(), buffer.Length() ) != (Standard_Size)buffer.Length() )
+    Storage_StreamWriteError::Raise();
+}
+
+
 //=======================================================================
 //function : ReadLine
 //purpose  : read from the current position to the end of line.
@@ -195,30 +219,25 @@ void FSD_CmpFile::FlushEndOfLine()
 
 void FSD_CmpFile::ReadLine(TCollection_AsciiString& buffer)
 {
-  char Buffer[8193];
-  //char c;
   Standard_Boolean IsEnd = Standard_False;
   
   buffer.Clear();
 
-  while (!IsEnd && !FSD_CmpFile::IsEnd()) {
-    Buffer[0] = '\0';
-    //myStream.get(Buffer,8192,'\n');
-    myStream.getline(Buffer,8192,'\n');
-    for (Standard_Size lv = (strlen(Buffer)- 1); lv > 1 && (Buffer[lv] == '\r' || Buffer[lv] == '\n') ;lv--) {
-      Buffer[lv] = '\0';
+  while (!IsEnd && !FSD_CmpFile::IsEnd())
+  {
+    Standard_Character c;
+    Device()->Read( (Standard_Address)&c, 1 );
+    if ( c != '\n' && c != '\r')
+    {
+      buffer += c;
     }  
-    
-//     if (myStream.get(c) && c != '\r' && c != '\n') {
-//       buffer += Buffer;
-//       buffer += c;
-//     }
-//     else {
-      buffer += Buffer;
+    else
+    {
+      buffer += '\0';
       IsEnd = Standard_True;
-//     }
   }
 }
+}
 
 //=======================================================================
 //function : WriteExtendedLine
@@ -227,21 +246,6 @@ void FSD_CmpFile::ReadLine(TCollection_AsciiString& buffer)
 
 void FSD_CmpFile::WriteExtendedLine(const TCollection_ExtendedString& buffer)
 {
-#if 0
-  Standard_ExtString extBuffer;
-  Standard_Integer   i,c,d;
-
-  extBuffer = buffer.ToExtString();
-
-  for (i = 0; i < buffer.Length(); i++) {
-    c = (extBuffer[i] & 0x0000FF00 ) >> 8 ;
-    d = extBuffer[i] & 0x000000FF;
-
-    myStream << (char)c << (char)d;
-  }
-
-  myStream << (char)0 << "\n";
-#endif
   Standard_ExtString extBuffer;
   Standard_Integer   i;
 
@@ -251,7 +255,7 @@ void FSD_CmpFile::WriteExtendedLine(const TCollection_ExtendedString& buffer)
     PutExtCharacter(extBuffer[i]);
   }
 
-  myStream << "\n";
+  Device()->Write((Standard_Address)"\n", 1);
 }
 
 //=======================================================================
@@ -287,7 +291,7 @@ void FSD_CmpFile::ReadChar(TCollection_AsciiString& buffer, const Standard_Size
   buffer.Clear();
 
   while (!IsEnd() && (ccount < rsize)) {
-    myStream.get(c);
+    Device()->Read( (Standard_Address)&c, sizeof( char ) );
     buffer += c;
     ccount++;
   }
@@ -300,38 +304,37 @@ void FSD_CmpFile::ReadChar(TCollection_AsciiString& buffer, const Standard_Size
 
 void FSD_CmpFile::ReadString(TCollection_AsciiString& buffer)
 {
-  char Buffer[8193];
-  char *bpos;
   Standard_Boolean IsEnd = Standard_False,isFirstTime = Standard_True;
   
   buffer.Clear();
   
-  while (!IsEnd && !FSD_CmpFile::IsEnd()) {
-    Buffer[0] = '\0';
-    //myStream.get(Buffer,8192,'\n');
-    myStream.getline(Buffer,8192,'\n');
-    for (Standard_Size lv = (strlen(Buffer)- 1); lv > 1 && (Buffer[lv] == '\r' || Buffer[lv] == '\n') ;lv--) {
-      Buffer[lv] = '\0';
+  while (!IsEnd && !FSD_CmpFile::IsEnd())
+  {
+    char c;
+    Device()->Read((Standard_Address)&c, sizeof(c));
+    if (isFirstTime)
+    {
+      if (c == '\n' || c == ' ')
+      {
+        continue;
     }  
-    bpos = Buffer;
-
-    // LeftAdjust
-    //
-    if (isFirstTime) {
+      else
+      {
       isFirstTime = Standard_False;
-      while (*bpos == '\n' || *bpos == ' ') bpos++;
     }
-//     char c;
-//     if (myStream.get(c) && c != '\n') {
-//       buffer += bpos;
-//       buffer += c;
-//     }
-//     else {
-      buffer += bpos;
+    }
+
+    if (c != '\n')
+    {
+      buffer += c;
+    }
+    else
+    {
+      buffer += '\0';
       IsEnd = Standard_True;
-//     }
   }
 }
+}
 
 //=======================================================================
 //function : ReadWord
@@ -350,8 +353,11 @@ void FSD_CmpFile::ReadWord(TCollection_AsciiString& buffer)
   buffer.Clear();
 
   while (!IsEnd && !FSD_CmpFile::IsEnd()) {
-    myStream.get(c);
-    if ((c != ' ') && (c != '\n')) IsEnd = Standard_True;
+    Device()->Read( (Standard_Address)&c, sizeof(char) );
+    if ((c != ' ') && (c != '\n'))
+    {
+      IsEnd = Standard_True;
+  }
   }
 
   IsEnd = Standard_False;
@@ -366,8 +372,11 @@ void FSD_CmpFile::ReadWord(TCollection_AsciiString& buffer)
     }
     *tmpb = c;
     tmpb++; i++;
-    myStream.get(c);
-    if ((c == '\n') || (c == ' ')) IsEnd = Standard_True;
+    Device()->Read( (Standard_Address)&c, sizeof(char) );
+    if ((c == '\n') || (c == ' '))
+    {
+      IsEnd = Standard_True;
+  }
   }
 
   buffer += b;
@@ -413,8 +422,9 @@ void FSD_CmpFile::SkipObject()
 
 Storage_BaseDriver& FSD_CmpFile::PutReference(const Standard_Integer aValue)
 {
-  myStream << aValue << " ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aStr = TCollection_AsciiString( aValue ) + " ";
+  if ( Device()->Write( (Standard_Address)aStr.ToCString(), aStr.Length() ) != (Standard_Size)aStr.Length() )
+    Storage_StreamWriteError::Raise();
   return *this;
 }
 
@@ -425,11 +435,11 @@ Storage_BaseDriver& FSD_CmpFile::PutReference(const Standard_Integer aValue)
 
 Storage_BaseDriver& FSD_CmpFile::PutCharacter(const Standard_Character aValue)
 {
-  unsigned short i;
+  Standard_Integer i = aValue;
+  TCollection_AsciiString aStr = TCollection_AsciiString( i ) + " ";
+  if ( Device()->Write( (Standard_Address)aStr.ToCString(), aStr.Length() ) != (Standard_Size)aStr.Length() )
+    Storage_StreamWriteError::Raise();
 
-  i = aValue;
-  myStream << i << " ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
   return *this;
 }
 
@@ -440,8 +450,11 @@ Storage_BaseDriver& FSD_CmpFile::PutCharacter(const Standard_Character aValue)
 
 Storage_BaseDriver& FSD_CmpFile::PutExtCharacter(const Standard_ExtCharacter aValue)
 {
-  myStream << aValue << " ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  Standard_Integer i = aValue;
+  TCollection_AsciiString aStr = TCollection_AsciiString( i ) + " ";
+  if ( Device()->Write( (Standard_Address)aStr.ToCString(), aStr.Length() ) != (Standard_Size)aStr.Length() )
+    Storage_StreamWriteError::Raise();
+
   return *this;
 }
 
@@ -452,8 +465,10 @@ Storage_BaseDriver& FSD_CmpFile::PutExtCharacter(const Standard_ExtCharacter aVa
 
 Storage_BaseDriver& FSD_CmpFile::PutInteger(const Standard_Integer aValue)
 {
-  myStream << aValue << " ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aStr = TCollection_AsciiString( aValue ) + " ";
+  if ( Device()->Write( (Standard_Address)aStr.ToCString(), aStr.Length() ) != (Standard_Size)aStr.Length() )
+    Storage_StreamWriteError::Raise();
+
   return *this;
 }
 
@@ -464,8 +479,10 @@ Storage_BaseDriver& FSD_CmpFile::PutInteger(const Standard_Integer aValue)
 
 Storage_BaseDriver& FSD_CmpFile::PutBoolean(const Standard_Boolean aValue)
 {
-  myStream << ((Standard_Integer)aValue) << " ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aStr = TCollection_AsciiString( (Standard_Integer)aValue ) + " ";
+  if ( Device()->Write( (Standard_Address)aStr.ToCString(), aStr.Length() ) != (Standard_Size)aStr.Length() )
+    Storage_StreamWriteError::Raise();
+
   return *this;
 }
 
@@ -476,8 +493,10 @@ Storage_BaseDriver& FSD_CmpFile::PutBoolean(const Standard_Boolean aValue)
 
 Storage_BaseDriver& FSD_CmpFile::PutReal(const Standard_Real aValue)
 {
-  myStream << ((Standard_Real)aValue) << " ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aStr = TCollection_AsciiString( aValue ) + " ";
+  if ( Device()->Write( (Standard_Address)aStr.ToCString(), aStr.Length() ) != (Standard_Size)aStr.Length() )
+    Storage_StreamWriteError::Raise();
+
   return *this;
 }
 
@@ -488,8 +507,10 @@ Storage_BaseDriver& FSD_CmpFile::PutReal(const Standard_Real aValue)
 
 Storage_BaseDriver& FSD_CmpFile::PutShortReal(const Standard_ShortReal aValue)
 {
-  myStream << aValue << " ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aStr = TCollection_AsciiString( aValue ) + " ";
+  if ( Device()->Write( (Standard_Address)aStr.ToCString(), aStr.Length() ) != (Standard_Size)aStr.Length() )
+    Storage_StreamWriteError::Raise();
+
   return *this;
 }
 
@@ -500,7 +521,12 @@ Storage_BaseDriver& FSD_CmpFile::PutShortReal(const Standard_ShortReal aValue)
 
 Storage_BaseDriver& FSD_CmpFile::GetReference(Standard_Integer& aValue)
 {
-  if (!(myStream >> aValue)) Storage_StreamTypeMismatchError::Raise();
+  TCollection_AsciiString aStr;
+  ReadWord( aStr );
+  if ( aStr.IsIntegerValue() )
+    aValue = aStr.IntegerValue();
+  else
+    Storage_StreamTypeMismatchError::Raise();
 
   return *this;
 }
@@ -513,13 +539,13 @@ Storage_BaseDriver& FSD_CmpFile::GetReference(Standard_Integer& aValue)
 Storage_BaseDriver& FSD_CmpFile::GetCharacter(Standard_Character& aValue)
 {
   unsigned short i = 0;
-  if (!(myStream >> i)) {
-    // SGI : donne une erreur mais a une bonne valeur pour les caracteres ecrits
-    //       signes (-80 fait ios::badbit, mais la variable i est initialisee)
-    //
-    if (i == 0) Storage_StreamTypeMismatchError::Raise();
-    myStream.clear(ios::goodbit);
-  }
+  TCollection_AsciiString aStr;
+  ReadWord( aStr );
+  if ( aStr.IsIntegerValue() )
+    i = (unsigned short)aStr.IntegerValue();
+  else
+    Storage_StreamTypeMismatchError::Raise();
+    
   aValue = (char)i;
 
   return *this;
@@ -532,7 +558,15 @@ Storage_BaseDriver& FSD_CmpFile::GetCharacter(Standard_Character& aValue)
 
 Storage_BaseDriver& FSD_CmpFile::GetExtCharacter(Standard_ExtCharacter& aValue)
 {
-  if (!(myStream >> aValue)) Storage_StreamTypeMismatchError::Raise();
+  unsigned short i = 0;
+  TCollection_AsciiString aStr;
+  ReadWord( aStr );
+  if ( aStr.IsIntegerValue() )
+    i = (unsigned short)aStr.IntegerValue();
+  else
+    Storage_StreamTypeMismatchError::Raise();
+  
+  aValue = (Standard_ExtCharacter)i;
   
   return *this;
 }
@@ -544,7 +578,12 @@ Storage_BaseDriver& FSD_CmpFile::GetExtCharacter(Standard_ExtCharacter& aValue)
 
 Storage_BaseDriver& FSD_CmpFile::GetInteger(Standard_Integer& aValue)
 {
-  if (!(myStream >> aValue)) Storage_StreamTypeMismatchError::Raise();
+  TCollection_AsciiString aStr;
+  ReadWord( aStr );
+  if ( aStr.IsIntegerValue() )
+    aValue = aStr.IntegerValue();
+  else
+    Storage_StreamTypeMismatchError::Raise();
 
   return *this;
 }
@@ -556,7 +595,12 @@ Storage_BaseDriver& FSD_CmpFile::GetInteger(Standard_Integer& aValue)
 
 Storage_BaseDriver& FSD_CmpFile::GetBoolean(Standard_Boolean& aValue)
 {
-  if (!(myStream >> aValue)) Storage_StreamTypeMismatchError::Raise();
+  TCollection_AsciiString aStr;
+  ReadWord( aStr );
+  if ( aStr.IsIntegerValue() )
+    aValue = (Standard_Boolean)aStr.IntegerValue();
+  else
+    Storage_StreamTypeMismatchError::Raise();
 
   return *this;
 }
@@ -568,23 +612,12 @@ Storage_BaseDriver& FSD_CmpFile::GetBoolean(Standard_Boolean& aValue)
 
 Storage_BaseDriver& FSD_CmpFile::GetReal(Standard_Real& aValue)
 {
-  char realbuffer[100];
-
-  realbuffer[0] = '\0';
-  if (!(myStream >> realbuffer)) {
-#ifdef OCCT_DEBUG
-    cerr << "%%%ERROR: read error of double at offset " << myStream.tellg() << endl;
-    cerr << "\t buffer is" << realbuffer<< endl;
-#endif
+  TCollection_AsciiString aStr;
+  ReadWord( aStr );
+  if ( aStr.IsRealValue() )
+    aValue = aStr.RealValue();
+  else
     Storage_StreamTypeMismatchError::Raise();
-  }
-  if (!OSD::CStringToReal(realbuffer,aValue)) {
-#ifdef OCCT_DEBUG
-    cerr << "%%%ERROR: read error of double at offset " << myStream.tellg() << endl;
-    cerr << "\t buffer is" << realbuffer<< endl;
-#endif
-    Storage_StreamTypeMismatchError::Raise();
-  }
 
   return *this;
 }
@@ -596,16 +629,13 @@ Storage_BaseDriver& FSD_CmpFile::GetReal(Standard_Real& aValue)
 
 Storage_BaseDriver& FSD_CmpFile::GetShortReal(Standard_ShortReal& aValue)
 {
-  char realbuffer[100];
-  Standard_Real r = 0.0;
-
-  realbuffer[0] = '\0';
-  if (!(myStream >> realbuffer)) Storage_StreamTypeMismatchError::Raise();
-  if (!OSD::CStringToReal(realbuffer,r))
+  TCollection_AsciiString aStr;
+  ReadWord( aStr );
+  if ( aStr.IsRealValue() )
+    aValue = (Standard_ShortReal)aStr.RealValue();
+  else
     Storage_StreamTypeMismatchError::Raise();
 
-  aValue = (Standard_ShortReal)r;
-
   return *this;
 }
 
@@ -628,9 +658,8 @@ void FSD_CmpFile::Destroy()
 
 Storage_Error FSD_CmpFile::BeginWriteInfoSection() 
 {
-  myStream << FSD_CmpFile::MagicNumber() << '\n';
-  myStream << "BEGIN_INFO_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine( FSD_CmpFile::MagicNumber() );
+  WriteLine( "BEGIN_INFO_SECTION" );
 
   return Storage_VSOk;
 }
@@ -652,24 +681,21 @@ void FSD_CmpFile::WriteInfo(const Standard_Integer nbObj,
 {
   Standard_Integer i;
 
-  myStream << nbObj;
-  myStream << "\n";
-  myStream << dbVersion.ToCString() << "\n";
-  myStream << date.ToCString() << "\n";
-  myStream << schemaName.ToCString() << "\n";
-  myStream << schemaVersion.ToCString() << "\n";
+  PutInteger( nbObj );
+  WriteLine( "" );
+  WriteLine( dbVersion );
+  WriteLine( date );
+  WriteLine( schemaName );
+  WriteLine( schemaVersion );
   WriteExtendedLine(appName);
-  myStream << appVersion.ToCString() << "\n";
+  WriteLine( appVersion );
   WriteExtendedLine(dataType);
-  myStream << userInfo.Length() << "\n";
-
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  PutInteger( userInfo.Length() );
+  WriteLine( "" );
 
-  for (i = 1; i <= userInfo.Length(); i++) {
-    myStream << userInfo.Value(i).ToCString() << "\n";
-    if (myStream.bad()) Storage_StreamWriteError::Raise();
+  for (i = 1; i <= userInfo.Length(); i++)
+    WriteLine( userInfo.Value(i) );
   }
-}
 
 //=======================================================================
 //function : EndWriteInfoSection
@@ -678,8 +704,7 @@ void FSD_CmpFile::WriteInfo(const Standard_Integer nbObj,
 
 Storage_Error FSD_CmpFile::EndWriteInfoSection() 
 {
-  myStream << "END_INFO_SECTION\n";
-  if (myStream.bad())  Storage_StreamWriteError::Raise();
+  WriteLine( "END_INFO_SECTION" );
   return Storage_VSOk;
 }
 
@@ -721,7 +746,7 @@ void FSD_CmpFile::ReadInfo(Standard_Integer& nbObj,
                        TCollection_ExtendedString& dataType,
                        TColStd_SequenceOfAsciiString& userInfo) 
 {
-  if (!(myStream >> nbObj)) Storage_StreamTypeMismatchError::Raise();
+  GetInteger( nbObj );
 
   FlushEndOfLine();
 
@@ -735,7 +760,7 @@ void FSD_CmpFile::ReadInfo(Standard_Integer& nbObj,
 
   Standard_Integer i,len = 0;
 
-  if (!(myStream >> len)) Storage_StreamTypeMismatchError::Raise();
+  GetInteger( len );
 
   FlushEndOfLine();
 
@@ -766,8 +791,8 @@ Storage_Error FSD_CmpFile::EndReadInfoSection()
 
 Storage_Error FSD_CmpFile::BeginWriteCommentSection() 
 {
-  myStream << "BEGIN_COMMENT_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine( "BEGIN_COMMENT_SECTION" );
+
   return Storage_VSOk;
 }
 
@@ -781,12 +806,10 @@ void FSD_CmpFile::WriteComment(const TColStd_SequenceOfExtendedString& aCom)
  Standard_Integer i,aSize;
 
  aSize = aCom.Length();
- myStream << aSize << "\n";
- if (myStream.bad()) Storage_StreamWriteError::Raise();
+ WriteLine (aSize);
 
  for (i = 1; i <= aSize; i++) {
    WriteExtendedLine(aCom.Value(i));
-   if (myStream.bad()) Storage_StreamWriteError::Raise();
  }
 }
 
@@ -797,8 +820,8 @@ void FSD_CmpFile::WriteComment(const TColStd_SequenceOfExtendedString& aCom)
 
 Storage_Error FSD_CmpFile::EndWriteCommentSection() 
 {
-  myStream << "END_COMMENT_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("END_COMMENT_SECTION");
+
   return Storage_VSOk;
 }
 
@@ -822,7 +845,7 @@ void FSD_CmpFile::ReadComment(TColStd_SequenceOfExtendedString& aCom)
   TCollection_ExtendedString line;
   Standard_Integer           len,i;
 
-  if (!(myStream >> len)) Storage_StreamTypeMismatchError::Raise();
+  GetInteger (len);
   
   FlushEndOfLine();  
 
@@ -850,8 +873,8 @@ Storage_Error FSD_CmpFile::EndReadCommentSection()
 
 Storage_Error FSD_CmpFile::BeginWriteTypeSection() 
 {
-  myStream << "BEGIN_TYPE_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("BEGIN_TYPE_SECTION");
+
   return Storage_VSOk;
 }
 
@@ -862,8 +885,7 @@ Storage_Error FSD_CmpFile::BeginWriteTypeSection()
 
 void FSD_CmpFile::SetTypeSectionSize(const Standard_Integer aSize) 
 {
-  myStream << aSize << "\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine (aSize);
 }
 
 //=======================================================================
@@ -874,8 +896,8 @@ void FSD_CmpFile::SetTypeSectionSize(const Standard_Integer aSize)
 void FSD_CmpFile::WriteTypeInformations(const Standard_Integer typeNum,
                                      const TCollection_AsciiString& typeName) 
 {
-  myStream << typeNum << " " << typeName.ToCString() << "\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aLine;
+  WriteLine (aLine + typeNum + " " + typeName.ToCString());
 }
 
 //=======================================================================
@@ -885,8 +907,8 @@ void FSD_CmpFile::WriteTypeInformations(const Standard_Integer typeNum,
 
 Storage_Error FSD_CmpFile::EndWriteTypeSection() 
 {
-  myStream << "END_TYPE_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("END_TYPE_SECTION");
+
   return Storage_VSOk;
 }
 
@@ -909,7 +931,7 @@ Standard_Integer FSD_CmpFile::TypeSectionSize()
 {
   Standard_Integer i;
 
-  if (!(myStream >> i)) Storage_StreamTypeMismatchError::Raise();
+  GetInteger (i);
 
   FlushEndOfLine();
 
@@ -924,8 +946,8 @@ Standard_Integer FSD_CmpFile::TypeSectionSize()
 void FSD_CmpFile::ReadTypeInformations(Standard_Integer& typeNum,
                                    TCollection_AsciiString& typeName) 
 {
-  if (!(myStream >> typeNum)) Storage_StreamTypeMismatchError::Raise();
-  if (!(myStream >> typeName)) Storage_StreamTypeMismatchError::Raise();
+  GetInteger (typeNum);
+  ReadLine(typeName);
   FlushEndOfLine();
 }
 
@@ -947,8 +969,8 @@ Storage_Error FSD_CmpFile::EndReadTypeSection()
 
 Storage_Error FSD_CmpFile::BeginWriteRootSection() 
 {
-  myStream << "BEGIN_ROOT_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("BEGIN_ROOT_SECTION");
+
   return Storage_VSOk;
 }
 
@@ -959,8 +981,7 @@ Storage_Error FSD_CmpFile::BeginWriteRootSection()
 
 void FSD_CmpFile::SetRootSectionSize(const Standard_Integer aSize) 
 {
-  myStream << aSize << "\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine (aSize);
 }
 
 //=======================================================================
@@ -970,8 +991,8 @@ void FSD_CmpFile::SetRootSectionSize(const Standard_Integer aSize)
 
 void FSD_CmpFile::WriteRoot(const TCollection_AsciiString& rootName, const Standard_Integer aRef, const TCollection_AsciiString& rootType) 
 {
-  myStream << aRef << " " << rootName.ToCString() << " " << rootType.ToCString() << "\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aLine;
+  WriteLine (aLine + aRef + " " + rootName.ToCString() + " " + rootType.ToCString());
 }
 
 //=======================================================================
@@ -981,8 +1002,8 @@ void FSD_CmpFile::WriteRoot(const TCollection_AsciiString& rootName, const Stand
 
 Storage_Error FSD_CmpFile::EndWriteRootSection() 
 {
-  myStream << "END_ROOT_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("END_ROOT_SECTION");
+
   return Storage_VSOk;
 }
 
@@ -1004,9 +1025,7 @@ Storage_Error FSD_CmpFile::BeginReadRootSection()
 Standard_Integer FSD_CmpFile::RootSectionSize() 
 {
   Standard_Integer i;
-
-  if (!(myStream >> i)) Storage_StreamTypeMismatchError::Raise();
-  
+  GetInteger (i);
   FlushEndOfLine();
   
   return i;
@@ -1019,7 +1038,7 @@ Standard_Integer FSD_CmpFile::RootSectionSize()
 
 void FSD_CmpFile::ReadRoot(TCollection_AsciiString& rootName, Standard_Integer& aRef,TCollection_AsciiString& rootType) 
 {
-  if (!(myStream >> aRef)) Storage_StreamTypeMismatchError::Raise();
+  GetInteger (aRef);
   ReadWord(rootName);
   ReadWord(rootType);
 }
@@ -1042,8 +1061,7 @@ Storage_Error FSD_CmpFile::EndReadRootSection()
 
 Storage_Error FSD_CmpFile::BeginWriteRefSection() 
 {
-  myStream << "BEGIN_REF_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("BEGIN_REF_SECTION");
   return Storage_VSOk;
 }
 
@@ -1054,8 +1072,7 @@ Storage_Error FSD_CmpFile::BeginWriteRefSection()
 
 void FSD_CmpFile::SetRefSectionSize(const Standard_Integer aSize) 
 {
-  myStream << aSize << "\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine (aSize);
 }
 
 //=======================================================================
@@ -1066,8 +1083,8 @@ void FSD_CmpFile::SetRefSectionSize(const Standard_Integer aSize)
 void FSD_CmpFile::WriteReferenceType(const Standard_Integer reference,
                                  const Standard_Integer typeNum) 
 {
-  myStream << reference << " " << typeNum << "\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aLine;
+  WriteLine (aLine + reference + " " + typeNum);
 }
 
 //=======================================================================
@@ -1077,8 +1094,8 @@ void FSD_CmpFile::WriteReferenceType(const Standard_Integer reference,
 
 Storage_Error FSD_CmpFile::EndWriteRefSection() 
 {
-  myStream << "END_REF_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("END_REF_SECTION");
+
   return Storage_VSOk;
 }
 
@@ -1101,7 +1118,7 @@ Standard_Integer FSD_CmpFile::RefSectionSize()
 {
   Standard_Integer i;
 
-  if (!(myStream >> i)) Storage_StreamTypeMismatchError::Raise();
+  GetInteger (i);
   FlushEndOfLine();
 
   return i;
@@ -1115,8 +1132,8 @@ Standard_Integer FSD_CmpFile::RefSectionSize()
 void FSD_CmpFile::ReadReferenceType(Standard_Integer& reference,
                                 Standard_Integer& typeNum) 
 {
-  if (!(myStream >> reference)) Storage_StreamTypeMismatchError::Raise();
-  if (!(myStream >> typeNum)) Storage_StreamTypeMismatchError::Raise();
+  GetInteger (reference);
+  GetInteger (typeNum);
   FlushEndOfLine();
 }
 
@@ -1138,8 +1155,7 @@ Storage_Error FSD_CmpFile::EndReadRefSection()
 
 Storage_Error FSD_CmpFile::BeginWriteDataSection() 
 {
-  myStream << "BEGIN_DATA_SECTION";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("BEGIN_DATA_SECTION", Standard_False);
   return Storage_VSOk;
 }
 
@@ -1151,8 +1167,8 @@ Storage_Error FSD_CmpFile::BeginWriteDataSection()
 void FSD_CmpFile::WritePersistentObjectHeader(const Standard_Integer aRef,
                                           const Standard_Integer aType) 
 {
-  myStream << "\n#" << aRef << "%" << aType << " ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aLine;
+  WriteLine (aLine + "\n#" + aRef + "%" + aType + " ", Standard_False);
 }
 
 //=======================================================================
@@ -1162,7 +1178,7 @@ void FSD_CmpFile::WritePersistentObjectHeader(const Standard_Integer aRef,
 
 void FSD_CmpFile::BeginWritePersistentObjectData() 
 {
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  
 }
 
 //=======================================================================
@@ -1172,7 +1188,7 @@ void FSD_CmpFile::BeginWritePersistentObjectData()
 
 void FSD_CmpFile::BeginWriteObjectData() 
 {
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  
 }
 
 //=======================================================================
@@ -1182,7 +1198,7 @@ void FSD_CmpFile::BeginWriteObjectData()
 
 void FSD_CmpFile::EndWriteObjectData() 
 {
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  
 }
 
 //=======================================================================
@@ -1192,7 +1208,7 @@ void FSD_CmpFile::EndWriteObjectData()
 
 void FSD_CmpFile::EndWritePersistentObjectData() 
 {
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  
 }
 
 //=======================================================================
@@ -1202,8 +1218,8 @@ void FSD_CmpFile::EndWritePersistentObjectData()
 
 Storage_Error FSD_CmpFile::EndWriteDataSection() 
 {
-  myStream << "\nEND_DATA_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("\nEND_DATA_SECTION");
+
   return Storage_VSOk;
 }
 
@@ -1227,28 +1243,27 @@ void FSD_CmpFile::ReadPersistentObjectHeader(Standard_Integer& aRef,
 {
   char c;
 
-  myStream.get(c);
+  Device()->Read( (Standard_Address)&c, sizeof( char ) );
 
   while (c != '#') {
     if (IsEnd() || (c != ' ') || (c == '\r')|| (c == '\n')) {
       Storage_StreamFormatError::Raise();
     }
-    myStream.get(c);
+    Device()->Read( (Standard_Address)&c, sizeof( char ) );
   }
 
-  if (!(myStream >> aRef)) Storage_StreamTypeMismatchError::Raise();
+  GetInteger (aRef);
 
-  myStream.get(c);
+  Device()->Read( (Standard_Address)&c, sizeof( char ) );
 
   while (c != '%') {
     if (IsEnd() || (c != ' ') || (c == '\r')|| (c == '\n')) {
       Storage_StreamFormatError::Raise();
     }
-    myStream.get(c);
+    Device()->Read( (Standard_Address)&c, sizeof( char ) );
   }
 
-  if (!(myStream >> aType)) Storage_StreamTypeMismatchError::Raise();
-//  cout << "REF:" << aRef << " TYPE:"<< aType << endl;
+  GetInteger (aType);
 }
 
 //=======================================================================
@@ -1258,7 +1273,6 @@ void FSD_CmpFile::ReadPersistentObjectHeader(Standard_Integer& aRef,
 
 void FSD_CmpFile::BeginReadPersistentObjectData() 
 {
-//cout << "BeginReadPersistentObjectData" << endl;
 }
 
 //=======================================================================
@@ -1268,7 +1282,6 @@ void FSD_CmpFile::BeginReadPersistentObjectData()
 
 void FSD_CmpFile::BeginReadObjectData() 
 {
-//  cout << "BeginReadObjectData" << endl;
 }
 
 //=======================================================================
@@ -1278,7 +1291,6 @@ void FSD_CmpFile::BeginReadObjectData()
 
 void FSD_CmpFile::EndReadObjectData() 
 {
-//  cout << "EndReadObjectData" << endl;
 }
 
 //=======================================================================
@@ -1290,17 +1302,16 @@ void FSD_CmpFile::EndReadPersistentObjectData()
 {
   char c;
 
-  myStream.get(c);
+  Device()->Read( (Standard_Address)&c, sizeof( char ) );
   while (c != '\n' && (c != '\r')) {
     if (IsEnd() || (c != ' ')) {
       Storage_StreamFormatError::Raise();
     }
-    myStream.get(c);
+    Device()->Read( (Standard_Address)&c, sizeof( char ) );
   }
  if (c == '\r') {
-   myStream.get(c);
+   Device()->Read( (Standard_Address)&c, sizeof( char ) );
  }
-//  cout << "EndReadPersistentObjectData" << endl;
 }
 
 //=======================================================================
@@ -1320,19 +1331,5 @@ Storage_Error FSD_CmpFile::EndReadDataSection()
 
 Storage_Position FSD_CmpFile::Tell()
 {
-  switch (OpenMode()) {
-  case Storage_VSRead:
-    return (Storage_Position) myStream.tellp();
-  case Storage_VSWrite:
-    return (Storage_Position) myStream.tellg();
-  case Storage_VSReadWrite: {
-    Storage_Position aPosR  = (Storage_Position) myStream.tellp();
-    Storage_Position aPosW  = (Storage_Position) myStream.tellg();
-    if (aPosR < aPosW)
-      return aPosW;
-    else
-      return aPosR;
+    return Device()->Tell();
   }
-  default: return -1;
-  }
-}
index 86eb8e197f5870acca177b486654ca2d989e3718..f442fb589d711435a73e034f1045c9ab170f3d5a 100644 (file)
@@ -23,6 +23,7 @@ inherits BaseDriver from Storage
 uses Position    from Storage,
      Error       from Storage,
      OpenMode    from Storage,
+     IODevice    from Storage,
      AsciiString from TCollection,
      SequenceOfAsciiString from TColStd,
      SequenceOfExtendedString from TColStd,
@@ -36,11 +37,12 @@ raises StreamTypeMismatchError from Storage,
 
 is
     Create returns File from FSD;
----Purpose:
--- Constructs a driver defining as a file, the physical
--- container for data to be stored or retrieved.
--- Use the function Open to give the name of the driven file.    
-    Open(me : in out; aName : AsciiString from TCollection; aMode : OpenMode from Storage) returns Error from Storage;
+---Purpose: Constructs a driver defining as a file, the physical
+--             container for data to be stored or retrieved.  Use the
+--             function Open to give the driven data device.
+
+    Open(me : in out; aDevice : IODevice from Storage; aMode : OpenMode from Storage)
+    returns Error from Storage is redefined;
 ---Purpose:
 -- Assigns as aName the name of the file to be
 -- driven by this driver. aMode precises if the file is
@@ -53,8 +55,8 @@ is
     Tell( me : in out ) returns Position from Storage;
         ---Purpose: return position in the file. Return -1 upon error.
 
-    IsGoodFileType(myclass; aName : AsciiString from TCollection)
-       returns Error from Storage;
+    IsGoodFileType(myclass; aDevice : IODevice from Storage)
+    returns Error from Storage;
     
     -- INFO SECTION
     -- write
@@ -309,6 +311,9 @@ is
     Destroy(me : in out);
     ---C++: alias ~
 
+    WriteLine(me : in out; buffer : AsciiString from TCollection; putNewLine: Boolean from Standard = Standard_True) is protected;
+    ---Purpose: write the line.
+
     ReadLine(me : in out; buffer : in out AsciiString from TCollection) is protected;
     ---Purpose: read from the current position to the end of line.
     
@@ -328,7 +333,7 @@ is
 
     ReadString(me : in out; buffer : in out AsciiString from TCollection) is protected;
     ---Purpose: read from the first none space character position to the end of line.
-    
+
     FlushEndOfLine(me : in out) is protected;
     
     FindTag(me : in out; aTag : CString from Standard) returns Error from Storage is protected; 
@@ -337,7 +342,4 @@ is
        returns CString from Standard is private;
     ---C++: return const
     
-    fields
-    
-       myStream    : FStream from FSD;
 end;
index bf62a62c458cc7c6ab3b3299806b1b5fee6c0748..d120154996e386781118240f13ce4c5c32511079 100644 (file)
@@ -37,12 +37,12 @@ FSD_File::FSD_File()
 //           write
 //=======================================================================
 
-Storage_Error FSD_File::IsGoodFileType(const TCollection_AsciiString& aName)
+Storage_Error FSD_File::IsGoodFileType(const Handle(Storage_IODevice)& aDevice)
 {
   FSD_File      f;
   Storage_Error s;
 
-  s = f.Open(aName,Storage_VSRead);
+  s = f.Open(aDevice, Storage_VSRead);
 
   if (s == Storage_VSOk) {
     TCollection_AsciiString l;
@@ -65,11 +65,16 @@ Storage_Error FSD_File::IsGoodFileType(const TCollection_AsciiString& aName)
 //purpose  : 
 //=======================================================================
 
-Storage_Error FSD_File::Open(const TCollection_AsciiString& aName,const Storage_OpenMode aMode)
+Storage_Error FSD_File::Open(const Handle(Storage_IODevice)& aDevice, const Storage_OpenMode aMode)
 {
-  Storage_Error result = Storage_VSOk;
+  SetDevice(aDevice);
+
+  if ( Device().IsNull() )
+    return Storage_VSOpenError;
 
-  SetName(aName);
+  return Device()->Open(aMode);
+  /*
+  Storage_Error result = Storage_VSOk;
 
   if (OpenMode() == Storage_VSNone) {
 
@@ -109,6 +114,7 @@ Storage_Error FSD_File::Open(const TCollection_AsciiString& aName,const Storage_
   }
 
   return result;
+  */
 }
 
 //=======================================================================
@@ -118,7 +124,7 @@ Storage_Error FSD_File::Open(const TCollection_AsciiString& aName,const Storage_
 
 Standard_Boolean FSD_File::IsEnd()
 {
-  return myStream.eof();
+  return !Device().IsNull() ? Device()->IsEnd() : Standard_True;
 }
 
 //=======================================================================
@@ -131,8 +137,7 @@ Storage_Error FSD_File::Close()
   Storage_Error result = Storage_VSOk;
 
   if (OpenMode() != Storage_VSNone) {
-    myStream.close();
-    SetOpenMode(Storage_VSNone);
+    Device()->Close();
   }
   else {
     result = Storage_VSNotOpen;
@@ -176,6 +181,21 @@ void FSD_File::FlushEndOfLine()
   }*/
 }
 
+//=======================================================================
+//function : WriteLine
+//purpose  : write the line.
+//=======================================================================
+
+void FSD_File::WriteLine(const TCollection_AsciiString& aStr, const Standard_Boolean putNewLine)
+{
+  TCollection_AsciiString buffer = aStr;
+  if ( putNewLine )
+    buffer += TCollection_AsciiString("\n");
+
+  if ( Device()->Write( (Standard_Address)buffer.ToCString(), buffer.Length() ) != (Standard_Size)buffer.Length() )
+    Storage_StreamWriteError::Raise();
+}
+
 //=======================================================================
 //function : ReadLine
 //purpose  : read from the current position to the end of line.
@@ -183,24 +203,24 @@ void FSD_File::FlushEndOfLine()
 
 void FSD_File::ReadLine(TCollection_AsciiString& buffer)
 {
-  char Buffer[8193];
+  //  char Buffer[8193];
   Standard_Boolean IsEnd = Standard_False;
   
   buffer.Clear();
 
-  while (!IsEnd && !FSD_File::IsEnd()) {
-    Buffer[0] = '\0';
-    myStream.getline(Buffer,8192,'\n');
-    
-//    char c;
-//    if (myStream.get(c) && c != '\n') {
-//      buffer += Buffer;
-//      buffer += c;
-//    }
-//    else {
-      buffer += Buffer;
+  while ( !IsEnd && !FSD_File::IsEnd() )
+  {
+    //    Buffer[0] = '\0';
+    //    myStream.getline(Buffer,8192,'\n');
+    Standard_Character c;
+    Device()->Read( (Standard_Address)&c, 1 );
+    if ( c != '\n')
+      buffer += c;
+    else
+    {
+      buffer += '\0';
       IsEnd = Standard_True;
-//    }
+    }
   }
 }
 
@@ -219,11 +239,15 @@ void FSD_File::WriteExtendedLine(const TCollection_ExtendedString& buffer)
   for (i = 0; i < buffer.Length(); i++) {
     c = (extBuffer[i] & 0x0000FF00 ) >> 8 ;
     d = extBuffer[i] & 0x000000FF;
+    
+    char cc = (char)c;
+    char cd = (char)d;
 
-    myStream << (char)c << (char)d;
+    Device()->Write( (Standard_Address)&cc, sizeof(char) );
+    Device()->Write( (Standard_Address)&cd, sizeof(char) );
   }
 
-  myStream << (char)0 << "\n";
+  Device()->Write((Standard_Address)"\0\n", 2);
 }
 
 //=======================================================================
@@ -241,7 +265,7 @@ void FSD_File::ReadExtendedLine(TCollection_ExtendedString& buffer)
   buffer.Clear();
 
   while (!fin && !IsEnd()) {
-    myStream.get(c);
+    Device()->Read( (Standard_Address)&c, sizeof(char) );
 
     if (c == tg[count]) count++;
     else count = 0;
@@ -251,7 +275,7 @@ void FSD_File::ReadExtendedLine(TCollection_ExtendedString& buffer)
       if (c == '\0') fin = Standard_True;
       i = (i << 8);
       
-      myStream.get(c);
+      Device()->Read( (Standard_Address)&c, sizeof(char) );
       if (c == tg[count]) count++;
       else count = 0;
       if (count < SIZEOFNORMALEXTENDEDSECTION) {
@@ -285,7 +309,7 @@ void FSD_File::ReadChar(TCollection_AsciiString& buffer, const Standard_Size rsi
   buffer.Clear();
 
   while (!IsEnd() && (ccount < rsize)) {
-    myStream.get(c);
+    Device()->Read( (Standard_Address)&c, sizeof( char ) );
     buffer += c;
     ccount++;
   }
@@ -298,34 +322,30 @@ void FSD_File::ReadChar(TCollection_AsciiString& buffer, const Standard_Size rsi
 
 void FSD_File::ReadString(TCollection_AsciiString& buffer)
 {
-  char Buffer[8193];
-  char *bpos;
   Standard_Boolean IsEnd = Standard_False,isFirstTime = Standard_True;
   
   buffer.Clear();
   
   while (!IsEnd && !FSD_File::IsEnd()) {
-    Buffer[0] = '\0';
-    myStream.getline(Buffer,8192,'\n');
-    bpos = Buffer;
-
-    // LeftAdjust
-    //
-    if (isFirstTime) {
-      isFirstTime = Standard_False;
-      while (*bpos == '\n' || *bpos == ' ') bpos++;
+
+    char c;
+    Device()->Read((Standard_Address)&c, sizeof(c));
+    if ( isFirstTime )
+    {
+      if ( c == '\n' || c == ' ' )
+        continue;
+      else
+        isFirstTime = Standard_False;
     }
-//    char c;
-//    if (myStream.get(c) && c != '\n') {
-//      buffer += bpos;
-//      buffer += c;
-//    }
-//    else {
-      buffer += bpos;
+
+    if ( c != '\n')
+      buffer += c;
+    else
+    {
+      buffer += '\0';
       IsEnd = Standard_True;
-//    }
+    }
   }
-  
 }
 
 //=======================================================================
@@ -345,8 +365,9 @@ void FSD_File::ReadWord(TCollection_AsciiString& buffer)
   buffer.Clear();
 
   while (!IsEnd && !FSD_File::IsEnd()) {
-    myStream.get(c);
-    if ((c != ' ') && (c != '\n')) IsEnd = Standard_True;
+    Device()->Read( (Standard_Address)&c, sizeof(char) );
+    if ((c != ' ') && (c != '\n'))
+      IsEnd = Standard_True;
   }
 
   IsEnd = Standard_False;
@@ -361,8 +382,9 @@ void FSD_File::ReadWord(TCollection_AsciiString& buffer)
     }
     *tmpb = c;
     tmpb++; i++;
-    myStream.get(c);
-    if ((c == '\n') || (c == ' ')) IsEnd = Standard_True;
+    Device()->Read( (Standard_Address)&c, sizeof(char) );
+    if ((c == '\n') || (c == ' '))
+      IsEnd = Standard_True;
   }
 
   buffer += b;
@@ -408,8 +430,10 @@ void FSD_File::SkipObject()
 
 Storage_BaseDriver& FSD_File::PutReference(const Standard_Integer aValue)
 {
-  myStream << aValue << " ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aStr = TCollection_AsciiString( aValue ) + " ";
+  if ( Device()->Write( (Standard_Address)aStr.ToCString(), aStr.Length() ) != (Standard_Size)aStr.Length() )
+    Storage_StreamWriteError::Raise();
+
   return *this;
 }
 
@@ -420,11 +444,10 @@ Storage_BaseDriver& FSD_File::PutReference(const Standard_Integer aValue)
 
 Storage_BaseDriver& FSD_File::PutCharacter(const Standard_Character aValue)
 {
-  unsigned short i;
-
-  i = aValue;
-  myStream << i << " ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  Standard_Integer i = aValue;
+  TCollection_AsciiString aStr = TCollection_AsciiString( i ) + " ";
+  if ( Device()->Write( (Standard_Address)aStr.ToCString(), aStr.Length() ) != (Standard_Size)aStr.Length() )
+    Storage_StreamWriteError::Raise();
   return *this;
 }
 
@@ -435,8 +458,10 @@ Storage_BaseDriver& FSD_File::PutCharacter(const Standard_Character aValue)
 
 Storage_BaseDriver& FSD_File::PutExtCharacter(const Standard_ExtCharacter aValue)
 {
-  myStream << aValue << " ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  Standard_Integer i = aValue;
+  TCollection_AsciiString aStr = TCollection_AsciiString( i ) + " ";
+  if ( Device()->Write( (Standard_Address)aStr.ToCString(), aStr.Length() ) != (Standard_Size)aStr.Length() )
+    Storage_StreamWriteError::Raise();
   return *this;
 }
 
@@ -447,8 +472,9 @@ Storage_BaseDriver& FSD_File::PutExtCharacter(const Standard_ExtCharacter aValue
 
 Storage_BaseDriver& FSD_File::PutInteger(const Standard_Integer aValue)
 {
-  myStream << aValue << " ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aStr = TCollection_AsciiString( aValue ) + " ";
+  if ( Device()->Write( (Standard_Address)aStr.ToCString(), aStr.Length() ) != (Standard_Size)aStr.Length() )
+    Storage_StreamWriteError::Raise();
   return *this;
 }
 
@@ -459,8 +485,9 @@ Storage_BaseDriver& FSD_File::PutInteger(const Standard_Integer aValue)
 
 Storage_BaseDriver& FSD_File::PutBoolean(const Standard_Boolean aValue)
 {
-  myStream << ((Standard_Integer)aValue) << " ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aStr = TCollection_AsciiString( (Standard_Integer)aValue ) + " ";
+  if ( Device()->Write( (Standard_Address)aStr.ToCString(), aStr.Length() ) != (Standard_Size)aStr.Length() )
+    Storage_StreamWriteError::Raise();
   return *this;
 }
 
@@ -471,8 +498,9 @@ Storage_BaseDriver& FSD_File::PutBoolean(const Standard_Boolean aValue)
 
 Storage_BaseDriver& FSD_File::PutReal(const Standard_Real aValue)
 {
-  myStream << ((Standard_Real)aValue) << " ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aStr = TCollection_AsciiString( aValue ) + " ";
+  if ( Device()->Write( (Standard_Address)aStr.ToCString(), aStr.Length() ) != (Standard_Size)aStr.Length() )
+    Storage_StreamWriteError::Raise();
   return *this;
 }
 
@@ -483,8 +511,9 @@ Storage_BaseDriver& FSD_File::PutReal(const Standard_Real aValue)
 
 Storage_BaseDriver& FSD_File::PutShortReal(const Standard_ShortReal aValue)
 {
-  myStream << aValue << " ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aStr = TCollection_AsciiString( aValue ) + " ";
+  if ( Device()->Write( (Standard_Address)aStr.ToCString(), aStr.Length() ) != (Standard_Size)aStr.Length() )
+    Storage_StreamWriteError::Raise();
   return *this;
 }
 
@@ -495,7 +524,12 @@ Storage_BaseDriver& FSD_File::PutShortReal(const Standard_ShortReal aValue)
 
 Storage_BaseDriver& FSD_File::GetReference(Standard_Integer& aValue)
 {
-  if (!(myStream >> aValue)) Storage_StreamTypeMismatchError::Raise();
+  TCollection_AsciiString aStr;
+  ReadWord( aStr );
+  if ( aStr.IsIntegerValue() )
+    aValue = aStr.IntegerValue();
+  else
+    Storage_StreamTypeMismatchError::Raise();
 
   return *this;
 }
@@ -508,13 +542,13 @@ Storage_BaseDriver& FSD_File::GetReference(Standard_Integer& aValue)
 Storage_BaseDriver& FSD_File::GetCharacter(Standard_Character& aValue)
 {
   unsigned short i = 0;
-  if (!(myStream >> i)) {
-    // SGI : donne une erreur mais a une bonne valeur pour les caracteres ecrits
-    //       signes (-80 fait ios::badbit, mais la variable i est initialisee)
-    //
-    if (i == 0) Storage_StreamTypeMismatchError::Raise();
-    myStream.clear(ios::goodbit); // .clear(0) is not portable
-  }
+  TCollection_AsciiString aStr;
+  ReadWord( aStr );
+  if ( aStr.IsIntegerValue() )
+    i = (unsigned short)aStr.IntegerValue();
+  else
+    Storage_StreamTypeMismatchError::Raise();
+
   aValue = (char)i;
 
   return *this;
@@ -527,8 +561,16 @@ Storage_BaseDriver& FSD_File::GetCharacter(Standard_Character& aValue)
 
 Storage_BaseDriver& FSD_File::GetExtCharacter(Standard_ExtCharacter& aValue)
 {
-  if (!(myStream >> aValue)) Storage_StreamTypeMismatchError::Raise();
-  
+  unsigned short i = 0;
+  TCollection_AsciiString aStr;
+  ReadWord( aStr );
+  if ( aStr.IsIntegerValue() )
+    i = (unsigned short)aStr.IntegerValue();
+  else
+    Storage_StreamTypeMismatchError::Raise();
+
+  aValue = (Standard_ExtCharacter)i;
+
   return *this;
 }
 
@@ -539,7 +581,12 @@ Storage_BaseDriver& FSD_File::GetExtCharacter(Standard_ExtCharacter& aValue)
 
 Storage_BaseDriver& FSD_File::GetInteger(Standard_Integer& aValue)
 {
-  if (!(myStream >> aValue)) Storage_StreamTypeMismatchError::Raise();
+  TCollection_AsciiString aStr;
+  ReadWord( aStr );
+  if ( aStr.IsIntegerValue() )
+    aValue = aStr.IntegerValue();
+  else
+    Storage_StreamTypeMismatchError::Raise();
 
   return *this;
 }
@@ -551,7 +598,12 @@ Storage_BaseDriver& FSD_File::GetInteger(Standard_Integer& aValue)
 
 Storage_BaseDriver& FSD_File::GetBoolean(Standard_Boolean& aValue)
 {
-  if (!(myStream >> aValue)) Storage_StreamTypeMismatchError::Raise();
+  TCollection_AsciiString aStr;
+  ReadWord( aStr );
+  if ( aStr.IsIntegerValue() )
+    aValue = (Standard_Boolean)aStr.IntegerValue();
+  else
+    Storage_StreamTypeMismatchError::Raise();
 
   return *this;
 }
@@ -563,19 +615,14 @@ Storage_BaseDriver& FSD_File::GetBoolean(Standard_Boolean& aValue)
 
 Storage_BaseDriver& FSD_File::GetReal(Standard_Real& aValue)
 {
-#ifdef USEOSDREAL
-  char realbuffer[100];
-
-  realbuffer[0] = '\0';
-  if (!(myStream >> realbuffer)) Storage_StreamTypeMismatchError::Raise();
-  if (!OSD::CStringToReal(realbuffer,aValue)) Storage_StreamTypeMismatchError::Raise();
-
-  return *this;
-#else
-  if (!(myStream >> aValue)) Storage_StreamTypeMismatchError::Raise();
+  TCollection_AsciiString aStr;
+  ReadWord( aStr );
+  if ( aStr.IsRealValue() )
+    aValue = aStr.RealValue();
+  else
+    Storage_StreamTypeMismatchError::Raise();
 
   return *this;
-#endif
 }
 
 //=======================================================================
@@ -585,21 +632,13 @@ Storage_BaseDriver& FSD_File::GetReal(Standard_Real& aValue)
 
 Storage_BaseDriver& FSD_File::GetShortReal(Standard_ShortReal& aValue)
 {
-#ifdef USEOSDREAL
-  char realbuffer[100];
-  Standard_Real r = 0.0;
-
-  realbuffer[0] = '\0';
-  if (!(myStream >> realbuffer)) Storage_StreamTypeMismatchError::Raise();
-  if (!OSD::CStringToReal(realbuffer,r)) Storage_StreamTypeMismatchError::Raise();
-
-  aValue = r;
-
-  return *this;
-#else
-  if (!(myStream >> aValue)) Storage_StreamTypeMismatchError::Raise();
+  TCollection_AsciiString aStr;
+  ReadWord( aStr );
+  if ( aStr.IsRealValue() )
+    aValue = (Standard_ShortReal)aStr.RealValue();
+  else
+    Storage_StreamTypeMismatchError::Raise();
  return *this;
-#endif
 }
 
 //=======================================================================
@@ -621,9 +660,8 @@ void FSD_File::Destroy()
 
 Storage_Error FSD_File::BeginWriteInfoSection() 
 {
-  myStream << FSD_File::MagicNumber() << '\n';
-  myStream << "BEGIN_INFO_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine( FSD_File::MagicNumber() );
+  WriteLine( "BEGIN_INFO_SECTION" );
 
   return Storage_VSOk;
 }
@@ -645,23 +683,20 @@ void FSD_File::WriteInfo(const Standard_Integer nbObj,
 {
   Standard_Integer i;
 
-  myStream << nbObj;
-  myStream << "\n";
-  myStream << dbVersion.ToCString() << "\n";
-  myStream << date.ToCString() << "\n";
-  myStream << schemaName.ToCString() << "\n";
-  myStream << schemaVersion.ToCString() << "\n";
+  PutInteger( nbObj );
+  WriteLine( "" );
+  WriteLine( dbVersion );
+  WriteLine( date );
+  WriteLine( schemaName );
+  WriteLine( schemaVersion );
   WriteExtendedLine(appName);
-  myStream << appVersion.ToCString() << "\n";
+  WriteLine( appVersion );
   WriteExtendedLine(dataType);
-  myStream << userInfo.Length() << "\n";
-
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  PutInteger( userInfo.Length() );
+  WriteLine( "" );
 
-  for (i = 1; i <= userInfo.Length(); i++) {
-    myStream << userInfo.Value(i).ToCString() << "\n";
-    if (myStream.bad()) Storage_StreamWriteError::Raise();
-  }
+  for (i = 1; i <= userInfo.Length(); i++)
+    WriteLine( userInfo.Value(i) );
 }
 
 //=======================================================================
@@ -671,8 +706,8 @@ void FSD_File::WriteInfo(const Standard_Integer nbObj,
 
 Storage_Error FSD_File::EndWriteInfoSection() 
 {
-  myStream << "END_INFO_SECTION\n";
-  if (myStream.bad())  Storage_StreamWriteError::Raise();
+  WriteLine( "END_INFO_SECTION" );
+
   return Storage_VSOk;
 }
 
@@ -714,7 +749,7 @@ void FSD_File::ReadInfo(Standard_Integer& nbObj,
                        TCollection_ExtendedString& dataType,
                        TColStd_SequenceOfAsciiString& userInfo) 
 {
-  if (!(myStream >> nbObj)) Storage_StreamTypeMismatchError::Raise();
+  GetInteger( nbObj );
 
   FlushEndOfLine();
 
@@ -728,7 +763,7 @@ void FSD_File::ReadInfo(Standard_Integer& nbObj,
 
   Standard_Integer i,len = 0;
 
-  if (!(myStream >> len)) Storage_StreamTypeMismatchError::Raise();
+  GetInteger( len );
 
   FlushEndOfLine();
 
@@ -759,8 +794,8 @@ Storage_Error FSD_File::EndReadInfoSection()
 
 Storage_Error FSD_File::BeginWriteCommentSection() 
 {
-  myStream << "BEGIN_COMMENT_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine( "BEGIN_COMMENT_SECTION" );
+
   return Storage_VSOk;
 }
 
@@ -774,12 +809,10 @@ void FSD_File::WriteComment(const TColStd_SequenceOfExtendedString& aCom)
  Standard_Integer i,aSize;
 
  aSize = aCom.Length();
- myStream << aSize << "\n";
- if (myStream.bad()) Storage_StreamWriteError::Raise();
+ PutInteger( aSize );
 
  for (i = 1; i <= aSize; i++) {
    WriteExtendedLine(aCom.Value(i));
-   if (myStream.bad()) Storage_StreamWriteError::Raise();
  }
 }
 
@@ -790,8 +823,8 @@ void FSD_File::WriteComment(const TColStd_SequenceOfExtendedString& aCom)
 
 Storage_Error FSD_File::EndWriteCommentSection() 
 {
-  myStream << "END_COMMENT_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine( "END_COMMENT_SECTION" );
+
   return Storage_VSOk;
 }
 
@@ -815,7 +848,7 @@ void FSD_File::ReadComment(TColStd_SequenceOfExtendedString& aCom)
   TCollection_ExtendedString line;
   Standard_Integer           len,i;
 
-  if (!(myStream >> len)) Storage_StreamTypeMismatchError::Raise();
+  GetInteger (len);
   
   FlushEndOfLine();  
 
@@ -843,8 +876,7 @@ Storage_Error FSD_File::EndReadCommentSection()
 
 Storage_Error FSD_File::BeginWriteTypeSection() 
 {
-  myStream << "BEGIN_TYPE_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("BEGIN_TYPE_SECTION");
   return Storage_VSOk;
 }
 
@@ -855,8 +887,7 @@ Storage_Error FSD_File::BeginWriteTypeSection()
 
 void FSD_File::SetTypeSectionSize(const Standard_Integer aSize) 
 {
-  myStream << aSize << "\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine (aSize);
 }
 
 //=======================================================================
@@ -867,8 +898,8 @@ void FSD_File::SetTypeSectionSize(const Standard_Integer aSize)
 void FSD_File::WriteTypeInformations(const Standard_Integer typeNum,
                                      const TCollection_AsciiString& typeName) 
 {
-  myStream << typeNum << " " << typeName.ToCString() << "\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aLine;
+  WriteLine (aLine + typeNum + " " + typeName.ToCString());
 }
 
 //=======================================================================
@@ -878,8 +909,8 @@ void FSD_File::WriteTypeInformations(const Standard_Integer typeNum,
 
 Storage_Error FSD_File::EndWriteTypeSection() 
 {
-  myStream << "END_TYPE_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("END_TYPE_SECTION");
+
   return Storage_VSOk;
 }
 
@@ -901,11 +932,8 @@ Storage_Error FSD_File::BeginReadTypeSection()
 Standard_Integer FSD_File::TypeSectionSize() 
 {
   Standard_Integer i;
-
-  if (!(myStream >> i)) Storage_StreamTypeMismatchError::Raise();
-
+  GetInteger (i);
   FlushEndOfLine();
-
   return i;
 }
 
@@ -917,8 +945,8 @@ Standard_Integer FSD_File::TypeSectionSize()
 void FSD_File::ReadTypeInformations(Standard_Integer& typeNum,
                                    TCollection_AsciiString& typeName) 
 {
-  if (!(myStream >> typeNum)) Storage_StreamTypeMismatchError::Raise();
-  if (!(myStream >> typeName)) Storage_StreamTypeMismatchError::Raise();
+  GetInteger (typeNum);
+  ReadLine(typeName);
   FlushEndOfLine();
 }
 
@@ -940,8 +968,7 @@ Storage_Error FSD_File::EndReadTypeSection()
 
 Storage_Error FSD_File::BeginWriteRootSection() 
 {
-  myStream << "BEGIN_ROOT_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("BEGIN_ROOT_SECTION");
   return Storage_VSOk;
 }
 
@@ -952,8 +979,7 @@ Storage_Error FSD_File::BeginWriteRootSection()
 
 void FSD_File::SetRootSectionSize(const Standard_Integer aSize) 
 {
-  myStream << aSize << "\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine (aSize);
 }
 
 //=======================================================================
@@ -963,8 +989,8 @@ void FSD_File::SetRootSectionSize(const Standard_Integer aSize)
 
 void FSD_File::WriteRoot(const TCollection_AsciiString& rootName, const Standard_Integer aRef, const TCollection_AsciiString& rootType) 
 {
-  myStream << aRef << " " << rootName.ToCString() << " " << rootType.ToCString() << "\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aLine;
+  WriteLine (aLine + aRef + " " + rootName.ToCString() + " " + rootType.ToCString());
 }
 
 //=======================================================================
@@ -974,8 +1000,7 @@ void FSD_File::WriteRoot(const TCollection_AsciiString& rootName, const Standard
 
 Storage_Error FSD_File::EndWriteRootSection() 
 {
-  myStream << "END_ROOT_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("END_ROOT_SECTION");
   return Storage_VSOk;
 }
 
@@ -997,11 +1022,8 @@ Storage_Error FSD_File::BeginReadRootSection()
 Standard_Integer FSD_File::RootSectionSize() 
 {
   Standard_Integer i;
-
-  if (!(myStream >> i)) Storage_StreamTypeMismatchError::Raise();
-  
+  GetInteger (i);
   FlushEndOfLine();
-  
   return i;
 }
 
@@ -1012,7 +1034,7 @@ Standard_Integer FSD_File::RootSectionSize()
 
 void FSD_File::ReadRoot(TCollection_AsciiString& rootName, Standard_Integer& aRef,TCollection_AsciiString& rootType) 
 {
-  if (!(myStream >> aRef)) Storage_StreamTypeMismatchError::Raise();
+  GetInteger (aRef);
   ReadWord(rootName);
   ReadWord(rootType);
 }
@@ -1035,8 +1057,7 @@ Storage_Error FSD_File::EndReadRootSection()
 
 Storage_Error FSD_File::BeginWriteRefSection() 
 {
-  myStream << "BEGIN_REF_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("BEGIN_REF_SECTION");
   return Storage_VSOk;
 }
 
@@ -1047,8 +1068,7 @@ Storage_Error FSD_File::BeginWriteRefSection()
 
 void FSD_File::SetRefSectionSize(const Standard_Integer aSize) 
 {
-  myStream << aSize << "\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine (aSize);
 }
 
 //=======================================================================
@@ -1059,8 +1079,8 @@ void FSD_File::SetRefSectionSize(const Standard_Integer aSize)
 void FSD_File::WriteReferenceType(const Standard_Integer reference,
                                  const Standard_Integer typeNum) 
 {
-  myStream << reference << " " << typeNum << "\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aLine;
+  WriteLine (aLine + reference + " " + typeNum);
 }
 
 //=======================================================================
@@ -1070,8 +1090,7 @@ void FSD_File::WriteReferenceType(const Standard_Integer reference,
 
 Storage_Error FSD_File::EndWriteRefSection() 
 {
-  myStream << "END_REF_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("END_REF_SECTION");
   return Storage_VSOk;
 }
 
@@ -1093,10 +1112,8 @@ Storage_Error FSD_File::BeginReadRefSection()
 Standard_Integer FSD_File::RefSectionSize() 
 {
   Standard_Integer i;
-
-  if (!(myStream >> i)) Storage_StreamTypeMismatchError::Raise();
+  GetInteger (i);
   FlushEndOfLine();
-
   return i;
 }
 
@@ -1108,8 +1125,8 @@ Standard_Integer FSD_File::RefSectionSize()
 void FSD_File::ReadReferenceType(Standard_Integer& reference,
                                 Standard_Integer& typeNum) 
 {
-  if (!(myStream >> reference)) Storage_StreamTypeMismatchError::Raise();
-  if (!(myStream >> typeNum)) Storage_StreamTypeMismatchError::Raise();
+  GetInteger (reference);
+  GetInteger (typeNum);
   FlushEndOfLine();
 }
 
@@ -1131,8 +1148,7 @@ Storage_Error FSD_File::EndReadRefSection()
 
 Storage_Error FSD_File::BeginWriteDataSection() 
 {
-  myStream << "BEGIN_DATA_SECTION";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("BEGIN_DATA_SECTION", Standard_False);
   return Storage_VSOk;
 }
 
@@ -1144,8 +1160,8 @@ Storage_Error FSD_File::BeginWriteDataSection()
 void FSD_File::WritePersistentObjectHeader(const Standard_Integer aRef,
                                           const Standard_Integer aType) 
 {
-  myStream << "\n#" << aRef << "=%" << aType;
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  TCollection_AsciiString aLine;
+  WriteLine (aLine + "\n#" + aRef + "=%" + aType);
 }
 
 //=======================================================================
@@ -1155,8 +1171,7 @@ void FSD_File::WritePersistentObjectHeader(const Standard_Integer aRef,
 
 void FSD_File::BeginWritePersistentObjectData() 
 {
-  myStream << "( ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("( ", Standard_False);
 }
 
 //=======================================================================
@@ -1166,8 +1181,7 @@ void FSD_File::BeginWritePersistentObjectData()
 
 void FSD_File::BeginWriteObjectData() 
 {
-  myStream << "( ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("( ", Standard_False);
 }
 
 //=======================================================================
@@ -1177,8 +1191,7 @@ void FSD_File::BeginWriteObjectData()
 
 void FSD_File::EndWriteObjectData() 
 {
-  myStream << ") ";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine (") ", Standard_False);
 }
 
 //=======================================================================
@@ -1188,8 +1201,7 @@ void FSD_File::EndWriteObjectData()
 
 void FSD_File::EndWritePersistentObjectData() 
 {
-  myStream << ")";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine (")", Standard_False);
 }
 
 //=======================================================================
@@ -1199,8 +1211,7 @@ void FSD_File::EndWritePersistentObjectData()
 
 Storage_Error FSD_File::EndWriteDataSection() 
 {
-  myStream << "\nEND_DATA_SECTION\n";
-  if (myStream.bad()) Storage_StreamWriteError::Raise();
+  WriteLine ("\nEND_DATA_SECTION");
   return Storage_VSOk;
 }
 
@@ -1224,38 +1235,37 @@ void FSD_File::ReadPersistentObjectHeader(Standard_Integer& aRef,
 {
   char c;
 
-  myStream.get(c);
+  Device()->Read( (Standard_Address)&c, sizeof(char) );
 
   while (c != '#') {
     if (IsEnd() || (c != ' ') || (c == '\n')) {
       Storage_StreamFormatError::Raise();
     }
-    myStream.get(c);
+    Device()->Read( (Standard_Address)&c, sizeof(char) );
   }
 
-  if (!(myStream >> aRef)) Storage_StreamTypeMismatchError::Raise();
+  GetInteger (aRef);
 
-  myStream.get(c);
+  Device()->Read( (Standard_Address)&c, sizeof(char) );
 
 
    while (c != '=') {
     if (IsEnd() || (c != ' ') || (c == '\n')) {
       Storage_StreamFormatError::Raise();
     }
-    myStream.get(c);
+    Device()->Read( (Standard_Address)&c, sizeof(char) );
   }
 
-  myStream.get(c);
+  Device()->Read( (Standard_Address)&c, sizeof(char) );
 
   while (c != '%') {
     if (IsEnd() || (c != ' ') || (c == '\n')) {
       Storage_StreamFormatError::Raise();
     }
-    myStream.get(c);
+    Device()->Read( (Standard_Address)&c, sizeof(char) );
   }
 
-  if (!(myStream >> aType)) Storage_StreamTypeMismatchError::Raise();
-//  cout << "REF:" << aRef << " TYPE:"<< aType << endl;
+  GetInteger (aType);
 }
 
 //=======================================================================
@@ -1266,15 +1276,13 @@ void FSD_File::ReadPersistentObjectHeader(Standard_Integer& aRef,
 void FSD_File::BeginReadPersistentObjectData() 
 {
   char c;
-  myStream.get(c);
+  Device()->Read( (Standard_Address)&c, sizeof(char) );
   while (c != '(') {
     if (IsEnd() || (c != ' ') || (c == '\n')) {
       Storage_StreamFormatError::Raise();
     }
-    myStream.get(c);
+    Device()->Read( (Standard_Address)&c, sizeof(char) );
   }
-
-//cout << "BeginReadPersistentObjectData" << endl;
 }
 
 //=======================================================================
@@ -1286,15 +1294,13 @@ void FSD_File::BeginReadObjectData()
 {
 
   char c;
-  myStream.get(c);
+  Device()->Read( (Standard_Address)&c, sizeof(char) );
   while (c != '(') {
     if (IsEnd() || (c != ' ') || (c == '\n')) {
       Storage_StreamFormatError::Raise();
     }
-    myStream.get(c);
+    Device()->Read( (Standard_Address)&c, sizeof(char) );
   }
-
-//  cout << "BeginReadObjectData" << endl;
 }
 
 //=======================================================================
@@ -1306,15 +1312,13 @@ void FSD_File::EndReadObjectData()
 {
 
   char c;
-  myStream.get(c);
+  Device()->Read( (Standard_Address)&c, sizeof(char) );
   while (c != ')') {
     if (IsEnd() || (c != ' ') || (c == '\n')) {
       Storage_StreamFormatError::Raise();
     }
-    myStream.get(c);
+    Device()->Read( (Standard_Address)&c, sizeof(char) );
   }
-
-//  cout << "EndReadObjectData" << endl;
 }
 
 //=======================================================================
@@ -1327,22 +1331,21 @@ void FSD_File::EndReadPersistentObjectData()
 
   char c;
 
-  myStream.get(c);
+  Device()->Read( (Standard_Address)&c, sizeof(char) );
   while (c != ')') {
     if (IsEnd() || (c != ' ') || (c == '\n')) {
       Storage_StreamFormatError::Raise();
     }
-    myStream.get(c);
+    Device()->Read( (Standard_Address)&c, sizeof(char) );
   }
 
-  myStream.get(c);
+  Device()->Read( (Standard_Address)&c, sizeof(char) );
   while (c != '\n') {
     if (IsEnd() || (c != ' ')) {
       Storage_StreamFormatError::Raise();
     }
-    myStream.get(c);
+    Device()->Read( (Standard_Address)&c, sizeof(char) );
   }
-//  cout << "EndReadPersistentObjectData" << endl;
 }
 
 //=======================================================================
@@ -1362,19 +1365,5 @@ Storage_Error FSD_File::EndReadDataSection()
 
 Storage_Position FSD_File::Tell()
 {
-  switch (OpenMode()) {
-  case Storage_VSRead:
-    return (Storage_Position) myStream.tellp();
-  case Storage_VSWrite:
-    return (Storage_Position) myStream.tellg();
-  case Storage_VSReadWrite: {
-    Storage_Position aPosR  = (Storage_Position) myStream.tellp();
-    Storage_Position aPosW  = (Storage_Position) myStream.tellg();
-    if (aPosR < aPosW)
-      return aPosW;
-    else
-      return aPosR;
-  }
-  default: return -1;
-  }
+  return Device()->Tell();
 }
index bf0968555cc0575ef84e197803085e0c62dac780..07f2f373d4006f068fddd4e3961ae0fdeef64c2e 100644 (file)
@@ -184,6 +184,19 @@ LDOM_XmlWriter::LDOM_XmlWriter (FILE            * aFile,
        myABufferLen   (0)
 {}
 
+
+LDOM_XmlWriter::LDOM_XmlWriter(const Handle(Storage_IODevice)& theDevice,
+                               const char * theEncoding )
+  : myFile         (NULL),
+    myEncodingName (::getEncodingName (theEncoding)),
+    myIndent       (0),
+    myCurIndent    (0),
+    myABuffer      (NULL),
+    myABufferLen   (0)
+{
+  myDevice = theDevice;
+}
+
 //=======================================================================
 //function : ~LDOM_XmlWriter
 //purpose  : Destructor
@@ -222,7 +235,16 @@ inline LDOM_XmlWriter& LDOM_XmlWriter::operator <<
     {
       Standard_Integer aValue;
       aString.GetInteger (aValue);
-      fprintf (myFile, "%d", aValue);
+      if (!myDevice.IsNull() && myDevice->CanWrite())
+      {
+        TCollection_AsciiString aStrValue (aValue);
+        myDevice->Write ((Standard_Address)aStrValue.ToCString(), strlen (aStrValue.ToCString()));
+      }
+      else
+      {
+        fprintf (myFile, "%d", aValue);
+      }
+      
       break;
     }
   case LDOMBasicString::LDOM_AsciiHashed:       // attr names and element tags
@@ -231,7 +253,17 @@ inline LDOM_XmlWriter& LDOM_XmlWriter::operator <<
       const char * str = aString.GetString();
       if (str) {
         const Standard_Size aLen = strlen (str);
-        if (aLen > 0) fwrite (str, aLen, 1, myFile);
+        if (aLen > 0) 
+        {
+          if (!myDevice.IsNull() && myDevice->CanWrite())
+          {
+            myDevice->Write((Standard_Address)str, aLen);
+          }
+          else
+          {
+            fwrite (str, aLen, 1, myFile);
+          }
+        }
       }
     }
     break;
@@ -242,7 +274,17 @@ inline LDOM_XmlWriter& LDOM_XmlWriter::operator <<
       if (str) {
         Standard_Integer aLen;
         char * encStr = LDOM_CharReference::Encode(str, aLen, Standard_False);
-        if (aLen > 0) fwrite (encStr, aLen, 1, myFile);
+        if (aLen > 0)
+        {
+          if (!myDevice.IsNull() && myDevice->CanWrite())
+          {
+            myDevice->Write(encStr, aLen);
+          }
+          else
+          {
+            fwrite (encStr, aLen, 1, myFile);
+          }
+        }
         if (encStr != str) delete [] encStr;
       }
     }
@@ -258,7 +300,17 @@ inline LDOM_XmlWriter& LDOM_XmlWriter::operator <<
 inline LDOM_XmlWriter& LDOM_XmlWriter::operator << (const LXMLCh * aString)
 {
   Standard_Size aLength = strlen (aString);
-  if (aLength > 0) fwrite ((void *) aString, aLength, 1, myFile);
+  if (aLength > 0)
+  {
+    if (!myDevice.IsNull() && myDevice->CanWrite())
+    {
+      myDevice->Write((Standard_Address)aString, aLength);
+    }
+    else
+    {
+      fwrite ((void *) aString, aLength, 1, myFile);
+    } 
+  }
   return * this;
 }
 
@@ -268,7 +320,15 @@ inline LDOM_XmlWriter& LDOM_XmlWriter::operator << (const LXMLCh * aString)
 //=======================================================================
 inline LDOM_XmlWriter& LDOM_XmlWriter::operator << (const LXMLCh aChar)
 {
-  fputc (aChar, myFile);
+  if (!myDevice.IsNull() && myDevice->CanWrite())
+  {
+    LXMLCh atmp = aChar;
+    myDevice->Write (&atmp, sizeof(LXMLCh));
+  }
+  else
+  {
+    fputc (aChar, myFile);
+  }
   return * this;
 }
 
@@ -316,7 +376,15 @@ void LDOM_XmlWriter::WriteAttribute (const LDOM_Node& theAtt)
              chEqual, chDoubleQuote, encStr, chDoubleQuote);
     if (encStr != aValue) delete [] encStr;
   }
-  fwrite ((void *) myABuffer, aLength, 1, myFile);
+
+  if (!myDevice.IsNull() && myDevice->CanWrite())
+  {
+    myDevice->Write(myABuffer, aLength);
+  }
+  else
+  {
+    fwrite ((void *) myABuffer, aLength, 1, myFile);
+  }  
 }
 
 //=======================================================================
index 9965e5c3632bcfde9241805f964ba9991c35f71b..0bfe0668d5d442f8f0640332732b603e639ef46c 100644 (file)
@@ -16,6 +16,8 @@
 #ifndef LDOM_XmlWriter_HeaderFile
 #define LDOM_XmlWriter_HeaderFile
 
+#include <Storage_IODevice.hxx>
+
 #include <Standard_TypeDef.hxx>
 #include <stdio.h>
 
@@ -29,9 +31,12 @@ class LDOM_XmlWriter
 {
  public:
 
-  Standard_EXPORT LDOM_XmlWriter (FILE * aFile, const char * theEncoding= NULL);
+  Standard_EXPORT LDOM_XmlWriter (FILE * aFile, const char* theEncoding = NULL);
   // Constructor
 
+  Standard_EXPORT LDOM_XmlWriter(const Handle(Storage_IODevice)& theDevice,
+                                 const char * theEncoding = NULL );
+
   Standard_EXPORT ~LDOM_XmlWriter ();
   // Destructor
 
@@ -73,6 +78,7 @@ class LDOM_XmlWriter
   Standard_Integer              myCurIndent;
   char *                        myABuffer;      // for WriteAttribute()
   Standard_Integer              myABufferLen;   // for WriteAttribute()
+  Handle(Storage_IODevice)      myDevice;
 };
 
 #endif
index 29e9d6cf824c13d121d20c5db3c501200f4270ab..ab6d2afcc4d2cf1ce90ed8330adabdd07749f639 100644 (file)
@@ -55,6 +55,9 @@ is
        
        class PatternStdStorageDriver;
 
+        class PresentationStorageDriver;
+
+        class PositionStorageDriver;
  
     
     ---Category: Retrieval drivers for PDataXtd attributes
@@ -76,6 +79,12 @@ is
        
        class PatternStdRetrievalDriver;
 
+       class PresentationRetrievalDriver;
+
+       class PresentationRetrievalDriver_1;
+       
+       class PositionRetrievalDriver;
+
 
 
     AddStorageDrivers(aDriverSeq : ASDriverHSequence from MDF; theMessageDriver : MessageDriver from CDM);
index b42ac20b21ddc87811f6a53ccfae82035ac5db1c..0775b8c0c7c79acb6a3cb05b57019e4189772c86 100644 (file)
@@ -34,6 +34,8 @@
 #include <MDataXtd_ConstraintStorageDriver.hxx>
 #include <MDataXtd_PlacementStorageDriver.hxx>
 #include <MDataXtd_PatternStdStorageDriver.hxx>
+#include <MDataXtd_PositionStorageDriver.hxx>
+#include <MDataXtd_PositionRetrievalDriver.hxx>
 
 // Retrieval
 #include <MDataXtd_ShapeRetrievalDriver.hxx>
@@ -44,6 +46,9 @@
 #include <MDataXtd_ConstraintRetrievalDriver.hxx>
 #include <MDataXtd_PlacementRetrievalDriver.hxx>
 #include <MDataXtd_PatternStdRetrievalDriver.hxx>
+#include <MDataXtd_PresentationStorageDriver.hxx>
+#include <MDataXtd_PresentationRetrievalDriver.hxx>
+#include <MDataXtd_PresentationRetrievalDriver_1.hxx>
 
 // enums
 #include <TDataStd_RealEnum.hxx>
@@ -83,6 +88,8 @@ void MDataXtd::AddStorageDrivers
   aDriverSeq->Append(new MDataXtd_ConstraintStorageDriver(theMsgDriver));
   aDriverSeq->Append(new MDataXtd_PlacementStorageDriver(theMsgDriver));
   aDriverSeq->Append(new MDataXtd_PatternStdStorageDriver(theMsgDriver));
+  aDriverSeq->Append(new MDataXtd_PresentationStorageDriver(theMsgDriver));
+  aDriverSeq->Append(new MDataXtd_PositionStorageDriver(theMsgDriver));
 }
 
 
@@ -102,6 +109,9 @@ void MDataXtd::AddRetrievalDrivers
   aDriverSeq->Append(new MDataXtd_ConstraintRetrievalDriver(theMsgDriver));
   aDriverSeq->Append(new MDataXtd_PlacementRetrievalDriver(theMsgDriver));
   aDriverSeq->Append(new MDataXtd_PatternStdRetrievalDriver(theMsgDriver));
+  aDriverSeq->Append(new MDataXtd_PresentationRetrievalDriver(theMsgDriver));
+  aDriverSeq->Append(new MDataXtd_PresentationRetrievalDriver_1(theMsgDriver));
+  aDriverSeq->Append(new MDataXtd_PositionRetrievalDriver(theMsgDriver));
 }
 
 //=======================================================================
diff --git a/src/MDataXtd/MDataXtd_PositionRetrievalDriver.cdl b/src/MDataXtd/MDataXtd_PositionRetrievalDriver.cdl
new file mode 100644 (file)
index 0000000..6ab2eab
--- /dev/null
@@ -0,0 +1,49 @@
+-- Created on: 1998-04-07
+-- Created by: Jean-Pierre COMBE
+-- Copyright (c) 1998-1999 Matra Datavision
+-- Copyright (c) 1999-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class PositionRetrievalDriver from MDataXtd inherits ARDriver from MDF
+           ---Purpose: Retrieval drivers for graphic attributes from
+           --          PDataXtd
+
+
+uses RRelocationTable from MDF,
+     Attribute        from PDF,
+     Attribute        from TDF, 
+     MessageDriver    from CDM
+
+is
+
+
+    Create(theMessageDriver : MessageDriver from CDM)  -- Version 0
+    returns PositionRetrievalDriver from MDataXtd;
+    
+
+    VersionNumber(me) returns Integer from Standard;
+       ---Purpose: Returns the version number from which the driver
+       --          is available: 0.
+
+    SourceType(me) returns Type from Standard;
+       ---Purpose: Returns the type: ColorAttribute from PGraphicAttribute.
+
+    NewEmpty (me)  returns Attribute from TDF;
+
+
+    Paste(me;
+         Source     :         Attribute from PDF;
+         Target     : Attribute from TDF;
+         RelocTable : RRelocationTable  from MDF);
+
+end PositionRetrievalDriver;
diff --git a/src/MDataXtd/MDataXtd_PositionRetrievalDriver.cxx b/src/MDataXtd/MDataXtd_PositionRetrievalDriver.cxx
new file mode 100644 (file)
index 0000000..339ad4a
--- /dev/null
@@ -0,0 +1,70 @@
+// Created on: 1998-04-07
+// Created by: Jean-Pierre COMBE
+// Copyright (c) 1998-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <MDataXtd_PositionRetrievalDriver.ixx>
+
+#include <PDataXtd_Position.hxx>
+#include <TDataXtd_Position.hxx>
+#include <CDM_MessageDriver.hxx>
+
+//=======================================================================
+//function : MDataXtd_PositionRetrievalDriver
+//purpose  : 
+//=======================================================================
+MDataXtd_PositionRetrievalDriver::MDataXtd_PositionRetrievalDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
+: MDF_ARDriver(theMsgDriver)
+{}
+
+//=======================================================================
+//function : VersionNumber
+//purpose  : 
+//=======================================================================
+Standard_Integer MDataXtd_PositionRetrievalDriver::VersionNumber() const
+{
+  return 0;
+}
+
+//=======================================================================
+//function : SourceType
+//purpose  : 
+//=======================================================================
+Handle(Standard_Type) MDataXtd_PositionRetrievalDriver::SourceType() const
+{
+  return STANDARD_TYPE(PDataXtd_Position);
+}
+
+//=======================================================================
+//function : NewEmpty
+//purpose  : 
+//=======================================================================
+Handle(TDF_Attribute) MDataXtd_PositionRetrievalDriver::NewEmpty() const
+{
+  return new TDataXtd_Position;
+}
+
+//=======================================================================
+//function : Paste
+//purpose  : 
+//=======================================================================
+void MDataXtd_PositionRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source,
+                                            const Handle(TDF_Attribute)& Target,
+                                            const Handle(MDF_RRelocationTable)& /*RelocTable*/) const
+{
+  Handle(PDataXtd_Position) S = Handle(PDataXtd_Position)::DownCast(Source);
+  Handle(TDataXtd_Position) T = Handle(TDataXtd_Position)::DownCast(Target);
+  T->SetPosition(S->GetPosition());
+}
+
diff --git a/src/MDataXtd/MDataXtd_PositionStorageDriver.cdl b/src/MDataXtd/MDataXtd_PositionStorageDriver.cdl
new file mode 100644 (file)
index 0000000..c9a5a02
--- /dev/null
@@ -0,0 +1,51 @@
+-- Created on: 1998-04-07
+-- Created by: Jean-Pierre COMBE
+-- Copyright (c) 1998-1999 Matra Datavision
+-- Copyright (c) 1999-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class PositionStorageDriver from MDataXtd inherits ASDriver from MDF
+
+       ---Purpose: Storage driver for graphic attributes from
+       --          TPrsStd
+
+uses SRelocationTable from MDF,
+     Attribute        from TDF,
+     Attribute        from PDF, 
+     MessageDriver    from CDM
+
+
+is
+
+    Create(theMessageDriver : MessageDriver from CDM)  
+    returns PositionStorageDriver from MDataXtd;
+
+
+    VersionNumber(me) returns Integer from Standard;
+       ---Purpose: Returns the version number from which the driver
+       --          is available: 0.
+
+    SourceType(me) returns Type from Standard;
+       ---Purpose: Returns the type: ColorAttribute from TGraphicAttribute.
+
+    NewEmpty (me) returns Attribute from PDF;
+
+
+    Paste(me;
+         Source     :         Attribute from TDF;
+         Target     : Attribute from PDF;
+         RelocTable : SRelocationTable from MDF);
+
+
+end PositionStorageDriver;
+
diff --git a/src/MDataXtd/MDataXtd_PositionStorageDriver.cxx b/src/MDataXtd/MDataXtd_PositionStorageDriver.cxx
new file mode 100644 (file)
index 0000000..ea6d7a7
--- /dev/null
@@ -0,0 +1,65 @@
+// Created on: 1998-04-07
+// Created by: Jean-Pierre COMBE
+// Copyright (c) 1998-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <MDataXtd_PositionStorageDriver.ixx>
+
+#include <PDataXtd_Position.hxx>
+#include <TDataXtd_Position.hxx>
+#include <CDM_MessageDriver.hxx>
+
+//=======================================================================
+//function : MDataXtd_PositionStorageDriver
+//purpose  : 
+//=======================================================================
+MDataXtd_PositionStorageDriver::MDataXtd_PositionStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver)
+{
+}
+
+//=======================================================================
+//function : VersionNumber
+//purpose  : 
+//=======================================================================
+Standard_Integer MDataXtd_PositionStorageDriver::VersionNumber() const
+{ return 0; }
+
+//=======================================================================
+//function : SourceType
+//purpose  : 
+//=======================================================================
+Handle(Standard_Type) MDataXtd_PositionStorageDriver::SourceType() const
+{ return STANDARD_TYPE(TDataXtd_Position); }
+
+//=======================================================================
+//function : NewEmpty
+//purpose  : 
+//=======================================================================
+Handle(PDF_Attribute) MDataXtd_PositionStorageDriver::NewEmpty() const
+{ return new PDataXtd_Position; }
+
+//=======================================================================
+//function : Paste
+//purpose  : 
+//=======================================================================
+void MDataXtd_PositionStorageDriver::Paste(const Handle(TDF_Attribute)& Source,
+                                          const Handle(PDF_Attribute)& Target,
+                                          const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
+{
+  Handle(TDataXtd_Position) S = Handle(TDataXtd_Position)::DownCast (Source);
+  Handle(PDataXtd_Position) T = Handle(PDataXtd_Position)::DownCast (Target);  
+  T->SetPosition(S->GetPosition());
+}
+
+
diff --git a/src/MDataXtd/MDataXtd_PresentationRetrievalDriver.cdl b/src/MDataXtd/MDataXtd_PresentationRetrievalDriver.cdl
new file mode 100644 (file)
index 0000000..de68ddb
--- /dev/null
@@ -0,0 +1,48 @@
+-- Created on: 1999-07-08
+-- Created by: Sergey RUIN
+-- Copyright (c) 1999 Matra Datavision
+-- Copyright (c) 1999-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class PresentationRetrievalDriver from MDataXtd  inherits ARDriver from MDF
+
+           ---Purpose: Retrieval drivers for graphic attributes from
+           --          MDataXtd
+
+uses RRelocationTable from MDF,
+     Attribute        from PDF,
+     Attribute        from TDF, 
+     MessageDriver from CDM
+
+is
+
+    Create(theMessageDriver : MessageDriver from CDM)  -- Version 0
+    returns PresentationRetrievalDriver from MDataXtd;
+    
+
+    VersionNumber(me) returns Integer from Standard;
+       ---Purpose: Returns the version number from which the driver
+       --          is available: 0.
+
+    SourceType(me) returns Type from Standard;
+       ---Purpose: Returns the type: Presentation from PDataXtd.
+
+    NewEmpty (me)  returns Attribute from TDF;
+
+
+    Paste(me;
+         Source     : Attribute from PDF;
+         Target     : Attribute from TDF;
+         RelocTable : RRelocationTable  from MDF);
+
+end PresentationRetrievalDriver;
diff --git a/src/MDataXtd/MDataXtd_PresentationRetrievalDriver.cxx b/src/MDataXtd/MDataXtd_PresentationRetrievalDriver.cxx
new file mode 100644 (file)
index 0000000..d6a795b
--- /dev/null
@@ -0,0 +1,82 @@
+// Created on: 1999-07-08
+// Created by: Sergey RUIN
+// Copyright (c) 1999-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <MDataXtd_PresentationRetrievalDriver.ixx>
+
+#include <PDataXtd_Presentation.hxx>
+#include <TDataXtd_Presentation.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <PCollection_HExtendedString.hxx>
+#include <CDM_MessageDriver.hxx>
+
+//=======================================================================
+//function : MDataXtd_PresentationRetrievalDriver
+//purpose  : 
+//=======================================================================
+
+MDataXtd_PresentationRetrievalDriver::MDataXtd_PresentationRetrievalDriver
+                                (const Handle(CDM_MessageDriver)& theMsgDriver)
+: MDF_ARDriver(theMsgDriver)
+{
+}
+
+Standard_Integer MDataXtd_PresentationRetrievalDriver::VersionNumber() const
+{
+  return 0;
+}
+
+Handle(Standard_Type) MDataXtd_PresentationRetrievalDriver::SourceType() const
+{
+  return STANDARD_TYPE(PDataXtd_Presentation);
+}
+
+Handle(TDF_Attribute) MDataXtd_PresentationRetrievalDriver::NewEmpty() const
+{
+  return new TDataXtd_Presentation;
+}
+
+void MDataXtd_PresentationRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source,
+                                                   const Handle(TDF_Attribute)& Target,
+                                                   const Handle(MDF_RRelocationTable)& /*RelocTable*/) const
+{
+  Handle(PDataXtd_Presentation) S = Handle(PDataXtd_Presentation)::DownCast (Source);
+  Handle(TDataXtd_Presentation) T = Handle(TDataXtd_Presentation)::DownCast (Target);
+
+  T->SetDisplayed( S->IsDisplayed() );
+
+  TCollection_ExtendedString extstr = (S->GetDriverGUID())->Convert();
+  Standard_GUID guid( extstr.ToExtString() );
+  T->SetDriverGUID( guid ); 
+
+  if( S->Color() != -1 ) T->SetColor( S->Color() );
+  else T->UnsetColor();
+
+  if( S->Material() != -1 ) T->SetMaterial( S->Material() );
+  else T->UnsetMaterial(); 
+
+  if( S->Transparency() != -1. ) T->SetTransparency( S->Transparency() );
+  else T->UnsetTransparency(); 
+
+  if( S->Width() != -1. ) T->SetWidth( S->Width() );
+  else T->UnsetWidth(); 
+
+#ifdef OCCT_DEBUG
+  cout << "AISPresentationRetrievalDriver "  << "retrieved DriverGUID ==> ";
+  guid.ShallowDump(cout);
+  cout << endl;
+#endif
+}
diff --git a/src/MDataXtd/MDataXtd_PresentationRetrievalDriver_1.cdl b/src/MDataXtd/MDataXtd_PresentationRetrievalDriver_1.cdl
new file mode 100644 (file)
index 0000000..a26c8b7
--- /dev/null
@@ -0,0 +1,50 @@
+-- Created on: 1999-07-08
+-- Created by: Sergey RUIN
+-- Copyright (c) 1999 Matra Datavision
+-- Copyright (c) 1999-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class PresentationRetrievalDriver_1 from MDataXtd  inherits ARDriver from MDF
+
+           ---Purpose: Retrieval drivers for graphic attributes from
+           --          PDataXtd
+
+uses RRelocationTable from MDF,
+     Attribute        from PDF,
+     Attribute        from TDF, 
+     MessageDriver    from CDM
+
+is
+
+
+    Create (theMessageDriver : MessageDriver from CDM) -- Version 1
+    returns PresentationRetrievalDriver_1 from MDataXtd;
+    
+
+    VersionNumber(me) returns Integer from Standard;
+       ---Purpose: Returns the version number from which the driver
+       --          is available: 1.
+
+    SourceType(me) returns Type from Standard;
+       ---Purpose: Returns the type: Presentation from PDataXtd.
+
+    NewEmpty (me)  returns Attribute from TDF;
+
+
+    Paste(me;
+         Source     :         Attribute from PDF;
+         Target     : Attribute from TDF;
+         RelocTable : RRelocationTable  from MDF);
+
+end PresentationRetrievalDriver_1;
diff --git a/src/MDataXtd/MDataXtd_PresentationRetrievalDriver_1.cxx b/src/MDataXtd/MDataXtd_PresentationRetrievalDriver_1.cxx
new file mode 100644 (file)
index 0000000..51588b3
--- /dev/null
@@ -0,0 +1,81 @@
+// Created on: 1999-07-08
+// Created by: Sergey RUIN
+// Copyright (c) 1999-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <MDataXtd_PresentationRetrievalDriver_1.ixx>
+
+#include <PDataXtd_Presentation_1.hxx>
+#include <TDataXtd_Presentation.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <PCollection_HExtendedString.hxx>
+#include <CDM_MessageDriver.hxx>
+
+//=======================================================================
+//function : MDataXtd_PresentationRetrievalDriver_1
+//purpose  : 
+//=======================================================================
+MDataXtd_PresentationRetrievalDriver_1::MDataXtd_PresentationRetrievalDriver_1(const Handle(CDM_MessageDriver)& theMsgDriver)
+:MDF_ARDriver(theMsgDriver)
+{}
+
+Standard_Integer MDataXtd_PresentationRetrievalDriver_1::VersionNumber() const
+{
+  return 1;
+}
+
+Handle(Standard_Type) MDataXtd_PresentationRetrievalDriver_1::SourceType() const
+{
+  return STANDARD_TYPE(PDataXtd_Presentation_1);
+}
+
+Handle(TDF_Attribute) MDataXtd_PresentationRetrievalDriver_1::NewEmpty() const
+{
+  return new TDataXtd_Presentation;
+}
+
+void MDataXtd_PresentationRetrievalDriver_1::Paste(const Handle(PDF_Attribute)& Source,
+                                                     const Handle(TDF_Attribute)& Target,
+                                                     const Handle(MDF_RRelocationTable)& /*RelocTable*/) const
+{
+  Handle(PDataXtd_Presentation_1) S = Handle(PDataXtd_Presentation_1)::DownCast (Source);
+  Handle(TDataXtd_Presentation)   T = Handle(TDataXtd_Presentation)::DownCast (Target);
+
+  T->SetDisplayed( S->IsDisplayed() );
+
+  TCollection_ExtendedString extstr = (S->GetDriverGUID())->Convert();
+  Standard_GUID guid( extstr.ToExtString() );
+
+  T->SetDriverGUID( guid );
+
+  if( S->Color() != -1 ) T->SetColor( S->Color() );
+  else T->UnsetColor();
+
+  if( S->Material() != -1 ) T->SetMaterial( S->Material() );
+  else T->UnsetMaterial();
+
+  if( S->Transparency() != -1. ) T->SetTransparency( S->Transparency() );
+  else T->UnsetTransparency(); 
+
+  if( S->Width() != -1. ) T->SetWidth( S->Width() );
+  else T->UnsetWidth();
+
+  T->SetMode(S->Mode());
+
+#ifdef OCCT_DEBUG
+  cout << "AISPresentationRetrievalDriver "  << "retrieved DriverGUID ==> ";
+  guid.ShallowDump(cout);
+  cout << endl;
+#endif
+}
diff --git a/src/MDataXtd/MDataXtd_PresentationStorageDriver.cdl b/src/MDataXtd/MDataXtd_PresentationStorageDriver.cdl
new file mode 100644 (file)
index 0000000..e67abd0
--- /dev/null
@@ -0,0 +1,51 @@
+-- Created on: 1999-07-08
+-- Created by: Sergey RUIN
+-- Copyright (c) 1999 Matra Datavision
+-- Copyright (c) 1999-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class PresentationStorageDriver from MDataXtd inherits ASDriver from MDF
+
+       ---Purpose: Storage driver for graphic attributes from
+       --          TDataXtd
+
+uses SRelocationTable from MDF,
+     Attribute        from TDF,
+     Attribute        from PDF, 
+     MessageDriver    from CDM
+
+
+is
+
+    Create (theMessageDriver : MessageDriver from CDM)
+    returns PresentationStorageDriver from MDataXtd;
+
+
+    VersionNumber(me) returns Integer from Standard;
+       ---Purpose: Returns the version number from which the driver
+       --          is available: 0.
+
+    SourceType(me) returns Type from Standard;
+       ---Purpose: Returns the type: Presentation from TDataXtd.
+
+    NewEmpty (me) returns Attribute from PDF;
+
+
+    Paste(me;
+         Source     :         Attribute from TDF;
+         Target     : Attribute from PDF;
+         RelocTable : SRelocationTable from MDF);
+
+
+end PresentationStorageDriver;
+
diff --git a/src/MDataXtd/MDataXtd_PresentationStorageDriver.cxx b/src/MDataXtd/MDataXtd_PresentationStorageDriver.cxx
new file mode 100644 (file)
index 0000000..34cf3c9
--- /dev/null
@@ -0,0 +1,85 @@
+// Created on: 1997-07-08
+// Created by: Sergey RUIN
+// Copyright (c) 1997-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <MDataXtd_PresentationStorageDriver.ixx>
+
+#include <PDataXtd_Presentation.hxx>
+#include <PDataXtd_Presentation_1.hxx>
+#include <TDataXtd_Presentation.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <PCollection_HExtendedString.hxx>
+#include <CDM_MessageDriver.hxx>
+
+//=======================================================================
+//function : MDataXtd_PresentationStorageDriver
+//purpose  : 
+//=======================================================================
+
+MDataXtd_PresentationStorageDriver::MDataXtd_PresentationStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
+: MDF_ASDriver(theMsgDriver)
+{
+}
+
+Standard_Integer MDataXtd_PresentationStorageDriver::VersionNumber() const
+{
+  return 0;
+}
+
+Handle(Standard_Type) MDataXtd_PresentationStorageDriver::SourceType() const
+{
+  return STANDARD_TYPE(TDataXtd_Presentation);
+}
+
+Handle(PDF_Attribute) MDataXtd_PresentationStorageDriver::NewEmpty() const
+{
+  return new PDataXtd_Presentation_1;
+}
+
+void MDataXtd_PresentationStorageDriver::Paste(const Handle(TDF_Attribute)& Source,
+                                               const Handle(PDF_Attribute)& Target,
+                                               const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
+{
+  Handle(TDataXtd_Presentation) S = Handle(TDataXtd_Presentation)::DownCast(Source);
+
+  Handle(PDataXtd_Presentation_1) T = Handle(PDataXtd_Presentation_1)::DownCast(Target);
+
+  T->SetDisplayed( S->IsDisplayed() );
+
+  TCollection_ExtendedString  extstr("00000000-0000-0000-0000-000000000000");  //covert GUID into ExtendedString
+  Standard_PExtCharacter pStr = const_cast<Standard_PExtCharacter>(extstr.ToExtString());
+  S->GetDriverGUID().ToExtString(pStr);
+
+  Handle(PCollection_HExtendedString) guid = new PCollection_HExtendedString ( extstr );
+  T->SetDriverGUID ( guid );
+
+  if( S->IsHasOwnColor() ) T->SetColor( S->Color() );
+  else T->SetColor(-1);
+
+  if( S->IsHasOwnMaterial() ) T->SetMaterial( S->Material() );
+  else T->SetMaterial(-1);
+
+  if( S->IsHasOwnTransparency() ) T->SetTransparency( S->Transparency() );
+  else T->SetTransparency(-1.);
+
+  if( S->IsHasOwnWidth() ) T->SetWidth( S->Width() );
+  else T->SetWidth(-1.);
+
+  T->SetMode(S->Mode());
+
+#ifdef OCCT_DEBUG
+  cout << "AISPresentationStorageDriver "  << "storaged DriverGUID ==> "   << guid->Convert() << endl;
+#endif
+}
diff --git a/src/MPrsStd/MPrsStd.cdl b/src/MPrsStd/MPrsStd.cdl
deleted file mode 100644 (file)
index 0f7b8d0..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
--- Created on: 1997-08-26
--- Created by: SMO
--- Copyright (c) 1997-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-package MPrsStd 
-
-       ---Purpose: Storage    and  Retrieval  drivers   for graphic
-       --          attributes.   Transient  attributes are defined in
-       --          package TPrsStd and persistent one are defined in
-       --          package PPrsStd
-
-uses TDF,
-     PDF,
-     MDF, 
-     CDM
-
-is
-
-           ---Category: StorageDriver
-
-       class AISPresentationStorageDriver;
-       class PositionStorageDriver;
-
-
-        ---Category: RetrievalDriver
-
-        class AISPresentationRetrievalDriver;
-        class AISPresentationRetrievalDriver_1;        
-       class PositionRetrievalDriver;
-       
-    AddStorageDrivers(aDriverTable : ASDriverHSequence from MDF;theMessageDriver : MessageDriver from CDM);
-       ---Purpose: Adds the attribute storage drivers to <aDriverTable>.
-       ---Category: StorageDriversTable
-
-
-    AddRetrievalDrivers(aDriverTable : ARDriverHSequence from MDF;theMessageDriver : MessageDriver from CDM);
-       ---Purpose: Adds the attribute retrieval drivers to <aDriverTable>.
-       ---Category: RetrievalDriversTable
-
-
-end MPrsStd;
-
-
-
diff --git a/src/MPrsStd/MPrsStd.cxx b/src/MPrsStd/MPrsStd.cxx
deleted file mode 100644 (file)
index 4fe10b5..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-// Created on: 1997-08-26
-// Created by: Guest Design
-// Copyright (c) 1997-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <MPrsStd.ixx>
-#include <MDF_ASDriverHSequence.hxx>
-#include <MDF_ARDriverHSequence.hxx>
-#include <MPrsStd_AISPresentationStorageDriver.hxx>
-#include <MPrsStd_AISPresentationRetrievalDriver.hxx>
-#include <MPrsStd_AISPresentationRetrievalDriver_1.hxx>
-//#include <MPrsStd_AISViewerStorageDriver.hxx>
-//#include <MPrsStd_AISViewerRetrievalDriver.hxx> 
-#include <MPrsStd_PositionStorageDriver.hxx>
-#include <MPrsStd_PositionRetrievalDriver.hxx>
-
-//=======================================================================
-//function : AddStorageDriver
-//purpose  : 
-//=======================================================================
-
-void MPrsStd::AddStorageDrivers
-(const Handle(MDF_ASDriverHSequence)& aDriverSeq, const Handle(CDM_MessageDriver)& theMsgDriver)
-{
-  aDriverSeq->Append(new MPrsStd_AISPresentationStorageDriver(theMsgDriver));
-//  aDriverSeq->Append(new MPrsStd_AISViewerStorageDriver());
-  aDriverSeq->Append(new MPrsStd_PositionStorageDriver(theMsgDriver));
-}
-
-
-//=======================================================================
-//function : AddRetrievalDriver
-//purpose  : 
-//=======================================================================
-
-void MPrsStd::AddRetrievalDrivers
-(const Handle(MDF_ARDriverHSequence)& aDriverSeq, const Handle(CDM_MessageDriver)& theMsgDriver)
-{
-  aDriverSeq->Append(new MPrsStd_AISPresentationRetrievalDriver(theMsgDriver));
-  aDriverSeq->Append(new MPrsStd_AISPresentationRetrievalDriver_1(theMsgDriver));
-//  aDriverSeq->Append(new MPrsStd_AISViewerRetrievalDriver());
-  aDriverSeq->Append(new MPrsStd_PositionRetrievalDriver(theMsgDriver));
-}
-
-
diff --git a/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cdl b/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cdl
deleted file mode 100644 (file)
index 77886fb..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
--- Created on: 1999-07-08
--- Created by: Sergey RUIN
--- Copyright (c) 1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class AISPresentationRetrievalDriver from MPrsStd  inherits ARDriver from MDF
-
-           ---Purpose: Retrieval drivers for graphic attributes from
-           --          PPrsStd
-
-uses RRelocationTable from MDF,
-     Attribute        from PDF,
-     Attribute        from TDF, 
-     MessageDriver from CDM
-
-is
-
-
-    Create(theMessageDriver : MessageDriver from CDM)  -- Version 0
-    returns AISPresentationRetrievalDriver from MPrsStd;
-    
-
-    VersionNumber(me) returns Integer from Standard;
-       ---Purpose: Returns the version number from which the driver
-       --          is available: 0.
-
-    SourceType(me) returns Type from Standard;
-       ---Purpose: Returns the type: AISPresentation from PPrsStd.
-
-    NewEmpty (me)  returns Attribute from TDF;
-
-
-    Paste(me;
-         Source     :         Attribute from PDF;
-         Target     : Attribute from TDF;
-         RelocTable : RRelocationTable  from MDF);
-
-end AISPresentationRetrievalDriver;
diff --git a/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cxx b/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cxx
deleted file mode 100644 (file)
index 00312ad..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-// Created on: 1999-07-08
-// Created by: Sergey RUIN
-// Copyright (c) 1999-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <MPrsStd_AISPresentationRetrievalDriver.ixx>
-
-#include <PPrsStd_AISPresentation.hxx>
-#include <TPrsStd_AISPresentation.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <PCollection_HExtendedString.hxx>
-#include <Quantity_NameOfColor.hxx>
-#include <Graphic3d_NameOfMaterial.hxx>
-#include <CDM_MessageDriver.hxx>
-
-//=======================================================================
-//function : MPrsStd_AISPresentationRetrievalDriver
-//purpose  : 
-//=======================================================================
-
-MPrsStd_AISPresentationRetrievalDriver::MPrsStd_AISPresentationRetrievalDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver)
-{}
-
-Standard_Integer MPrsStd_AISPresentationRetrievalDriver::VersionNumber() const
-{ return 0; }
-
-Handle(Standard_Type) MPrsStd_AISPresentationRetrievalDriver::SourceType() const
-{ return STANDARD_TYPE(PPrsStd_AISPresentation); }
-
-Handle(TDF_Attribute) MPrsStd_AISPresentationRetrievalDriver::NewEmpty() const
-{ return new TPrsStd_AISPresentation; }
-
-void MPrsStd_AISPresentationRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source,
-                                                   const Handle(TDF_Attribute)& Target,
-                                                   const Handle(MDF_RRelocationTable)& /*RelocTable*/) const
-{
-  Handle(PPrsStd_AISPresentation) S = Handle(PPrsStd_AISPresentation)::DownCast (Source);
-  Handle(TPrsStd_AISPresentation) T = Handle(TPrsStd_AISPresentation)::DownCast (Target);
-
-  T->SetDisplayed( S->IsDisplayed() );  
-
-  TCollection_ExtendedString extstr = (S->GetDriverGUID())->Convert();   
-  Standard_GUID guid( extstr.ToExtString() );  
-  T->SetDriverGUID( guid ); 
-
-  if( S->Color() != -1 ) T->SetColor( (Quantity_NameOfColor)(S->Color()) );
-  else T->UnsetColor();
-
-  if( S->Material() != -1 ) T->SetMaterial( (Graphic3d_NameOfMaterial)(S->Material()) );
-  else T->UnsetMaterial(); 
-
-  if( S->Transparency() != -1. ) T->SetTransparency( S->Transparency() );
-  else T->UnsetTransparency(); 
-
-  if( S->Width() != -1. ) T->SetWidth( S->Width() );
-  else T->UnsetWidth(); 
-
-#ifdef OCCT_DEBUG
-  cout << "AISPresentationRetrievalDriver "  << "retrieved DriverGUID ==> ";
-  guid.ShallowDump(cout);
-  cout << endl;
-#endif
-}
-
diff --git a/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cdl b/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cdl
deleted file mode 100644 (file)
index b54560e..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
--- Created on: 1999-07-08
--- Created by: Sergey RUIN
--- Copyright (c) 1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class AISPresentationRetrievalDriver_1 from MPrsStd  inherits ARDriver from MDF
-
-           ---Purpose: Retrieval drivers for graphic attributes from
-           --          PPrsStd
-
-uses RRelocationTable from MDF,
-     Attribute        from PDF,
-     Attribute        from TDF, 
-     MessageDriver    from CDM
-
-is
-
-
-    Create (theMessageDriver : MessageDriver from CDM) -- Version 1
-    returns AISPresentationRetrievalDriver_1 from MPrsStd;
-    
-
-    VersionNumber(me) returns Integer from Standard;
-       ---Purpose: Returns the version number from which the driver
-       --          is available: 1.
-
-    SourceType(me) returns Type from Standard;
-       ---Purpose: Returns the type: AISPresentation from PPrsStd.
-
-    NewEmpty (me)  returns Attribute from TDF;
-
-
-    Paste(me;
-         Source     :         Attribute from PDF;
-         Target     : Attribute from TDF;
-         RelocTable : RRelocationTable  from MDF);
-
-end AISPresentationRetrievalDriver_1;
diff --git a/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cxx b/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cxx
deleted file mode 100644 (file)
index 606792f..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-// Created on: 1999-07-08
-// Created by: Sergey RUIN
-// Copyright (c) 1999-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <MPrsStd_AISPresentationRetrievalDriver_1.ixx>
-
-#include <PPrsStd_AISPresentation_1.hxx>
-#include <TPrsStd_AISPresentation.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <PCollection_HExtendedString.hxx>
-#include <Quantity_NameOfColor.hxx>
-#include <Graphic3d_NameOfMaterial.hxx>
-#include <CDM_MessageDriver.hxx>
-
-//=======================================================================
-//function : MPrsStd_AISPresentationRetrievalDriver_1
-//purpose  : 
-//=======================================================================
-
-MPrsStd_AISPresentationRetrievalDriver_1::MPrsStd_AISPresentationRetrievalDriver_1(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver)
-{}
-
-Standard_Integer MPrsStd_AISPresentationRetrievalDriver_1::VersionNumber() const
-{ return 1; }
-
-Handle(Standard_Type) MPrsStd_AISPresentationRetrievalDriver_1::SourceType() const
-{ return STANDARD_TYPE(PPrsStd_AISPresentation_1); }
-
-Handle(TDF_Attribute) MPrsStd_AISPresentationRetrievalDriver_1::NewEmpty() const
-{ return new TPrsStd_AISPresentation; }
-
-void MPrsStd_AISPresentationRetrievalDriver_1::Paste(const Handle(PDF_Attribute)& Source,
-                                                     const Handle(TDF_Attribute)& Target,
-                                                     const Handle(MDF_RRelocationTable)& /*RelocTable*/) const
-{
-  Handle(PPrsStd_AISPresentation_1) S = Handle(PPrsStd_AISPresentation_1)::DownCast (Source);
-  Handle(TPrsStd_AISPresentation) T = Handle(TPrsStd_AISPresentation)::DownCast (Target);
-
-  T->SetDisplayed( S->IsDisplayed() );  
-
-  TCollection_ExtendedString extstr = (S->GetDriverGUID())->Convert();   
-  Standard_GUID guid( extstr.ToExtString() );  
-  T->SetDriverGUID( guid ); 
-
-  if( S->Color() != -1 ) T->SetColor( (Quantity_NameOfColor)(S->Color()) );
-  else T->UnsetColor();
-
-  if( S->Material() != -1 ) T->SetMaterial( (Graphic3d_NameOfMaterial)(S->Material()) );
-  else T->UnsetMaterial(); 
-
-  if( S->Transparency() != -1. ) T->SetTransparency( S->Transparency() );
-  else T->UnsetTransparency(); 
-
-  if( S->Width() != -1. ) T->SetWidth( S->Width() );
-  else T->UnsetWidth(); 
-
-  T->SetMode(S->Mode());
-  
-#ifdef OCCT_DEBUG
-  cout << "AISPresentationRetrievalDriver "  << "retrieved DriverGUID ==> ";
-  guid.ShallowDump(cout);
-  cout << endl;
-#endif
-}
-
-
diff --git a/src/MPrsStd/MPrsStd_AISPresentationStorageDriver.cdl b/src/MPrsStd/MPrsStd_AISPresentationStorageDriver.cdl
deleted file mode 100644 (file)
index 774b71b..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
--- Created on: 1999-07-08
--- Created by: Sergey RUIN
--- Copyright (c) 1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class AISPresentationStorageDriver from MPrsStd inherits ASDriver from MDF
-
-       ---Purpose: Storage driver for graphic attributes from
-       --          TPrsStd
-
-uses SRelocationTable from MDF,
-     Attribute        from TDF,
-     Attribute        from PDF, 
-     MessageDriver    from CDM
-
-
-is
-
-    Create (theMessageDriver : MessageDriver from CDM)
-    returns AISPresentationStorageDriver from MPrsStd;
-
-
-    VersionNumber(me) returns Integer from Standard;
-       ---Purpose: Returns the version number from which the driver
-       --          is available: 0.
-
-    SourceType(me) returns Type from Standard;
-       ---Purpose: Returns the type: AISPresentation from TPrsStd.
-
-    NewEmpty (me) returns Attribute from PDF;
-
-
-    Paste(me;
-         Source     :         Attribute from TDF;
-         Target     : Attribute from PDF;
-         RelocTable : SRelocationTable from MDF);
-
-
-end AISPresentationStorageDriver;
-
diff --git a/src/MPrsStd/MPrsStd_AISPresentationStorageDriver.cxx b/src/MPrsStd/MPrsStd_AISPresentationStorageDriver.cxx
deleted file mode 100644 (file)
index 9c04c74..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-// Created on: 1997-07-08
-// Created by: Sergey RUIN
-// Copyright (c) 1997-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <MPrsStd_AISPresentationStorageDriver.ixx>
-
-#include <PPrsStd_AISPresentation.hxx>
-#include <PPrsStd_AISPresentation_1.hxx>
-#include <TPrsStd_AISPresentation.hxx>
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <V3d_Viewer.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <PCollection_HExtendedString.hxx>
-#include <CDM_MessageDriver.hxx>
-
-//=======================================================================
-//function : MPrsStd_AISPresentationStorageDriver
-//purpose  : 
-//=======================================================================
-
-MPrsStd_AISPresentationStorageDriver::MPrsStd_AISPresentationStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver)
-{
-}
-
-Standard_Integer MPrsStd_AISPresentationStorageDriver::VersionNumber() const
-{ return 0; }
-
-Handle(Standard_Type) MPrsStd_AISPresentationStorageDriver::SourceType() const
-{ return STANDARD_TYPE(TPrsStd_AISPresentation); }
-
-Handle(PDF_Attribute) MPrsStd_AISPresentationStorageDriver::NewEmpty() const
-{
-// return new PPrsStd_AISPresentation; 
-  return new PPrsStd_AISPresentation_1;
-}
-
-void MPrsStd_AISPresentationStorageDriver::Paste(const Handle(TDF_Attribute)& Source,
-                                                const Handle(PDF_Attribute)& Target,
-                                                const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
-{
-  Handle(TPrsStd_AISPresentation) S = Handle(TPrsStd_AISPresentation)::DownCast (Source);
-
-  // Handle(PPrsStd_AISPresentation) T = Handle(PPrsStd_AISPresentation)::DownCast (Target);
-  Handle(PPrsStd_AISPresentation_1) T = Handle(PPrsStd_AISPresentation_1)::DownCast (Target);
-
-  T->SetDisplayed( S->IsDisplayed() );  
-
-  TCollection_ExtendedString  extstr("00000000-0000-0000-0000-000000000000");  //covert GUID into ExtendedString
-  Standard_PExtCharacter pStr;
-  //
-  pStr=(Standard_PExtCharacter)extstr.ToExtString();
-  S->GetDriverGUID().ToExtString(pStr); 
-
-  Handle(PCollection_HExtendedString) guid = new PCollection_HExtendedString ( extstr ); 
-  T->SetDriverGUID ( guid );    
-
-  if( S->HasOwnColor() ) T->SetColor( (Standard_Integer)(S->Color())  );
-  else T->SetColor(-1);
-
-  if( S->HasOwnMaterial() ) T->SetMaterial( (Standard_Integer)(S->Material())  );
-  else T->SetMaterial(-1);
-
-  if( S->HasOwnTransparency() ) T->SetTransparency( S->Transparency() );
-  else T->SetTransparency(-1.);
-
-  if( S->HasOwnWidth() ) T->SetWidth( S->Width() );
-  else T->SetWidth(-1.);  
-
-   T->SetMode(S->Mode());
-
-#ifdef OCCT_DEBUG
-  cout << "AISPresentationStorageDriver "  << "storaged DriverGUID ==> "   << guid->Convert() << endl;
-#endif
-}
-
-
-
diff --git a/src/MPrsStd/MPrsStd_PositionRetrievalDriver.cdl b/src/MPrsStd/MPrsStd_PositionRetrievalDriver.cdl
deleted file mode 100644 (file)
index d0c078d..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
--- Created on: 1998-04-07
--- Created by: Jean-Pierre COMBE
--- Copyright (c) 1998-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class PositionRetrievalDriver from MPrsStd inherits ARDriver from MDF
-           ---Purpose: Retrieval drivers for graphic attributes from
-           --          PPrsStd
-
-
-uses RRelocationTable from MDF,
-     Attribute        from PDF,
-     Attribute        from TDF, 
-     MessageDriver    from CDM
-
-is
-
-
-    Create(theMessageDriver : MessageDriver from CDM)  -- Version 0
-    returns PositionRetrievalDriver from MPrsStd;
-    
-
-    VersionNumber(me) returns Integer from Standard;
-       ---Purpose: Returns the version number from which the driver
-       --          is available: 0.
-
-    SourceType(me) returns Type from Standard;
-       ---Purpose: Returns the type: ColorAttribute from PGraphicAttribute.
-
-    NewEmpty (me)  returns Attribute from TDF;
-
-
-    Paste(me;
-         Source     :         Attribute from PDF;
-         Target     : Attribute from TDF;
-         RelocTable : RRelocationTable  from MDF);
-
-end PositionRetrievalDriver;
diff --git a/src/MPrsStd/MPrsStd_PositionRetrievalDriver.cxx b/src/MPrsStd/MPrsStd_PositionRetrievalDriver.cxx
deleted file mode 100644 (file)
index f4fc72d..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-// Created on: 1998-04-07
-// Created by: Jean-Pierre COMBE
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <MPrsStd_PositionRetrievalDriver.ixx>
-
-#include <PDataXtd_Position.hxx>
-#include <TDataXtd_Position.hxx>
-#include <CDM_MessageDriver.hxx>
-
-//=======================================================================
-//function : MPrsStd_PositionRetrievalDriver
-//purpose  : 
-//=======================================================================
-MPrsStd_PositionRetrievalDriver::MPrsStd_PositionRetrievalDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ARDriver(theMsgDriver)
-{}
-
-//=======================================================================
-//function : VersionNumber
-//purpose  : 
-//=======================================================================
-Standard_Integer MPrsStd_PositionRetrievalDriver::VersionNumber() const
-{ return 0; }
-
-//=======================================================================
-//function : SourceType
-//purpose  : 
-//=======================================================================
-Handle(Standard_Type) MPrsStd_PositionRetrievalDriver::SourceType() const
-{ return STANDARD_TYPE(PDataXtd_Position); }
-
-//=======================================================================
-//function : NewEmpty
-//purpose  : 
-//=======================================================================
-Handle(TDF_Attribute) MPrsStd_PositionRetrievalDriver::NewEmpty() const
-{ return new TDataXtd_Position; }
-
-//=======================================================================
-//function : Paste
-//purpose  : 
-//=======================================================================
-void MPrsStd_PositionRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source,
-                                                           const Handle(TDF_Attribute)& Target,
-                                                           const Handle(MDF_RRelocationTable)& /*RelocTable*/) const
-{
-  Handle(PDataXtd_Position) S = Handle(PDataXtd_Position)::DownCast (Source);
-  Handle(TDataXtd_Position) T = Handle(TDataXtd_Position)::DownCast (Target);  
-  T->SetPosition(S->GetPosition());
-}
-
diff --git a/src/MPrsStd/MPrsStd_PositionStorageDriver.cdl b/src/MPrsStd/MPrsStd_PositionStorageDriver.cdl
deleted file mode 100644 (file)
index 1d5c961..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
--- Created on: 1998-04-07
--- Created by: Jean-Pierre COMBE
--- Copyright (c) 1998-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class PositionStorageDriver from MPrsStd inherits ASDriver from MDF
-
-       ---Purpose: Storage driver for graphic attributes from
-       --          TPrsStd
-
-uses SRelocationTable from MDF,
-     Attribute        from TDF,
-     Attribute        from PDF, 
-     MessageDriver    from CDM
-
-
-is
-
-    Create(theMessageDriver : MessageDriver from CDM)  
-    returns PositionStorageDriver from MPrsStd;
-
-
-    VersionNumber(me) returns Integer from Standard;
-       ---Purpose: Returns the version number from which the driver
-       --          is available: 0.
-
-    SourceType(me) returns Type from Standard;
-       ---Purpose: Returns the type: ColorAttribute from TGraphicAttribute.
-
-    NewEmpty (me) returns Attribute from PDF;
-
-
-    Paste(me;
-         Source     :         Attribute from TDF;
-         Target     : Attribute from PDF;
-         RelocTable : SRelocationTable from MDF);
-
-
-end PositionStorageDriver;
-
diff --git a/src/MPrsStd/MPrsStd_PositionStorageDriver.cxx b/src/MPrsStd/MPrsStd_PositionStorageDriver.cxx
deleted file mode 100644 (file)
index 0812237..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-// Created on: 1998-04-07
-// Created by: Jean-Pierre COMBE
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <MPrsStd_PositionStorageDriver.ixx>
-
-#include <PDataXtd_Position.hxx>
-#include <TDataXtd_Position.hxx>
-#include <CDM_MessageDriver.hxx>
-
-//=======================================================================
-//function : MPrsStd_PositionStorageDriver
-//purpose  : 
-//=======================================================================
-MPrsStd_PositionStorageDriver::MPrsStd_PositionStorageDriver(const Handle(CDM_MessageDriver)& theMsgDriver):MDF_ASDriver(theMsgDriver)
-{
-}
-
-//=======================================================================
-//function : VersionNumber
-//purpose  : 
-//=======================================================================
-Standard_Integer MPrsStd_PositionStorageDriver::VersionNumber() const
-{ return 0; }
-
-//=======================================================================
-//function : SourceType
-//purpose  : 
-//=======================================================================
-Handle(Standard_Type) MPrsStd_PositionStorageDriver::SourceType() const
-{ return STANDARD_TYPE(TDataXtd_Position); }
-
-//=======================================================================
-//function : NewEmpty
-//purpose  : 
-//=======================================================================
-Handle(PDF_Attribute) MPrsStd_PositionStorageDriver::NewEmpty() const
-{ return new PDataXtd_Position; }
-
-//=======================================================================
-//function : Paste
-//purpose  : 
-//=======================================================================
-void MPrsStd_PositionStorageDriver::Paste(const Handle(TDF_Attribute)& Source,
-                                                         const Handle(PDF_Attribute)& Target,
-                                                         const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
-{
-  Handle(TDataXtd_Position) S = Handle(TDataXtd_Position)::DownCast (Source);
-  Handle(PDataXtd_Position) T = Handle(PDataXtd_Position)::DownCast (Target);  
-  T->SetPosition(S->GetPosition());
-}
-
-
index 372d10d0ea357bc6574344aad640c179099c8549..fc4d9b7434a7dba53d6f01c54933c3066fc9313f 100644 (file)
@@ -58,7 +58,7 @@ proc ApplicationFramework:alias { } {
     return CAF
 }
 proc ApplicationFramework:depends { } {
-    return [list Visualization]
+    return [list ModelingAlgorithms]
 }
 ;#
 ;# Pre-requis pour la compilation ( -I ... )
index 01dab2fa67c253dee92d5575ef5a567f24cd5e0a..e7ca69f003f470dd100a461e367a2540ab9c8fdc 100644 (file)
@@ -15,7 +15,7 @@
 ;# Liste des toolkits WOK sous forme de full path
 ;# 
 proc Draw:toolkits { } {
-    set aResult [list TKDraw TKTopTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw]
+    set aResult [list TKDraw TKTopTest TKViewerTest TKVCAF TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw]
 
     if { [info exists ::env(HAVE_VTK)] && $::env(HAVE_VTK) == "true" } {
       lappend aResult "TKIVtkDraw"
index 9aae68f53565111de23ca86a9c005448b83f020b..e8cf43aa8d2ae3985fc6ebbc93aa9f288992a490 100644 (file)
@@ -20,7 +20,6 @@ uses
 
     CDM,TColStd,TCollection,Storage
 
-
 is 
  
     enumeration ReaderStatus is  
@@ -70,7 +69,8 @@ is
 ---Category: exceptions
 
     exception DriverError inherits Failure from Standard;
-    
+    exception WriteError inherits Failure from Standard;
+    exception ReadError inherits Failure from Standard;
 
     ---Category: classes for versioning  reading/writing og the headers.
     private class Reference;
@@ -105,7 +105,8 @@ is
     --          the SchemaName method.
     returns Schema from Storage;
     
-    FileDriverType(aFileName: AsciiString from TCollection; aBaseDriver: out BaseDriverPointer from PCDM)
+    FileDriverType(aDevice: IODevice from Storage; aBaseDriver: out BaseDriverPointer from PCDM)
     returns TypeOfFileDriver from PCDM
     is private;
+
 end PCDM;
index 876775d0544ef1ba6b4b1ea595e494bdb4653c1d..8735823609a06cf819526942d7b84dd6a07b7f9b 100644 (file)
@@ -79,16 +79,16 @@ Handle(Storage_Schema) PCDM::Schema(const TCollection_ExtendedString& aSchemaNam
 //purpose  : 
 //=======================================================================
 
-PCDM_TypeOfFileDriver PCDM::FileDriverType(const TCollection_AsciiString& aFileName, PCDM_BaseDriverPointer& aBaseDriver) {
-  if(FSD_CmpFile::IsGoodFileType(aFileName) == Storage_VSOk) {
+PCDM_TypeOfFileDriver PCDM::FileDriverType(const Handle(Storage_IODevice)& aDevice, PCDM_BaseDriverPointer& aBaseDriver) {
+  if(FSD_CmpFile::IsGoodFileType(aDevice) == Storage_VSOk) {
     aBaseDriver=new FSD_CmpFile;
     return PCDM_TOFD_CmpFile;
   }
-  else if(FSD_File::IsGoodFileType(aFileName) == Storage_VSOk) {
+  else if(FSD_File::IsGoodFileType(aDevice) == Storage_VSOk) {
     aBaseDriver=new FSD_File;
     return PCDM_TOFD_File;
   }
-  else if(FSD_BinaryFile::IsGoodFileType(aFileName) == Storage_VSOk) {
+  else if(FSD_BinaryFile::IsGoodFileType(aDevice) == Storage_VSOk) {
     aBaseDriver=new FSD_BinaryFile;
     return PCDM_TOFD_File;
   }
index 3449025a26d080d4cdfe27c7480070dce6ed4283..7cabf17605c1c5a141b1c2d3af3ca67778f5d69e 100644 (file)
 
 #include <PCDM_DOMHeaderParser.hxx>
 
+#include <Storage_File.hxx>
+#include <Storage_IStream.hxx>
+
+Standard_Boolean PCDM_DOMHeaderParser::parse( const Handle(Storage_IODevice)& anInput )
+{
+  Standard_Boolean aRes = Standard_True;
+  Handle(Storage_File) aFile = Handle(Storage_File)::DownCast(anInput);
+  if ( !aFile.IsNull() )
+  {
+    TCollection_AsciiString aPath( aFile->Path() );
+    aRes = LDOMParser::parse( aPath.ToCString() );
+  }
+  else if ( !anInput.IsNull() && anInput->CanRead() )
+  {
+    Standard_Size aSize = 8000;
+    char* aBuf = (char*)malloc( aSize );
+    anInput->Open(Storage_VSRead);
+    std::string aStr;
+    while ( !anInput->IsEnd() )
+    {
+        Standard_Size aNum = anInput->Read( aBuf, aSize );
+        aStr.append( aBuf, aNum );
+    }
+    anInput->Close();
+    free( aBuf );
+
+    Standard_SStream aStream( std::ios::in );
+    aStream.str( aStr );
+
+    aRes = LDOMParser::parse( aStream );
+  }
+  return aRes;
+}
+
 //=======================================================================
 //function : SetStartElementName
 //purpose  : set the name of the element which would stop parsing when detected
index c4c0aaaada8f0c85448a84ea122bb37e0c953386..6363a56512d5a2864e1356ba5b9673d4ae138d58 100644 (file)
@@ -18,6 +18,8 @@
 
 #include <LDOMParser.hxx>
 
+#include <Storage_IODevice.hxx>
+
 //  Block of comments describing class PCDM_DOMHeaderParser
 
 class PCDM_DOMHeaderParser : public LDOMParser
@@ -25,6 +27,8 @@ class PCDM_DOMHeaderParser : public LDOMParser
  public:
   // ---------- PUBLIC METHODS ----------
 
+  Standard_Boolean parse (const Handle(Storage_IODevice)& anInput);
+
   void SetStartElementName   (const TCollection_AsciiString& aStartElementName);
   //    set the name of the element which would stop parsing when detected
 
index 70eb68bbdeb6ff55edba31e5a4de0d4bfe6c39e2..3b0da69bd83e18030f0de4b82cbd53688303329e 100644 (file)
@@ -25,6 +25,7 @@ uses
     SequenceOfExtendedString from TColStd,  
     BaseDriver from Storage,  
     OpenMode from Storage, 
+    IODevice from Storage,
     SequenceOfReference from PCDM
 
 is
@@ -37,7 +38,7 @@ is
     WriteReferenceCounter(me; aData: Data from Storage; aDocument: Document from CDM)
     is deferred;
     
-    WriteReferences(me; aData: Data from Storage; aDocument: Document from CDM; theReferencerFileName: ExtendedString from TCollection)
+    WriteReferences(me; aData: Data from Storage; aDocument: Document from CDM; theReferencer: IODevice from Storage)
     is deferred;
 
     
@@ -49,27 +50,27 @@ is
     is deferred;
 
     
-    ReadReferenceCounter(me; theFileName: ExtendedString from TCollection;   
+    ReadReferenceCounter(me; theDevice: IODevice from Storage;   
                             theMsgDriver: MessageDriver from CDM)
     returns Integer from Standard
     is deferred;
 
-    ReadReferences(me; aFileName: ExtendedString from TCollection; theReferences: in out  SequenceOfReference from PCDM; theMsgDriver: MessageDriver from CDM)
+    ReadReferences(me; aDevice: IODevice from Storage; theReferences: in out SequenceOfReference from PCDM; theMsgDriver: MessageDriver from CDM)
     is deferred;
 
-    ReadExtensions(me; aFileName: ExtendedString from TCollection; theExtensions: in out  SequenceOfExtendedString from TColStd; theMsgDriver: MessageDriver from CDM)
+    ReadExtensions(me; aDevice: IODevice from Storage; theExtensions: in out  SequenceOfExtendedString from TColStd; theMsgDriver: MessageDriver from CDM)
     is deferred;
     
-    ReadDocumentVersion(me; aFileName: ExtendedString from TCollection; theMsgDriver: MessageDriver from CDM)
+    ReadDocumentVersion(me; aDevice: IODevice from Storage; theMsgDriver: MessageDriver from CDM)
     returns Integer from Standard
     is deferred;
 
 ---Category: commom methods
 
 
-    Open(myclass; aDriver: in out BaseDriver from Storage; aFileName: ExtendedString from TCollection; anOpenMode: OpenMode from  Storage);
+    Open(myclass; aDriver: in out BaseDriver from Storage; aDevice: IODevice from Storage; anOpenMode: OpenMode from  Storage);
     
-    Reader(myclass; aFileName: ExtendedString from TCollection)
+    Reader(myclass; aDevice: IODevice from Storage)
     returns ReadWriter from PCDM;
     ---Purpose: returns the convenient Reader for a File.
     --          
@@ -80,9 +81,10 @@ is
 
     WriteFileFormat(myclass; aData: Data from Storage; aDocument: Document from CDM);
     
-    FileFormat(myclass; aFileName: ExtendedString from TCollection)
+    FileFormat(myclass; aDevice: IODevice from Storage)
     returns ExtendedString from TCollection;
     ---Purpose: tries  to get a format  in the  file.  returns an empty
     --          string if the file could not be read or does not have 
     --          a FileFormat information.
+
 end ReadWriter from PCDM;
index 92df812ad6ca77a9dd9f0bf32b09d9b5e142397f..f22a607d9a8ece3ffbd564d76b4f8eaeca769f2b 100644 (file)
@@ -27,8 +27,7 @@
 
 #define FILE_FORMAT "FILE_FORMAT: "
 
-static TCollection_ExtendedString TryXmlDriverType
-                                (const TCollection_AsciiString& theFileName);
+static TCollection_ExtendedString TryXmlDriverType(const Handle(Storage_IODevice)& theDevice);
 
 //=======================================================================
 //function : Open
@@ -36,13 +35,14 @@ static TCollection_ExtendedString TryXmlDriverType
 //=======================================================================
 
 void PCDM_ReadWriter::Open (Storage_BaseDriver&                 aDriver,
-                            const TCollection_ExtendedString&   aFileName,
+                            const Handle(Storage_IODevice)&     aDevice,
                             const Storage_OpenMode              aMode)
 {
-  Storage_Error error = UTL::OpenFile(aDriver,aFileName,aMode);
+  Storage_Error error = aDriver.Open(aDevice, aMode);
+
   if(error != Storage_VSOk) {
     Standard_SStream aMsg; aMsg << "could not open the file: ";
-    aMsg << aFileName;
+    aMsg << aDevice;
     switch (error) {
     case Storage_VSOpenError: aMsg << "; file was not found or permission denied"; break;
     case Storage_VSAlreadyOpen: aMsg<< "; file was already opened";
@@ -61,8 +61,7 @@ void PCDM_ReadWriter::Open (Storage_BaseDriver&                 aDriver,
 
 //Handle(PCDM_ReadWriter) PCDM_ReadWriter::Reader(const TCollection_ExtendedString& aFileName) {
 
-Handle(PCDM_ReadWriter) PCDM_ReadWriter::Reader
-                                           (const TCollection_ExtendedString&)
+Handle(PCDM_ReadWriter) PCDM_ReadWriter::Reader(const Handle(Storage_IODevice)&)
 {
   static Handle(PCDM_ReadWriter_1) theReader=new PCDM_ReadWriter_1;
   return theReader;
@@ -98,26 +97,24 @@ void PCDM_ReadWriter::WriteFileFormat (const Handle(Storage_Data)& aData,
 //purpose  : 
 //=======================================================================
 
-TCollection_ExtendedString PCDM_ReadWriter::FileFormat
-                                (const TCollection_ExtendedString& aFileName)
+TCollection_ExtendedString PCDM_ReadWriter::FileFormat(const Handle(Storage_IODevice)& aDevice)
 {
   TCollection_ExtendedString theFormat;
   
   PCDM_BaseDriverPointer theFileDriver;
 
   // conversion to UTF-8 is done inside
-  TCollection_AsciiString theFileName (aFileName);
-  if (PCDM::FileDriverType (theFileName, theFileDriver) == PCDM_TOFD_Unknown)
-    return ::TryXmlDriverType (theFileName);
+  if (PCDM::FileDriverType (aDevice, theFileDriver) == PCDM_TOFD_Unknown)
+    return ::TryXmlDriverType (aDevice);
 
-  static Standard_Boolean theFileIsOpen;
-  theFileIsOpen=Standard_False;
+  static Standard_Boolean aDeviceIsOpen;
+  aDeviceIsOpen = Standard_False;
 
   try {
     OCC_CATCH_SIGNALS
     
-    Open(*theFileDriver,aFileName,Storage_VSRead);
-    theFileIsOpen=Standard_True;
+    Open(*theFileDriver, aDevice, Storage_VSRead);
+    aDeviceIsOpen = Standard_True;
     Handle(Storage_Schema) s = new Storage_Schema;
     Handle(Storage_HeaderData) hd = s->ReadHeaderSection(*theFileDriver);
     const TColStd_SequenceOfAsciiString &refUserInfo = hd->UserInfo();
@@ -134,7 +131,7 @@ TCollection_ExtendedString PCDM_ReadWriter::FileFormat
   catch (Standard_Failure) {}
 
   
-  if(theFileIsOpen)theFileDriver->Close();
+  if(aDeviceIsOpen)theFileDriver->Close();
 
   delete theFileDriver;
 
@@ -146,8 +143,7 @@ TCollection_ExtendedString PCDM_ReadWriter::FileFormat
 //purpose  : called from FileFormat()
 //=======================================================================
 
-static TCollection_ExtendedString TryXmlDriverType
-                                (const TCollection_AsciiString& theFileName)
+static TCollection_ExtendedString TryXmlDriverType(const Handle(Storage_IODevice)& theDevice)
 {
   TCollection_ExtendedString theFormat;
   PCDM_DOMHeaderParser       aParser;
@@ -156,7 +152,7 @@ static TCollection_ExtendedString TryXmlDriverType
 
   // Parse the file; if there is no error or an error appears before retrieval
   // of the DocumentElement, the XML format cannot be defined
-  if (aParser.parse (theFileName.ToCString()))
+  if (aParser.parse (theDevice))
   {
     LDOM_Element anElement = aParser.GetElement();
     if (anElement.getTagName().equals (LDOMString(aDocumentElementName)))
index 7e2a766f1447d5a6be7750e6cbb05d57bb1beb22..a2b5d24f66ca3d1475486f621af749bea40102cf 100644 (file)
@@ -20,6 +20,7 @@ uses
     ExtendedString from TCollection,  
     AsciiString from TCollection, 
     Data from Storage, 
+    IODevice from Storage,
     Document from CDM, 
     MessageDriver from CDM, 
     SequenceOfExtendedString from TColStd, 
@@ -34,28 +35,24 @@ is
    
     WriteReferenceCounter(me; aData: Data from Storage; aDocument: Document from CDM);
 
-    WriteReferences(me; aData: Data from Storage; aDocument: Document from CDM; theReferencerFileName: ExtendedString from TCollection);
+    WriteReferences(me; aData: Data from Storage; aDocument: Document from CDM; theReferencer: IODevice from Storage);
 
-    
     WriteExtensions(me; aData: Data from Storage; aDocument: Document from CDM);
 
-    
     WriteVersion(me; aData: Data from Storage; aDocument: Document from CDM);
-
     
-    ReadReferenceCounter(me; aFileName: ExtendedString from TCollection; theMsgDriver: MessageDriver from CDM)
+    ReadReferenceCounter(me; aDevice: IODevice from Storage; theMsgDriver: MessageDriver from CDM)
     returns Integer from Standard;
 
-    ReadReferences(me; aFileName: ExtendedString from TCollection; theReferences: in out  SequenceOfReference from PCDM; theMsgDriver: MessageDriver from CDM);
+    ReadReferences(me; aDevice: IODevice from Storage; theReferences: in out  SequenceOfReference from PCDM; theMsgDriver: MessageDriver from CDM);
 
     
-    ReadExtensions(me; aFileName: ExtendedString from TCollection; theExtensions: in out  SequenceOfExtendedString from TColStd; theMsgDriver: MessageDriver from CDM);
+    ReadExtensions(me; aDevice: IODevice from Storage; theExtensions: in out  SequenceOfExtendedString from TColStd; theMsgDriver: MessageDriver from CDM);
 
-    ReadUserInfo(myclass; aFileName: ExtendedString from TCollection; Start, End: AsciiString from TCollection; theUserInfo:in  out SequenceOfExtendedString from TColStd;theMsgDriver: MessageDriver from CDM)
+    ReadUserInfo(myclass; aDevice: IODevice from Storage; Start, End: AsciiString from TCollection; theUserInfo:in  out SequenceOfExtendedString from TColStd;theMsgDriver: MessageDriver from CDM)
     is private;
 
-    ReadDocumentVersion(me; aFileName: ExtendedString from TCollection; theMsgDriver: MessageDriver from CDM)
+    ReadDocumentVersion(me; aDevice: IODevice from Storage; theMsgDriver: MessageDriver from CDM)
     returns Integer from Standard;
 
-
 end ReadWriter_1 from PCDM;
index 031578be70d42bec627b10f7b3a0f5ad56ee29ef..e06ebcdacf0748a8dd90ab04d3dbf15aca351057 100644 (file)
@@ -25,6 +25,7 @@
 #include <TColStd_SequenceOfExtendedString.hxx>
 #include <Storage_Schema.hxx>
 #include <Storage_HeaderData.hxx>
+#include <Storage_File.hxx>
 #include <TColStd_SequenceOfAsciiString.hxx>
 #include <PCDM_Reference.hxx>
 #include <Standard_ErrorHandler.hxx>
@@ -32,6 +33,8 @@
 #include <PCDM_BaseDriverPointer.hxx>
 #include <PCDM.hxx>
 #include <PCDM_TypeOfFileDriver.hxx>
+#include <PCDM_WriteError.hxx>
+#include <PCDM_ReadError.hxx>
 
 #define START_REF "START_REF"
 #define END_REF "END_REF"
@@ -153,18 +156,24 @@ void PCDM_ReadWriter_1::WriteReferenceCounter(const Handle(Storage_Data)& aData,
 //purpose  : 
 //=======================================================================
 
-void PCDM_ReadWriter_1::WriteReferences(const Handle(Storage_Data)& aData, const Handle(CDM_Document)& aDocument,const TCollection_ExtendedString& theReferencerFileName) const {  
+void PCDM_ReadWriter_1::WriteReferences(const Handle(Storage_Data)& aData, const Handle(CDM_Document)& aDocument,const Handle(Storage_IODevice)& theReferencer) const {  
 
   Standard_Integer theNumber = aDocument->ToReferencesNumber();
   if(theNumber > 0) {
 
+    Handle(Storage_File) aFileDevice = Handle(Storage_File)::DownCast(theReferencer);
+    if ( aFileDevice.IsNull() )
+    {
+      PCDM_WriteError::Raise( "Can't save references of document which was not stored to file" );
+    }
+
     aData->AddToUserInfo(START_REF);
 
     CDM_ReferenceIterator it(aDocument);
 
     TCollection_ExtendedString ligne;
 
-    TCollection_AsciiString theAbsoluteDirectory=GetDirFromFile(theReferencerFileName);
+    TCollection_AsciiString theAbsoluteDirectory=GetDirFromFile(aFileDevice->Path());
 
     for (;it.More();it.Next()) {
       ligne = TCollection_ExtendedString(it.ReferenceIdentifier());
@@ -172,7 +181,14 @@ void PCDM_ReadWriter_1::WriteReferences(const Handle(Storage_Data)& aData, const
       ligne += TCollection_ExtendedString(it.Document()->Modifications());
       ligne += " ";
 
-      TCollection_AsciiString thePath(it.Document()->MetaData()->FileName());
+      Handle(Storage_File) aFileDevice = Handle(Storage_File)::DownCast(it.Document()->MetaData()->Device());
+      if ( aFileDevice.IsNull() )
+      {
+        PCDM_WriteError::Raise( "Can't save reference to document which was not retrieved from file" );
+      }
+
+      TCollection_AsciiString thePath = aFileDevice->Path();
+
       TCollection_AsciiString theRelativePath;
       if(!theAbsoluteDirectory.IsEmpty()) {
        theRelativePath=OSD_Path::RelativePath(theAbsoluteDirectory,thePath);
@@ -219,15 +235,14 @@ void PCDM_ReadWriter_1::WriteVersion(const Handle(Storage_Data)& aData, const Ha
 //purpose  : 
 //=======================================================================
 
-Standard_Integer PCDM_ReadWriter_1::ReadReferenceCounter(const TCollection_ExtendedString& aFileName, const Handle(CDM_MessageDriver)& theMsgDriver) const {
+ Standard_Integer PCDM_ReadWriter_1::ReadReferenceCounter(const Handle(Storage_IODevice)& aDevice, const Handle(CDM_MessageDriver)& theMsgDriver) const {
 
   static Standard_Integer theReferencesCounter ;
   theReferencesCounter=0;
   static Standard_Integer i ;
 
   PCDM_BaseDriverPointer theFileDriver;
-  TCollection_AsciiString aFileNameU(aFileName);
-  if(PCDM::FileDriverType(aFileNameU, theFileDriver) == PCDM_TOFD_Unknown)
+  if(PCDM::FileDriverType(aDevice, theFileDriver) == PCDM_TOFD_Unknown)
     return theReferencesCounter;
   
   static Standard_Boolean theFileIsOpen ;
@@ -235,7 +250,7 @@ Standard_Integer PCDM_ReadWriter_1::ReadReferenceCounter(const TCollection_Exten
 
   try {
     OCC_CATCH_SIGNALS
-    PCDM_ReadWriter::Open(*theFileDriver,aFileName,Storage_VSRead);
+    PCDM_ReadWriter::Open(*theFileDriver,aDevice,Storage_VSRead);
     theFileIsOpen=Standard_True;
    
     Handle(Storage_Schema) s = new Storage_Schema;
@@ -248,13 +263,12 @@ Standard_Integer PCDM_ReadWriter_1::ReadReferenceCounter(const TCollection_Exten
        catch (Standard_Failure) { 
 //       cout << "warning: could not read the reference counter in " << aFileName << endl;
          TCollection_ExtendedString aMsg("Warning: ");
-         aMsg = aMsg.Cat("could not read the reference counter in ").Cat(aFileName).Cat("\0");
+         aMsg = aMsg.Cat("could not read the reference counter in ").Cat("\0");
          if(!theMsgDriver.IsNull()) 
            theMsgDriver->Write(aMsg.ToExtString());
        }
       }
     }
-    
   }
   catch (Standard_Failure) {}
 
@@ -269,17 +283,25 @@ Standard_Integer PCDM_ReadWriter_1::ReadReferenceCounter(const TCollection_Exten
 //purpose  : 
 //=======================================================================
 
-void PCDM_ReadWriter_1::ReadReferences(const TCollection_ExtendedString& aFileName, PCDM_SequenceOfReference& theReferences, const Handle(CDM_MessageDriver)& theMsgDriver) const  {
+ void PCDM_ReadWriter_1::ReadReferences(const Handle(Storage_IODevice)& aDevice, PCDM_SequenceOfReference& theReferences, const Handle(CDM_MessageDriver)& theMsgDriver) const  {
 
   TColStd_SequenceOfExtendedString ReadReferences;
   
-  ReadUserInfo(aFileName,START_REF,END_REF,ReadReferences, theMsgDriver);
+  ReadUserInfo(aDevice,START_REF,END_REF,ReadReferences, theMsgDriver);
 
   Standard_Integer theReferenceIdentifier;
   TCollection_ExtendedString theFileName;
   Standard_Integer theDocumentVersion;
 
-  TCollection_AsciiString theAbsoluteDirectory=GetDirFromFile(aFileName);
+
+  Handle(Storage_File) aFileDevice = Handle(Storage_File)::DownCast(aDevice);
+  if ( aFileDevice.IsNull() )
+  {
+    return;
+    //PCDM_ReadError::Raise( "Can't read references for document which was not retrieved from file" );
+  }
+
+  TCollection_AsciiString theAbsoluteDirectory = GetDirFromFile(aFileDevice->Path());
 
   for (Standard_Integer i=1; i<=ReadReferences.Length(); i++) {
     Standard_Integer pos=ReadReferences(i).Search(" ");
@@ -304,8 +326,8 @@ void PCDM_ReadWriter_1::ReadReferences(const TCollection_ExtendedString& aFileNa
        aMsg = aMsg.Cat("reference found; ReferenceIdentifier:  ").Cat(theReferenceIdentifier).Cat("; File:").Cat(thePath).Cat(", version:").Cat(theDocumentVersion).Cat("\0");
        theMsgDriver->Write(aMsg.ToExtString());
       }
-      TCollection_ExtendedString aPathW(thePath);
-      theReferences.Append(PCDM_Reference (theReferenceIdentifier,aPathW,theDocumentVersion));
+      ;
+      theReferences.Append(PCDM_Reference (theReferenceIdentifier,new Storage_File( TCollection_ExtendedString( thePath ) ),theDocumentVersion));
     
     }
   }
@@ -317,9 +339,9 @@ void PCDM_ReadWriter_1::ReadReferences(const TCollection_ExtendedString& aFileNa
 //purpose  : 
 //=======================================================================
 
-void PCDM_ReadWriter_1::ReadExtensions(const TCollection_ExtendedString& aFileName, TColStd_SequenceOfExtendedString& theExtensions, const Handle(CDM_MessageDriver)& theMsgDriver) const {
+void PCDM_ReadWriter_1::ReadExtensions(const Handle(Storage_IODevice)& aDevice, TColStd_SequenceOfExtendedString& theExtensions, const Handle(CDM_MessageDriver)& theMsgDriver) const {
   
-  ReadUserInfo(aFileName,START_EXT,END_EXT,theExtensions, theMsgDriver);
+  ReadUserInfo(aDevice,START_EXT,END_EXT,theExtensions, theMsgDriver);
 }
 
 
@@ -328,7 +350,7 @@ void PCDM_ReadWriter_1::ReadExtensions(const TCollection_ExtendedString& aFileNa
 //purpose  : 
 //=======================================================================
 
-void PCDM_ReadWriter_1::ReadUserInfo(const TCollection_ExtendedString& aFileName,
+void PCDM_ReadWriter_1::ReadUserInfo(const Handle(Storage_IODevice)& aDevice,
                                      const TCollection_AsciiString& Start,
                                      const TCollection_AsciiString& End,
                                      TColStd_SequenceOfExtendedString& theUserInfo,
@@ -336,11 +358,10 @@ void PCDM_ReadWriter_1::ReadUserInfo(const TCollection_ExtendedString& aFileName
 
   static Standard_Integer i ;
   PCDM_BaseDriverPointer theFileDriver;
-  TCollection_AsciiString aFileNameU(aFileName);
-  if(PCDM::FileDriverType(aFileNameU, theFileDriver) == PCDM_TOFD_Unknown)
+  if(PCDM::FileDriverType(aDevice, theFileDriver) == PCDM_TOFD_Unknown)
     return;
 
-  PCDM_ReadWriter::Open(*theFileDriver,aFileName,Storage_VSRead);
+  PCDM_ReadWriter::Open(*theFileDriver,aDevice,Storage_VSRead);
   Handle(Storage_Schema) s = new Storage_Schema;
   Handle(Storage_HeaderData) hd = s->ReadHeaderSection(*theFileDriver);
   const TColStd_SequenceOfAsciiString &refUserInfo = hd->UserInfo();
@@ -367,14 +388,13 @@ void PCDM_ReadWriter_1::ReadUserInfo(const TCollection_ExtendedString& aFileName
 //purpose  : 
 //=======================================================================
 
-Standard_Integer PCDM_ReadWriter_1::ReadDocumentVersion(const TCollection_ExtendedString& aFileName, const Handle(CDM_MessageDriver)& theMsgDriver) const {
+Standard_Integer PCDM_ReadWriter_1::ReadDocumentVersion(const Handle(Storage_IODevice)& aDevice, const Handle(CDM_MessageDriver)& theMsgDriver) const {
 
   static Standard_Integer theVersion ;
   theVersion=-1;
 
   PCDM_BaseDriverPointer theFileDriver;
-  TCollection_AsciiString aFileNameU(aFileName);
-  if(PCDM::FileDriverType(aFileNameU, theFileDriver) == PCDM_TOFD_Unknown)
+  if(PCDM::FileDriverType(aDevice, theFileDriver) == PCDM_TOFD_Unknown)
     return theVersion;
 
   static Standard_Boolean theFileIsOpen ;
@@ -382,7 +402,7 @@ Standard_Integer PCDM_ReadWriter_1::ReadDocumentVersion(const TCollection_Extend
 
   try {
     OCC_CATCH_SIGNALS
-    PCDM_ReadWriter::Open(*theFileDriver,aFileName,Storage_VSRead);
+    PCDM_ReadWriter::Open(*theFileDriver,aDevice,Storage_VSRead);
     theFileIsOpen=Standard_True;
     Handle(Storage_Schema) s = new Storage_Schema;
     Handle(Storage_HeaderData) hd = s->ReadHeaderSection(*theFileDriver);
@@ -395,11 +415,10 @@ Standard_Integer PCDM_ReadWriter_1::ReadDocumentVersion(const TCollection_Extend
        catch (Standard_Failure) { 
 //       cout << "warning: could not read the version in " << aFileName << endl;
          TCollection_ExtendedString aMsg("Warning: ");
-         aMsg = aMsg.Cat("could not read the version in ").Cat(aFileName).Cat("\0");
+         aMsg = aMsg.Cat("could not read the version in ").Cat("\0");
          if(!theMsgDriver.IsNull()) 
            theMsgDriver->Write(aMsg.ToExtString());
        }
-
       }
     }
   }
index 9bab9f37cfd9038aa7956b82709cf65f1100e8b1..28bee8d61e410bb369e127ba9d844ee671790c9f 100644 (file)
@@ -21,7 +21,8 @@ uses
     Document from CDM, 
     ExtendedString from TCollection,  
     Application from CDM, 
-    ReaderStatus from PCDM
+    ReaderStatus from PCDM,
+    IODevice from Storage
 
 raises  DriverError from PCDM
 
@@ -32,7 +33,7 @@ is
     is deferred;
     ---Purpose: this method is called by the framework before the read method.
     
-    Read(me: mutable; aFileName: ExtendedString from TCollection
+    Read(me: mutable; aDevice: IODevice from Storage
                       aNewDocument: Document from CDM;
                      anApplication: Application from CDM)
     raises DriverError from PCDM
index 503bcc38b505f975748bbb57a203e6b776134b8e..b72edaf7adae4f9f8fb5b8c64cbe2c5a58289a84 100644 (file)
 -- commercial license or contractual agreement.
 
 private class Reference from PCDM
-uses ExtendedString from TCollection
+uses ExtendedString from TCollection, IODevice from Storage
 is
     Create returns Reference from PCDM;
     
-    Create(aReferenceIdentifier: Integer from Standard; aFileName: ExtendedString from TCollection; aDocumentVersion: Integer from Standard)
+    Create(aReferenceIdentifier: Integer from Standard; aDevice: IODevice from Storage; aDocumentVersion: Integer from Standard)
      returns Reference from PCDM;
     
     ReferenceIdentifier(me) returns Integer from Standard;
     
-    FileName(me) returns ExtendedString from TCollection;
+    Device(me) returns IODevice from Storage;
     
     DocumentVersion(me) returns Integer from Standard;
     
-    
 fields
+
     myReferenceIdentifier: Integer from Standard;
-    myFileName: ExtendedString from TCollection;
-    myDocumentVersion: Integer from Standard;
+    myDevice:              IODevice from Storage;
+    myDocumentVersion:     Integer from Standard;
+
 end Reference from PCDM;
index 16adcd8306eea79dd4927d72e2bb895ad8492611..c38bef8319a8a067bab62ca10b3847c01b1baa9a 100644 (file)
 
 #include <PCDM_Reference.ixx>
 
-PCDM_Reference::PCDM_Reference(){}
-PCDM_Reference::PCDM_Reference(const Standard_Integer aReferenceIdentifier, const TCollection_ExtendedString& aFileName, const Standard_Integer aDocumentVersion):myReferenceIdentifier(aReferenceIdentifier),myFileName(aFileName),myDocumentVersion(aDocumentVersion) {}
+PCDM_Reference::PCDM_Reference()
+{
+}
 
+PCDM_Reference::PCDM_Reference(const Standard_Integer aReferenceIdentifier, const Handle(Storage_IODevice)& aDevice, const Standard_Integer aDocumentVersion)
+ : myReferenceIdentifier(aReferenceIdentifier),
+   myDevice(aDevice),
+   myDocumentVersion(aDocumentVersion)
+{
+}
 
 Standard_Integer PCDM_Reference::ReferenceIdentifier() const {
   return myReferenceIdentifier;
 }
 
-TCollection_ExtendedString PCDM_Reference::FileName() const {
-  return myFileName;
+Handle(Storage_IODevice) PCDM_Reference::Device() const {
+  return myDevice;
 }
 
 Standard_Integer PCDM_Reference::DocumentVersion() const {
index 430bfd4f6463c9cc300d100f488156fbf383c07e..956a45de20b3bc9dee498e15546a6d04b65a2654 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <PCDM_ReferenceIterator.ixx>
 #include <Storage_Data.hxx>
+#include <Storage_IODevice.hxx>
 #include <UTL.hxx>
 #include <CDM_Document.hxx>
 #include <CDM_Application.hxx>
@@ -62,8 +63,7 @@ void PCDM_ReferenceIterator::Init(const Handle(CDM_MetaData)& theMetaData) {
 
   myReferences.Clear();
   // mod. by szy
-  PCDM_RetrievalDriver::References(theMetaData->FileName(), myReferences, 
-    myMessageDriver);
+  PCDM_RetrievalDriver::References(theMetaData->Device(), myReferences, myMessageDriver);
   myIterator=1;  
 }
 
@@ -92,8 +92,9 @@ void PCDM_ReferenceIterator::Next() {
 
 Handle(CDM_MetaData) PCDM_ReferenceIterator::MetaData(const Standard_Boolean ) const {
   
-  TCollection_ExtendedString theFolder,theName;
-  TCollection_ExtendedString theFile=myReferences(myIterator).FileName();
+  //  TCollection_ExtendedString theFolder,theName;
+  Handle(Storage_IODevice) theDevice = myReferences(myIterator).Device();
+  /*
   TCollection_ExtendedString f(theFile);
 #ifndef WNT
   
@@ -133,8 +134,9 @@ Handle(CDM_MetaData) PCDM_ReferenceIterator::MetaData(const Standard_Boolean ) c
   theFolder = dirRet;
   theName   = UTL::Name(p); theName+= UTL::Extension(p);
 #endif  // WNT
-  
   return CDM_MetaData::LookUp(theFolder,theName,theFile,theFile,UTL::IsReadOnly(theFile));
+  */
+  return CDM_MetaData::LookUp(theDevice,!theDevice->CanWrite());
 }
 //=======================================================================
 //function : ReferenceIdentifier
index 70dd2914211d1a71a2e4dc4816dcbcf1023c5f5d..16673ea9d9b2f84c61dfe1270e104e9c9d7d75be 100644 (file)
@@ -14,9 +14,7 @@
 -- Alternatively, this file may be used under the terms of Open CASCADE
 -- commercial license or contractual agreement.
 
-deferred class RetrievalDriver from PCDM
-inherits Reader from PCDM
-
+deferred class RetrievalDriver from PCDM inherits Reader from PCDM
 
 uses
     Document from PCDM,  
@@ -26,6 +24,7 @@ uses
     AsciiString from TCollection, 
     SequenceOfReference from PCDM, 
     Schema from Storage, 
+    IODevice from Storage,
     MessageDriver from CDM,
     Application from CDM
 
@@ -34,7 +33,7 @@ raises NoSuchObject from Standard,  DriverError from PCDM
 
 is
 
-    Read(me: mutable; aFileName: ExtendedString from TCollection
+    Read(me: mutable; aDevice: IODevice from Storage
                       aNewDocument: Document from CDM;
                      anApplication: Application from CDM)
     raises DriverError from PCDM
@@ -61,21 +60,21 @@ is
     
     ---Category: private methods.
 
-    References(myclass; aFileName: ExtendedString from TCollection; theReferences: out SequenceOfReference from PCDM; theMsgDriver: MessageDriver from CDM)
+    References(myclass; aDevice: IODevice from Storage; theReferences: out SequenceOfReference from PCDM; theMsgDriver: MessageDriver from CDM)
     is private;
     
-    Extensions(myclass; aFileName: ExtendedString from TCollection; theExtensions: in out  SequenceOfExtendedString from TColStd; theMsgDriver: MessageDriver from CDM)
+    Extensions(myclass; aDevice: IODevice from Storage; theExtensions: in out  SequenceOfExtendedString from TColStd; theMsgDriver: MessageDriver from CDM)
     is private;
 
-    UserInfo(myclass; aFileName: ExtendedString from TCollection; Start, End: AsciiString from TCollection; theUserInfo:in  out SequenceOfExtendedString from TColStd;  theMsgDriver: MessageDriver from CDM)
+    UserInfo(myclass; aDevice: IODevice from Storage; Start, End: AsciiString from TCollection; theUserInfo:in  out SequenceOfExtendedString from TColStd;  theMsgDriver: MessageDriver from CDM)
     is private;
 
-    RaiseIfUnknownTypes(myclass; aSchema: Schema from Storage; aFileName: ExtendedString from TCollection);
+    RaiseIfUnknownTypes(myclass; aSchema: Schema from Storage; aDevice: IODevice from Storage);
     
-    DocumentVersion(myclass; aFileName: ExtendedString from TCollection; theMsgDriver: MessageDriver from CDM)
+    DocumentVersion(myclass; aDevice: IODevice from Storage; theMsgDriver: MessageDriver from CDM)
     returns Integer from Standard;
 
-    ReferenceCounter(myclass; aFileName: ExtendedString from TCollection; theMsgDriver: MessageDriver from CDM)
+    ReferenceCounter(myclass; aDevice: IODevice from Storage; theMsgDriver: MessageDriver from CDM)
     returns Integer from Standard;
     
     SetFormat (me : mutable; aformat : ExtendedString from TCollection);
index c01970800175b3c439a7a85280da778e12ee63e2..de06e3047d7e92eeb288d20d8c5891a1f1effd48 100644 (file)
@@ -22,6 +22,7 @@
 #include <Storage_HeaderData.hxx>
 #include <Storage_Schema.hxx>
 #include <Storage_Root.hxx>
+#include <Storage_IODevice.hxx>
 #include <TCollection_AsciiString.hxx>
 
 #include <TColStd_SequenceOfAsciiString.hxx>
 #include <Storage_HSeqOfRoot.hxx>
 #include <locale.h>
 
-void PCDM_RetrievalDriver::RaiseIfUnknownTypes(const Handle(Storage_Schema)& aSchema, const TCollection_ExtendedString& aFileName) {
+void PCDM_RetrievalDriver::RaiseIfUnknownTypes(const Handle(Storage_Schema)& aSchema, const Handle(Storage_IODevice)& aDevice) {
 
   PCDM_BaseDriverPointer theFileDriver;
-  TCollection_AsciiString aFileNameU(aFileName);
-  if(PCDM::FileDriverType(aFileNameU, theFileDriver) == PCDM_TOFD_Unknown)
+  //  TCollection_AsciiString aFileNameU(aFileName);
+  if(PCDM::FileDriverType(aDevice, theFileDriver) == PCDM_TOFD_Unknown)
     return;
   
-  PCDM_ReadWriter::Open(*theFileDriver,aFileName,Storage_VSRead);
+  PCDM_ReadWriter::Open(*theFileDriver, aDevice, Storage_VSRead);
   
   TColStd_SequenceOfAsciiString theUnknownTypes;
   Standard_Boolean unknowns = aSchema->HasUnknownType(*theFileDriver,theUnknownTypes);
@@ -50,7 +51,7 @@ void PCDM_RetrievalDriver::RaiseIfUnknownTypes(const Handle(Storage_Schema)& aSc
   delete theFileDriver;
 
   if(unknowns) {
-    Standard_SStream aMsg; aMsg << "cannot read: `" << aFileName << "', because  the following types: ";
+    Standard_SStream aMsg; aMsg << "cannot read: `" << aDevice << "', because the following types: ";
     for (Standard_Integer i=1; i <= theUnknownTypes.Length(); i++) {
       aMsg << theUnknownTypes(i);
       if(i< theUnknownTypes.Length()) aMsg <<",";
@@ -65,7 +66,7 @@ void PCDM_RetrievalDriver::RaiseIfUnknownTypes(const Handle(Storage_Schema)& aSc
 //purpose  : 
 //=======================================================================
 
-void PCDM_RetrievalDriver::Read(const TCollection_ExtendedString& theFileName,
+void PCDM_RetrievalDriver::Read(const Handle(Storage_IODevice)& aDevice,
                                const Handle(CDM_Document)& aNewDocument,
                                const Handle(CDM_Application)& theApplication)
 {
@@ -78,8 +79,8 @@ void PCDM_RetrievalDriver::Read(const TCollection_ExtendedString& theFileName,
     try {
       OCC_CATCH_SIGNALS
       aSchema=PCDM::Schema(SchemaName(),theApplication);
-      Extensions(theFileName, theExtensions, theApplication->MessageDriver());
-      LoadExtensions(aSchema,theExtensions, theApplication->MessageDriver());
+      Extensions(aDevice, theExtensions, theApplication->MessageDriver());
+      LoadExtensions(aSchema, theExtensions, theApplication->MessageDriver());
     } 
     catch (Standard_NoSuchObject) {
       aMsg << Standard_NoSuchObject::Caught() << endl;
@@ -95,16 +96,16 @@ void PCDM_RetrievalDriver::Read(const TCollection_ExtendedString& theFileName,
   }
 
   PCDM_BaseDriverPointer theFileDriver;
-  TCollection_AsciiString aFileNameU(theFileName);
-  if(PCDM::FileDriverType(aFileNameU, theFileDriver) == PCDM_TOFD_Unknown) {
+  //  TCollection_AsciiString aFileNameU(theFileName);
+  if(PCDM::FileDriverType(aDevice, theFileDriver) == PCDM_TOFD_Unknown) {
     myReaderStatus = PCDM_RS_UnknownFileDriver;
     return;
   }
   {
     try {
       OCC_CATCH_SIGNALS
-      RaiseIfUnknownTypes(aSchema, theFileName);
-      PCDM_ReadWriter::Open(*theFileDriver,theFileName,Storage_VSRead);
+      RaiseIfUnknownTypes(aSchema, aDevice);
+      PCDM_ReadWriter::Open(*theFileDriver, aDevice, Storage_VSRead);
     } 
     catch (Standard_TypeMismatch) {
       aMsg << Standard_TypeMismatch::Caught() << endl;
@@ -195,28 +196,29 @@ void PCDM_RetrievalDriver::Read(const TCollection_ExtendedString& theFileName,
   PCDM_DriverError_Raise_if(Failure,aMsg);
 }
 
-void PCDM_RetrievalDriver::References(const TCollection_ExtendedString& aFileName, PCDM_SequenceOfReference& theReferences, const Handle(CDM_MessageDriver)& theMsgDriver) {
+void PCDM_RetrievalDriver::References(const Handle(Storage_IODevice)& aDevice, PCDM_SequenceOfReference& theReferences, const Handle(CDM_MessageDriver)& theMsgDriver) {
 
-  PCDM_ReadWriter::Reader(aFileName)->ReadReferences(aFileName, theReferences, theMsgDriver);
+  PCDM_ReadWriter::Reader(aDevice)->ReadReferences(aDevice, theReferences, theMsgDriver);
 }
 
-void PCDM_RetrievalDriver::Extensions(const TCollection_ExtendedString& aFileName, TColStd_SequenceOfExtendedString& theExtensions,  const Handle(CDM_MessageDriver)& theMsgDriver) {
+void PCDM_RetrievalDriver::Extensions(const Handle(Storage_IODevice)& aDevice, TColStd_SequenceOfExtendedString& theExtensions,  const Handle(CDM_MessageDriver)& theMsgDriver) {
   
-  PCDM_ReadWriter::Reader(aFileName)->ReadExtensions(aFileName,theExtensions, theMsgDriver);
+  PCDM_ReadWriter::Reader(aDevice)->ReadExtensions(aDevice,theExtensions, theMsgDriver);
 }
 
+Standard_Integer PCDM_RetrievalDriver::DocumentVersion(const Handle(Storage_IODevice)& aDevice, const Handle(CDM_MessageDriver)& theMsgDriver) {
 
+  return PCDM_ReadWriter::Reader(aDevice)->ReadDocumentVersion(aDevice, theMsgDriver);
+}
 
-Standard_Integer PCDM_RetrievalDriver::DocumentVersion(const TCollection_ExtendedString& aFileName, const Handle(CDM_MessageDriver)& theMsgDriver) {
+Standard_Integer PCDM_RetrievalDriver::ReferenceCounter(const Handle(Storage_IODevice)& aDevice, const Handle(CDM_MessageDriver)& theMsgDriver) {
 
-  return PCDM_ReadWriter::Reader(aFileName)->ReadDocumentVersion(aFileName, theMsgDriver);
+  return PCDM_ReadWriter::Reader(aDevice)->ReadReferenceCounter(aDevice, theMsgDriver);
 }
-Standard_Integer PCDM_RetrievalDriver::ReferenceCounter(const TCollection_ExtendedString& aFileName, const Handle(CDM_MessageDriver)& theMsgDriver) {
 
-  return PCDM_ReadWriter::Reader(aFileName)->ReadReferenceCounter(aFileName, theMsgDriver);
+void PCDM_RetrievalDriver::LoadExtensions(const Handle(Storage_Schema)& , const TColStd_SequenceOfExtendedString& , const Handle(CDM_MessageDriver)&)
+{
 }
-void PCDM_RetrievalDriver::LoadExtensions(const Handle(Storage_Schema)& , const TColStd_SequenceOfExtendedString& ,  const Handle(CDM_MessageDriver)&) {}
-
 
 //=======================================================================
 //function : Format
index 4b902ab8126f8aaf715857f607211af048d96bb2..9196d082462f304a108cda814e82f072ffbf27d2 100644 (file)
@@ -39,6 +39,7 @@ uses
     Data from Storage,
     ExtendedString from TCollection,
     Schema from Storage,
+    IODevice from Storage,
     SequenceOfExtendedString from TColStd,
     SequenceOfDocument from PCDM,
     StoreStatus from PCDM
@@ -65,7 +66,7 @@ is
     LoadExtensions(me: mutable; aSchema: Schema from Storage; Extensions: SequenceOfExtendedString from TColStd)
     is virtual;
     
-    Write(me: mutable; aDocument: Document from CDM; aFileName: ExtendedString from TCollection)
+    Write(me: mutable; aDocument: Document from CDM; aDevice: IODevice from Storage)
     raises DriverError
     ---Purpose:  Warning! raises DriverError if an error occurs during inside the
     --          Make method.
index a72560df36533a5ebfb69be127ae7d3a1322e310..fc625c7927ff8070a1b852afcbeb670d715c9c03 100644 (file)
@@ -33,7 +33,7 @@
 
 
 
-void PCDM_StorageDriver::Write(const Handle(CDM_Document)& aDocument, const TCollection_ExtendedString&  aFileName) 
+void PCDM_StorageDriver::Write(const Handle(CDM_Document)& aDocument, const Handle(Storage_IODevice)& aDevice) 
 {
   Handle(Storage_Schema) theSchema=PCDM::Schema(SchemaName(),aDocument->Application());
 
@@ -41,7 +41,6 @@ void PCDM_StorageDriver::Write(const Handle(CDM_Document)& aDocument, const TCol
   aDocument->Extensions(theExtensions);
   LoadExtensions(theSchema,theExtensions);
 
-
   Handle(Storage_Data) theData = new Storage_Data;
 
   static Standard_Boolean Failure;
@@ -74,7 +73,7 @@ void PCDM_StorageDriver::Write(const Handle(CDM_Document)& aDocument, const TCol
 
   PCDM_ReadWriter::WriteFileFormat(theData,aDocument);
   PCDM_ReadWriter::Writer()->WriteReferenceCounter(theData,aDocument);
-  PCDM_ReadWriter::Writer()->WriteReferences(theData,aDocument,aFileName);
+  PCDM_ReadWriter::Writer()->WriteReferences(theData,aDocument,aDevice);
   PCDM_ReadWriter::Writer()->WriteExtensions(theData,aDocument);
   PCDM_ReadWriter::Writer()->WriteVersion(theData,aDocument);
 
@@ -88,7 +87,7 @@ void PCDM_StorageDriver::Write(const Handle(CDM_Document)& aDocument, const TCol
   }
 
   FSD_CmpFile theFile;
-  PCDM_ReadWriter::Open(theFile,aFileName,Storage_VSWrite);
+  PCDM_ReadWriter::Open(theFile,aDevice,Storage_VSWrite);
   theSchema->Write(theFile,theData);
   theFile.Close();
 
index 75d0330db43b90310d59900546fbd7802af5995c..605aa8ee0f3b211667e7b3f1b4eaf2977bdc2b0c 100644 (file)
 
 deferred class Writer from PCDM inherits Transient from Standard
 
-uses Document from CDM, ExtendedString from TCollection
+uses Document from CDM, ExtendedString from TCollection, IODevice from Storage
 
 raises DriverError from PCDM
 is
 
-    Write(me: mutable; aDocument: Document from CDM; aFileName: ExtendedString from TCollection)
+    Write(me: mutable; aDocument: Document from CDM; aDevice: IODevice from Storage)
     raises DriverError
     is deferred;
 
index 71ac6ccf444f88fa79117b6a04f27052f9820b7d..4879476570b5d82b2ea0902f1128a1dab6c1903c 100644 (file)
@@ -58,7 +58,11 @@ is
     
     class PatternStd;
     
-    class Shape; 
+    class Shape;
+
+    class Presentation;
+
+    class Presentation_1;
      
  
 end PDataXtd;
diff --git a/src/PDataXtd/PDataXtd_Presentation.cdl b/src/PDataXtd/PDataXtd_Presentation.cdl
new file mode 100644 (file)
index 0000000..ef7dab9
--- /dev/null
@@ -0,0 +1,54 @@
+-- Created on: 1999-07-08
+-- Created by: Sergey RUIN
+-- Copyright (c) 1999 Matra Datavision
+-- Copyright (c) 1999-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class Presentation from PDataXtd 
+    inherits Attribute from PDF
+
+       ---Purpose: 
+    
+uses    HExtendedString from PCollection
+is
+
+    Create returns Presentation from PDataXtd;
+       
+    IsDisplayed(me) returns Boolean from Standard;
+    SetDisplayed(me : mutable; B : Boolean from Standard);
+
+    SetDriverGUID(me: mutable; guid: HExtendedString from PCollection );     
+    GetDriverGUID(me) returns HExtendedString from PCollection; 
+    
+    Color(me) returns Integer from Standard;
+    SetColor(me : mutable; C : Integer from Standard);
+    
+    Transparency(me) returns Real from Standard;
+    SetTransparency(me : mutable; T : Real from Standard);    
+    
+    Material(me) returns Integer from Standard;
+    SetMaterial(me : mutable; M : Integer from Standard);    
+   
+    Width(me) returns Real from Standard;
+    SetWidth(me : mutable; W : Real from Standard);
+    
+    
+fields
+
+    myIsDisplayed         : Boolean              from Standard;
+    myDriverGUID          : HExtendedString      from PCollection; 
+    myTransparency        : Real                 from Standard;
+    myColor               : Integer              from Standard;
+    myMaterial            : Integer              from Standard;
+    myWidth               : Real                 from Standard;
+end Presentation;
diff --git a/src/PDataXtd/PDataXtd_Presentation.cxx b/src/PDataXtd/PDataXtd_Presentation.cxx
new file mode 100644 (file)
index 0000000..ccc9bf8
--- /dev/null
@@ -0,0 +1,144 @@
+// Created on: 1999-07-08
+// Created by: srn
+// Copyright (c) 1999-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <PDataXtd_Presentation.ixx>
+
+
+//=======================================================================
+//function : PDataXtd_Presentation
+//purpose  : 
+//=======================================================================
+
+PDataXtd_Presentation::PDataXtd_Presentation() :
+  myIsDisplayed(Standard_False),
+  myTransparency(0.),
+  myColor(0),
+  myMaterial(0),
+  myWidth(0.)
+{}
+
+
+//=======================================================================
+//function : SetDisplayed
+//purpose  : 
+//=======================================================================
+
+void PDataXtd_Presentation::SetDisplayed (const Standard_Boolean B)
+{
+  myIsDisplayed = B ;
+}
+
+//=======================================================================
+//function : IsDisplayed
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean PDataXtd_Presentation::IsDisplayed() const 
+{
+  return myIsDisplayed;
+}
+
+
+//=======================================================================
+//function : SetDriverGUID
+//purpose  : 
+//=======================================================================
+void PDataXtd_Presentation::SetDriverGUID( const Handle(PCollection_HExtendedString)&  guid)
+{
+  myDriverGUID = guid;
+}
+
+//=======================================================================
+//function : GetDriverGUID
+//purpose  : 
+//=======================================================================
+Handle(PCollection_HExtendedString) PDataXtd_Presentation::GetDriverGUID( void ) const
+{
+  return myDriverGUID;
+}
+
+//=======================================================================
+//function : Color
+//purpose  : 
+//=======================================================================
+Standard_Integer PDataXtd_Presentation::Color() const
+{
+  return myColor;
+}
+
+//=======================================================================
+//function : SetColor
+//purpose  : 
+//=======================================================================
+void PDataXtd_Presentation::SetColor(const Standard_Integer C) 
+{
+  myColor = C;
+}
+
+//=======================================================================
+//function : Transparency
+//purpose  : 
+//=======================================================================
+Standard_Real PDataXtd_Presentation::Transparency() const
+{
+  return myTransparency;
+}
+
+//=======================================================================
+//function : SetTransparency
+//purpose  : 
+//=======================================================================
+void PDataXtd_Presentation::SetTransparency(const Standard_Real T) 
+{
+  myTransparency = T;
+}
+
+//=======================================================================
+//function : Material
+//purpose  : 
+//=======================================================================
+Standard_Integer PDataXtd_Presentation::Material() const
+{
+  return myMaterial;
+}
+
+//=======================================================================
+//function : SetMaterial
+//purpose  : 
+//=======================================================================
+void PDataXtd_Presentation::SetMaterial(const Standard_Integer M) 
+{
+  myMaterial = M;
+}
+
+//=======================================================================
+//function : Width 
+//purpose  : 
+//=======================================================================
+Standard_Real PDataXtd_Presentation::Width() const
+{
+  return myWidth;
+}
+
+//=======================================================================
+//function : SetWidth
+//purpose  : 
+//=======================================================================
+void PDataXtd_Presentation::SetWidth(const Standard_Real W) 
+{
+  myWidth = W;
+}
+
diff --git a/src/PDataXtd/PDataXtd_Presentation_1.cdl b/src/PDataXtd/PDataXtd_Presentation_1.cdl
new file mode 100644 (file)
index 0000000..886f448
--- /dev/null
@@ -0,0 +1,56 @@
+-- Created on: 1999-07-08
+-- Created by: Sergey RUIN
+-- Copyright (c) 1999 Matra Datavision
+-- Copyright (c) 1999-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class Presentation_1 from PDataXtd 
+    inherits Attribute from PDF
+
+       ---Purpose: 
+    
+uses    HExtendedString from PCollection
+is
+
+    Create returns Presentation_1 from PDataXtd;
+       
+    IsDisplayed(me) returns Boolean from Standard;
+    SetDisplayed(me : mutable; B : Boolean from Standard);
+
+    SetDriverGUID(me: mutable; guid: HExtendedString from PCollection );     
+    GetDriverGUID(me) returns HExtendedString from PCollection; 
+    
+    Color(me) returns Integer from Standard;
+    SetColor(me : mutable; C : Integer from Standard);
+    
+    Transparency(me) returns Real from Standard;
+    SetTransparency(me : mutable; T : Real from Standard);    
+    
+    Material(me) returns Integer from Standard;
+    SetMaterial(me : mutable; M : Integer from Standard);    
+   
+    Width(me) returns Real from Standard;
+    SetWidth(me : mutable; W : Real from Standard);
+    Mode(me)    returns Integer from Standard; 
+    SetMode(me : mutable; M : Integer from Standard);    
+fields
+
+    myIsDisplayed         : Boolean              from Standard;
+    myDriverGUID          : HExtendedString      from PCollection; 
+    myTransparency        : Real                 from Standard;
+    myColor               : Integer              from Standard;
+    myMaterial            : Integer              from Standard;
+    myWidth               : Real                 from Standard; 
+    myMode                : Integer              from Standard;
+end Presentation_1;
diff --git a/src/PDataXtd/PDataXtd_Presentation_1.cxx b/src/PDataXtd/PDataXtd_Presentation_1.cxx
new file mode 100644 (file)
index 0000000..61eddfc
--- /dev/null
@@ -0,0 +1,172 @@
+// Created on: 1999-07-08
+// Created by: srn
+// Copyright (c) 1999-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <PDataXtd_Presentation_1.ixx>
+
+
+//=======================================================================
+//function : PDataXtd_Presentation_1
+//purpose  : 
+//=======================================================================
+
+PDataXtd_Presentation_1::PDataXtd_Presentation_1() :
+    myIsDisplayed(Standard_False),
+    myTransparency(0.),
+    myColor(0),
+    myMaterial(0),
+    myWidth(0.),
+    myMode(0)
+{
+}
+
+
+//=======================================================================
+//function : SetDisplayed
+//purpose  : 
+//=======================================================================
+
+void PDataXtd_Presentation_1::SetDisplayed (const Standard_Boolean B)
+{
+  myIsDisplayed = B ;
+}
+
+//=======================================================================
+//function : IsDisplayed
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean PDataXtd_Presentation_1::IsDisplayed() const 
+{
+    return myIsDisplayed;
+}
+
+
+//=======================================================================
+//function : SetDriverGUID
+//purpose  : 
+//=======================================================================
+void PDataXtd_Presentation_1::SetDriverGUID( const Handle(PCollection_HExtendedString)&  guid)
+{
+  myDriverGUID = guid;
+}
+
+//=======================================================================
+//function : GetDriverGUID
+//purpose  : 
+//=======================================================================
+Handle(PCollection_HExtendedString) PDataXtd_Presentation_1::GetDriverGUID( void ) const
+{
+  return myDriverGUID;
+}
+
+//=======================================================================
+//function : Color
+//purpose  : 
+//=======================================================================
+Standard_Integer PDataXtd_Presentation_1::Color() const
+{
+  return myColor;
+}
+
+//=======================================================================
+//function : SetColor
+//purpose  : 
+//=======================================================================
+void PDataXtd_Presentation_1::SetColor(const Standard_Integer C) 
+{
+  myColor = C;
+}
+
+//=======================================================================
+//function : Transparency
+//purpose  : 
+//=======================================================================
+Standard_Real PDataXtd_Presentation_1::Transparency() const
+{
+  return myTransparency;
+}
+
+//=======================================================================
+//function : SetTransparency
+//purpose  : 
+//=======================================================================
+void PDataXtd_Presentation_1::SetTransparency(const Standard_Real T) 
+{
+  myTransparency = T;
+}
+
+//=======================================================================
+//function : Material
+//purpose  : 
+//=======================================================================
+Standard_Integer PDataXtd_Presentation_1::Material() const
+{
+  return myMaterial;
+}
+
+//=======================================================================
+//function : SetMaterial
+//purpose  : 
+//=======================================================================
+void PDataXtd_Presentation_1::SetMaterial(const Standard_Integer M) 
+{
+   myMaterial = M;
+}
+
+//=======================================================================
+//function : Width 
+//purpose  : 
+//=======================================================================
+Standard_Real PDataXtd_Presentation_1::Width() const
+{
+  return myWidth;  
+}
+
+
+
+
+//=======================================================================
+//function : SetWidth
+//purpose  : 
+//=======================================================================
+
+void PDataXtd_Presentation_1::SetWidth(const Standard_Real W) 
+{
+  myWidth = W;
+}
+
+
+
+//=======================================================================
+//function : Mode
+//purpose  : 
+//=======================================================================
+
+Standard_Integer PDataXtd_Presentation_1::Mode() const
+{
+  return myMode;
+}
+
+
+//=======================================================================
+//function : SetMode
+//purpose  : 
+//=======================================================================
+
+void PDataXtd_Presentation_1::SetMode(const Standard_Integer M) 
+{
+   myMode = M;
+}
diff --git a/src/PPrsStd/PPrsStd.cdl b/src/PPrsStd/PPrsStd.cdl
deleted file mode 100644 (file)
index 96b26a7..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
--- Created on: 1997-08-26
--- Created by: SMO
--- Copyright (c) 1997-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-package PPrsStd
-
-uses
-
-  Standard,
-  Quantity,
-  PDF,
-  PCollection,
-  gp
-
-is
-    class AISPresentation; 
-    class AISPresentation_1;
-    --class Position; now it is in PDataStd
-    
-end PPrsStd;
-
-
diff --git a/src/PPrsStd/PPrsStd_AISPresentation.cdl b/src/PPrsStd/PPrsStd_AISPresentation.cdl
deleted file mode 100644 (file)
index 2398d29..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
--- Created on: 1999-07-08
--- Created by: Sergey RUIN
--- Copyright (c) 1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class AISPresentation from PPrsStd 
-    inherits Attribute from PDF
-
-       ---Purpose: 
-    
-uses    HExtendedString from PCollection
-is
-
-    Create returns AISPresentation from PPrsStd;
-       
-    IsDisplayed(me) returns Boolean from Standard;
-    SetDisplayed(me : mutable; B : Boolean from Standard);
-
-    SetDriverGUID(me: mutable; guid: HExtendedString from PCollection );     
-    GetDriverGUID(me) returns HExtendedString from PCollection; 
-    
-    Color(me) returns Integer from Standard;
-    SetColor(me : mutable; C : Integer from Standard);
-    
-    Transparency(me) returns Real from Standard;
-    SetTransparency(me : mutable; T : Real from Standard);    
-    
-    Material(me) returns Integer from Standard;
-    SetMaterial(me : mutable; M : Integer from Standard);    
-   
-    Width(me) returns Real from Standard;
-    SetWidth(me : mutable; W : Real from Standard);
-    
-    
-fields
-
-    myIsDisplayed         : Boolean              from Standard;
-    myDriverGUID          : HExtendedString      from PCollection; 
-    myTransparency        : Real                 from Standard;
-    myColor               : Integer              from Standard;
-    myMaterial            : Integer              from Standard;
-    myWidth               : Real                 from Standard;
-end AISPresentation;
diff --git a/src/PPrsStd/PPrsStd_AISPresentation.cxx b/src/PPrsStd/PPrsStd_AISPresentation.cxx
deleted file mode 100644 (file)
index 9b6865d..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-// Created on: 1999-07-08
-// Created by: srn
-// Copyright (c) 1999-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <PPrsStd_AISPresentation.ixx>
-
-
-//=======================================================================
-//function : PPrsStd_AISPresentation
-//purpose  : 
-//=======================================================================
-
-PPrsStd_AISPresentation::PPrsStd_AISPresentation() :
-    myIsDisplayed(Standard_False),
-    myTransparency(0.),
-    myColor(0),
-    myMaterial(0),
-    myWidth(0.)
-{}
-
-
-//=======================================================================
-//function : SetDisplayed
-//purpose  : 
-//=======================================================================
-
-void PPrsStd_AISPresentation::SetDisplayed (const Standard_Boolean B)       
-{
-  myIsDisplayed = B ;
-}
-
-//=======================================================================
-//function : IsDisplayed
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean PPrsStd_AISPresentation::IsDisplayed() const 
-{
-    return myIsDisplayed;
-}
-
-
-//=======================================================================
-//function : SetDriverGUID
-//purpose  : 
-//=======================================================================
-void PPrsStd_AISPresentation::SetDriverGUID( const Handle(PCollection_HExtendedString)&  guid)
-{
-  myDriverGUID = guid;
-}
-
-//=======================================================================
-//function : GetDriverGUID
-//purpose  : 
-//=======================================================================
-Handle(PCollection_HExtendedString) PPrsStd_AISPresentation::GetDriverGUID( void ) const
-{
-  return myDriverGUID;
-}
-
-//=======================================================================
-//function : Color
-//purpose  : 
-//=======================================================================
-Standard_Integer PPrsStd_AISPresentation::Color() const
-{
-  return myColor;
-}
-
-//=======================================================================
-//function : SetColor
-//purpose  : 
-//=======================================================================
-void PPrsStd_AISPresentation::SetColor(const Standard_Integer C) 
-{
-  myColor = C;
-}
-
-//=======================================================================
-//function : Transparency
-//purpose  : 
-//=======================================================================
-Standard_Real PPrsStd_AISPresentation::Transparency() const
-{
-  return myTransparency;
-}
-
-//=======================================================================
-//function : SetTransparency
-//purpose  : 
-//=======================================================================
-void PPrsStd_AISPresentation::SetTransparency(const Standard_Real T) 
-{
-  myTransparency = T;
-}
-
-//=======================================================================
-//function : Material
-//purpose  : 
-//=======================================================================
-Standard_Integer PPrsStd_AISPresentation::Material() const
-{
-  return myMaterial;
-}
-
-//=======================================================================
-//function : SetMaterial
-//purpose  : 
-//=======================================================================
-void PPrsStd_AISPresentation::SetMaterial(const Standard_Integer M) 
-{
-   myMaterial = M;
-}
-
-//=======================================================================
-//function : Width 
-//purpose  : 
-//=======================================================================
-Standard_Real PPrsStd_AISPresentation::Width() const
-{
-  return myWidth;  
-}
-
-//=======================================================================
-//function : SetWidth
-//purpose  : 
-//=======================================================================
-void PPrsStd_AISPresentation::SetWidth(const Standard_Real W) 
-{
-  myWidth = W;
-}
-
diff --git a/src/PPrsStd/PPrsStd_AISPresentation_1.cdl b/src/PPrsStd/PPrsStd_AISPresentation_1.cdl
deleted file mode 100644 (file)
index 329552b..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
--- Created on: 1999-07-08
--- Created by: Sergey RUIN
--- Copyright (c) 1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class AISPresentation_1 from PPrsStd 
-    inherits Attribute from PDF
-
-       ---Purpose: 
-    
-uses    HExtendedString from PCollection
-is
-
-    Create returns AISPresentation_1 from PPrsStd;
-       
-    IsDisplayed(me) returns Boolean from Standard;
-    SetDisplayed(me : mutable; B : Boolean from Standard);
-
-    SetDriverGUID(me: mutable; guid: HExtendedString from PCollection );     
-    GetDriverGUID(me) returns HExtendedString from PCollection; 
-    
-    Color(me) returns Integer from Standard;
-    SetColor(me : mutable; C : Integer from Standard);
-    
-    Transparency(me) returns Real from Standard;
-    SetTransparency(me : mutable; T : Real from Standard);    
-    
-    Material(me) returns Integer from Standard;
-    SetMaterial(me : mutable; M : Integer from Standard);    
-   
-    Width(me) returns Real from Standard;
-    SetWidth(me : mutable; W : Real from Standard);
-    Mode(me)    returns Integer from Standard; 
-    SetMode(me : mutable; M : Integer from Standard);    
-fields
-
-    myIsDisplayed         : Boolean              from Standard;
-    myDriverGUID          : HExtendedString      from PCollection; 
-    myTransparency        : Real                 from Standard;
-    myColor               : Integer              from Standard;
-    myMaterial            : Integer              from Standard;
-    myWidth               : Real                 from Standard; 
-    myMode                : Integer              from Standard;
-end AISPresentation_1;
diff --git a/src/PPrsStd/PPrsStd_AISPresentation_1.cxx b/src/PPrsStd/PPrsStd_AISPresentation_1.cxx
deleted file mode 100644 (file)
index 1001cf0..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-// Created on: 1999-07-08
-// Created by: srn
-// Copyright (c) 1999-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <PPrsStd_AISPresentation_1.ixx>
-
-
-//=======================================================================
-//function : PPrsStd_AISPresentation
-//purpose  : 
-//=======================================================================
-
-PPrsStd_AISPresentation_1::PPrsStd_AISPresentation_1() :
-    myIsDisplayed(Standard_False),
-    myTransparency(0.),
-    myColor(0),
-    myMaterial(0),
-    myWidth(0.),
-    myMode(0)
-{
-}
-
-
-//=======================================================================
-//function : SetDisplayed
-//purpose  : 
-//=======================================================================
-
-void PPrsStd_AISPresentation_1::SetDisplayed (const Standard_Boolean B)       
-{
-  myIsDisplayed = B ;
-}
-
-//=======================================================================
-//function : IsDisplayed
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean PPrsStd_AISPresentation_1::IsDisplayed() const 
-{
-    return myIsDisplayed;
-}
-
-
-//=======================================================================
-//function : SetDriverGUID
-//purpose  : 
-//=======================================================================
-void PPrsStd_AISPresentation_1::SetDriverGUID( const Handle(PCollection_HExtendedString)&  guid)
-{
-  myDriverGUID = guid;
-}
-
-//=======================================================================
-//function : GetDriverGUID
-//purpose  : 
-//=======================================================================
-Handle(PCollection_HExtendedString) PPrsStd_AISPresentation_1::GetDriverGUID( void ) const
-{
-  return myDriverGUID;
-}
-
-//=======================================================================
-//function : Color
-//purpose  : 
-//=======================================================================
-Standard_Integer PPrsStd_AISPresentation_1::Color() const
-{
-  return myColor;
-}
-
-//=======================================================================
-//function : SetColor
-//purpose  : 
-//=======================================================================
-void PPrsStd_AISPresentation_1::SetColor(const Standard_Integer C) 
-{
-  myColor = C;
-}
-
-//=======================================================================
-//function : Transparency
-//purpose  : 
-//=======================================================================
-Standard_Real PPrsStd_AISPresentation_1::Transparency() const
-{
-  return myTransparency;
-}
-
-//=======================================================================
-//function : SetTransparency
-//purpose  : 
-//=======================================================================
-void PPrsStd_AISPresentation_1::SetTransparency(const Standard_Real T) 
-{
-  myTransparency = T;
-}
-
-//=======================================================================
-//function : Material
-//purpose  : 
-//=======================================================================
-Standard_Integer PPrsStd_AISPresentation_1::Material() const
-{
-  return myMaterial;
-}
-
-//=======================================================================
-//function : SetMaterial
-//purpose  : 
-//=======================================================================
-void PPrsStd_AISPresentation_1::SetMaterial(const Standard_Integer M) 
-{
-   myMaterial = M;
-}
-
-//=======================================================================
-//function : Width 
-//purpose  : 
-//=======================================================================
-Standard_Real PPrsStd_AISPresentation_1::Width() const
-{
-  return myWidth;  
-}
-
-
-
-
-//=======================================================================
-//function : SetWidth
-//purpose  : 
-//=======================================================================
-
-void PPrsStd_AISPresentation_1::SetWidth(const Standard_Real W) 
-{
-  myWidth = W;
-}
-
-
-
-//=======================================================================
-//function : Mode
-//purpose  : 
-//=======================================================================
-
-Standard_Integer PPrsStd_AISPresentation_1::Mode() const
-{
-  return myMode;
-}
-
-
-//=======================================================================
-//function : SetMode
-//purpose  : 
-//=======================================================================
-
-void PPrsStd_AISPresentation_1::SetMode(const Standard_Integer M) 
-{
-   myMode = M;
-}
index 31b2467c5d529914608211842d97190e70deec8f..4d6d60a9c107a4f97e82b5ed62d2d3084522a879 100644 (file)
@@ -822,7 +822,7 @@ static Standard_Integer OCC381_SaveAs (Draw_Interpretor& di, Standard_Integer nb
   if (!DDocStd::Find(A)) return 1;
 
   TCollection_ExtendedString theStatusMessage;
-  PCDM_StoreStatus theStatus = A->SaveAs(D,path, theStatusMessage);
+  PCDM_StoreStatus theStatus = PCDM_SS_Failure; //A->SaveAs(D,path, theStatusMessage);
   if (theStatus != PCDM_SS_OK ) {
     switch ( theStatus ) {
       case PCDM_SS_DriverFailure: {
index 02f24518edf42dca880e4e4c220c315adfa4d1be..13387799aba2de1846ada5ec6e80ec17704fbef2 100755 (executable)
@@ -2145,7 +2145,7 @@ static Standard_Integer OCC24565 (Draw_Interpretor& di, Standard_Integer argc, c
   printf("%s: Going to write %d surfaces.\n",__FUNCTION__,max_i+1);
 
   FSD_File f_write;
-  if(f_write.Open(sFileNameSTOR, Storage_VSWrite)!=Storage_VSOk)
+  if(true)//f_write.Open(sFileNameSTOR, Storage_VSWrite)!=Storage_VSOk)
     {
       printf("%s: Error opening file: %s\n", __FUNCTION__,sFileNameSTOR);
       return -1;
@@ -2160,7 +2160,7 @@ static Standard_Integer OCC24565 (Draw_Interpretor& di, Standard_Integer argc, c
    *
    * * * * * * */
   FSD_File f_read;
-  if(f_read.Open(sFileNameSTOR, Storage_VSRead)!=Storage_VSOk)
+  if(true)//f_read.Open(sFileNameSTOR, Storage_VSRead)!=Storage_VSOk)
     {
       printf("%s: Error opening file: %s\n", __FUNCTION__,sFileNameSTOR);
       return -1;
index 61185c354c56f9211faabdf6a809f8941b278627..e32f90d6cba95f1fe5a5a04901bea551ed02a568 100755 (executable)
@@ -28,14 +28,17 @@ Standard_ExtCharacter.hxx
 Standard_ExtString.cxx
 Standard_ExtString.hxx
 Standard_HashCode.cxx
-Standard_IStream.hxx
 Standard_Integer.hxx
 Standard_Macro.hxx
-Standard_OStream.hxx
 Standard_Persistent_proto.hxx
 Standard_PrimitiveTypes.hxx
 Standard_Real.cxx
 Standard_Real.hxx
+Standard_IStream.hxx
+Standard_IStreamPtr.hxx
+Standard_OStream.hxx
+Standard_OStreamPtr.hxx
+Standard_FStream.hxx
 Standard_SStream.cxx
 Standard_SStream.hxx
 Standard_ShortReal.cxx
index 311f32dec68d227f4ae7fcb71edb9fae511df501..b1a6401615a52450c977860ec6ef34d86fa3820c 100644 (file)
@@ -49,8 +49,12 @@ is
     enumeration HandlerStatus is HandlerVoid, HandlerJumped, HandlerProcessed;
 
     imported IStream;
+    imported IStreamPtr;
     imported OStream;
+    imported OStreamPtr;
     imported SStream;
+    imported FStream;
+
     imported UUID;
     imported JmpBuf;
     imported ThreadId;
diff --git a/src/Standard/Standard_FStream.hxx b/src/Standard/Standard_FStream.hxx
new file mode 100644 (file)
index 0000000..5b10262
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright (c) 1998-1999 Matra Datavision
+// Copyright (c) 1999-2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef Standard_FStream_HeaderFile
+#define Standard_FStream_HeaderFile
+
+#include <Standard_Macro.hxx>
+#include <Standard_Stream.hxx>
+
+typedef std::fstream Standard_FStream;
+
+#endif
diff --git a/src/Standard/Standard_IStreamPtr.hxx b/src/Standard/Standard_IStreamPtr.hxx
new file mode 100644 (file)
index 0000000..b86ee86
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright (c) 1998-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef Standard_IStreamPtr_HeaderFile
+#define Standard_IStreamPtr_HeaderFile
+
+#include <Standard_TypeDef.hxx>
+#include <Standard_Stream.hxx>
+
+typedef std::istream* Standard_IStreamPtr;
+
+#endif
+
+
diff --git a/src/Standard/Standard_OStreamPtr.hxx b/src/Standard/Standard_OStreamPtr.hxx
new file mode 100644 (file)
index 0000000..dcc56b1
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright (c) 1998-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef Standard_OStreamPtr_HeaderFile
+#define Standard_OStreamPtr_HeaderFile
+
+#include <Standard_TypeDef.hxx>
+#include <Standard_Stream.hxx>
+
+typedef std::ostream* Standard_OStreamPtr;
+
+#endif
+
+
index 331e7250481283a9f83c1305f03d98f513790b86..2f6c72ead8f9ef0a95af1576d9a05aab3f326d68 100644 (file)
@@ -22,7 +22,6 @@
 #include <MNaming.hxx>  
 #include <MDocStd.hxx> 
 #include <MFunction.hxx>
-#include <MPrsStd.hxx>
 #include <CDM_MessageDriver.hxx>
 //=======================================================================
 //function : PAppStd_DocumentRetrievalDriver
@@ -47,7 +46,6 @@ Handle(MDF_ARDriverTable) StdDrivers_DocumentRetrievalDriver::AttributeDrivers(c
   MDocStd::AddRetrievalDrivers(HARSeq, theMsgDriver);
   MFunction::AddRetrievalDrivers(HARSeq, theMsgDriver);
   MNaming::AddRetrievalDrivers(HARSeq, theMsgDriver); 
-  MPrsStd::AddRetrievalDrivers(HARSeq, theMsgDriver); 
  
   //
   aRetrievalTable->SetDrivers(HARSeq);
index 6511faa1dfaddb9213fa717cfcf781db83644e9b..62b5a5a84de8d448695c3a2d071bc7b9e3407c34 100644 (file)
@@ -19,7 +19,6 @@
 #include <MDataXtd.hxx>
 #include <MNaming.hxx>  
 #include <MDocStd.hxx> 
-#include <MPrsStd.hxx>
 #include <MFunction.hxx>
 
 #include <TNaming_Tool.hxx>
@@ -58,7 +57,6 @@ Handle(MDF_ASDriverTable) StdDrivers_DocumentStorageDriver::AttributeDrivers(con
   MDocStd::AddStorageDrivers(HASSeq, theMsgDriver); 
   MFunction::AddStorageDrivers(HASSeq, theMsgDriver);
   MNaming::AddStorageDrivers(HASSeq, theMsgDriver);
-  MPrsStd::AddStorageDrivers(HASSeq, theMsgDriver);
   //
   aStorageTable->SetDrivers(HASSeq);
   return aStorageTable;
index fc780b1af5d4a5ce483755005dfa7dfaa48b3393..e8dab7f0beb839e7c8b0104b607cf7ba3326aad3 100644 (file)
@@ -18,7 +18,6 @@ schema StdSchema
 is
     package PDataXtd;
     package PNaming;    
-    package PPrsStd;
     
 end StdSchema;
 
index cdb172530bea3b49cec0fb517f02e21f37ed6c57..4cc6c93354a5bf495e7a2ccd2aef8ff196919c8f 100644 (file)
@@ -86,12 +86,20 @@ is
        -- -   Storage_VSInternalError : an internal error  has been detected
        -- -   Storage_VSExtCharParityError : an error
        --   has occurred while reading 16 bit characte   
+
+    enumeration SeekMode
+    is
+        SMBegin,
+       SMCur,
+       SMEnd
+    end;
+
     enumeration OpenMode
     is
         VSNone,
        VSRead,
        VSWrite,
+       VSAppend,
        VSReadWrite
     end;
        ---Purpose:
@@ -117,6 +125,11 @@ is
     
     deferred class BaseDriver;
 
+    deferred class IODevice;
+      class File;
+      class OStream;
+      class IStream;
+
     deferred class CallBack;
       class DefaultCallBack;
          
index 3afdfbcd25d60e2483db6944101aec1d0cc86774..eb8222561139b485a02cf6f507e76bea1121067a 100644 (file)
@@ -24,6 +24,7 @@ uses Position    from Storage,
      AsciiString from TCollection,
      OpenMode    from Storage,
      Error       from Storage,
+     IODevice    from Storage,
      ExtendedString from TCollection,
      SequenceOfAsciiString from TColStd,
      SequenceOfExtendedString from TColStd
@@ -39,9 +40,10 @@ is
 
     Initialize;
     
-    Open(me : in out; aName : AsciiString from TCollection; aMode : OpenMode from Storage) returns Error from Storage is deferred;
+    Open(me : in out; aDevice : IODevice from Storage; aMode : OpenMode from Storage)
+    returns Error from Storage is deferred;
 
-    Name(me) returns AsciiString from TCollection
+    Device(me) returns IODevice from Storage
     ---C++: inline
         
     OpenMode(me) returns OpenMode from Storage;
@@ -53,7 +55,6 @@ is
     Tell( me : in out ) returns Position from Storage is deferred;
         ---Purpose: return position in the file. Return -1 upon error.
     
-    
     -- INFO SECTION
     -- write
     -- 
@@ -354,14 +355,14 @@ is
 
     -- PROTECTED
 
-    SetName(me : in out; aName : AsciiString from TCollection) is protected;
-    ---C++: inline
-    
-    SetOpenMode(me : in out; aMode : OpenMode from Storage) is protected;
+    SetDevice(me : in out; aDevice : IODevice from Storage) is protected;
     ---C++: inline
     
-    fields
+--    SetOpenMode(me : in out; aMode : OpenMode from Storage) is protected;
+--    ---C++: inline
     
-       myOpenMode : OpenMode from Storage;
-       myName     : AsciiString from TCollection;
+fields
+
+--     myOpenMode : OpenMode from Storage;
+       myDevice   : IODevice from Storage;
 end;
index cab37b035cb3cb4c6dc85fad1a81145b8c8797f5..81b3f3a9841c2c697393d31bdc5b85cb069093a0 100644 (file)
 
 #include <Storage_BaseDriver.ixx>
 
-Storage_BaseDriver::Storage_BaseDriver() : myOpenMode(Storage_VSNone)
+Storage_BaseDriver::Storage_BaseDriver()
 {
 }
-void Storage_BaseDriver::Delete()
-{}
 
+void Storage_BaseDriver::Delete()
+{
+}
index 4bdbc4f698ec8891b35ec587895e8a93ae3f30e4..60563a630717d901f2102d954f284a7ffffdcb7c 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-inline TCollection_AsciiString Storage_BaseDriver::Name() const
-{
-  return myName;
-}
+#include <Storage_IODevice.hxx>
 
-inline Storage_OpenMode Storage_BaseDriver::OpenMode() const
+inline Handle(Storage_IODevice) Storage_BaseDriver::Device() const
 {
-  return myOpenMode;
+  return myDevice;
 }
 
-inline void Storage_BaseDriver::SetName(const TCollection_AsciiString& aName)
+inline Storage_OpenMode Storage_BaseDriver::OpenMode() const
 {
-  myName = aName;
+  Storage_OpenMode aMode = Storage_VSNone;
+  if ( !Device().IsNull() )
+    aMode = Device()->OpenMode();
+  return aMode;
 }
 
-inline void Storage_BaseDriver::SetOpenMode(const Storage_OpenMode aMode)
+inline void Storage_BaseDriver::SetDevice( const Handle(Storage_IODevice)& theDevice )
 {
-  myOpenMode = aMode;
+  myDevice = theDevice;
 }
-
diff --git a/src/Storage/Storage_File.cdl b/src/Storage/Storage_File.cdl
new file mode 100644 (file)
index 0000000..b45a5fa
--- /dev/null
@@ -0,0 +1,75 @@
+-- Created on: 2015-05-20
+-- Created by: 
+-- Copyright (c) 2015 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class File from Storage inherits IODevice from Storage
+       ---Purpose: Store/Retrieve a data to/from a file
+
+uses Position    from Storage,
+     AsciiString from TCollection,
+     OpenMode    from Storage,
+     SeekMode    from Storage,
+     Error       from Storage,
+     FStream     from Standard,
+     ExtendedString from TCollection
+
+raises StreamTypeMismatchError from Storage,
+       StreamFormatError from Storage,
+       StreamWriteError from Storage,
+       StreamExtCharParityError from Storage
+       
+is
+    Create (theFilePath: ExtendedString from TCollection) returns File from Storage;
+
+    Delete (me: mutable) is redefined;
+
+    Path (me) returns ExtendedString from TCollection;
+
+    Name (me) returns ExtendedString from TCollection is redefined;
+
+    Open (me: mutable; theMode: OpenMode from Storage ) returns Error from Storage;
+    
+    IsEnd (me) returns Boolean from Standard;
+    ---Purpose: returns True if the end of the device data has been reached.
+
+    Tell (me: mutable) returns Position from Storage is redefined;
+    ---Purpose: returns a position in the device. Return -1 upon error.
+
+    Seek( me: mutable; aPos : Position from Storage; aMode: SeekMode from Storage = Storage_SMBegin )
+    returns Boolean from Standard is redefined;
+   
+    Close (me: mutable) returns Boolean from Standard;
+
+    CanRead (me) returns Boolean from Standard;
+
+    CanWrite (me) returns Boolean from Standard;
+
+    Read (me: mutable; theBuffer: Address from Standard; theSize: Size from Standard)
+    returns Size from Standard;
+
+    Write (me: mutable; theBuffer: Address from Standard; theSize: Size from Standard)
+    returns Size from Standard;
+
+    Signature (me) returns AsciiString from TCollection;
+   
+    Print (me; theOStream: in out OStream from Standard)
+    returns OStream from Standard is redefined;
+    ---C++: return &
+
+fields
+
+    myStream   : FStream from Standard;
+    myFilePath : ExtendedString from TCollection;
+
+end;
diff --git a/src/Storage/Storage_File.cxx b/src/Storage/Storage_File.cxx
new file mode 100644 (file)
index 0000000..5e8cdcb
--- /dev/null
@@ -0,0 +1,233 @@
+// File:      Storage_File.cxx
+// Created:   20.05.15
+// Author:    
+// Copyright: Open CASCADE 2015
+
+#include <Storage_File.ixx>
+
+#include <TDocStd_PathParser.hxx>
+
+#include <TCollection_AsciiString.hxx>
+
+//=======================================================================
+//function : Storage_File
+//purpose  : Constructor
+//=======================================================================
+Storage_File::Storage_File( const TCollection_ExtendedString& theFilePath )
+  : Storage_IODevice(),
+    myFilePath( theFilePath )
+{
+}
+
+//=======================================================================
+//function : Delete
+//purpose  : 
+//=======================================================================
+void Storage_File::Delete()
+{
+}
+
+//=======================================================================
+//function : Path
+//purpose  : 
+//=======================================================================
+TCollection_ExtendedString Storage_File::Path() const
+{
+  return myFilePath;
+}
+
+//=======================================================================
+//function : Name
+//purpose  : 
+//=======================================================================
+TCollection_ExtendedString Storage_File::Name() const
+{
+  Standard_Integer aPos = -1;
+  TCollection_ExtendedString name;
+  TCollection_ExtendedString temp = myFilePath;
+#ifdef WNT
+  aPos = temp.SearchFromEnd( TCollection_ExtendedString( "\\" ) );
+  if ( !( aPos > 0 ) )
+#endif
+    aPos = temp.SearchFromEnd( TCollection_ExtendedString( "/" ) );
+  if ( aPos >0 ) 
+    name = temp.Split( aPos );
+  else
+    name = temp;
+
+  return name;
+}
+
+//=======================================================================
+//function : Open
+//purpose  : 
+//=======================================================================
+Storage_Error Storage_File::Open (const Storage_OpenMode theMode)
+{
+  Storage_Error anOpenResult = Storage_VSOk;
+  
+  #ifdef _WIN32
+    // file name is treated as UTF-8 string and converted to UTF-16 one
+  const TCollection_ExtendedString aPath( Path() );
+  const wchar_t* aFilePath = (const wchar_t*)aPath.ToExtString();
+  #else
+  const TCollection_AsciiString aPath( Path() );
+  const Standard_CString aFilePath = aPath.ToCString();
+  #endif
+  
+  if (OpenMode() == Storage_VSNone)
+  {
+    if (theMode == Storage_VSRead)
+    {
+      myStream.open( aFilePath, ios::in | ios::binary );
+    }
+    else if (theMode == Storage_VSWrite)
+    {
+      myStream.open( aFilePath, ios::out | ios::binary );
+    }
+    else if (theMode == Storage_VSAppend)
+    {
+      myStream.open( aFilePath, ios::in | ios::out | ios::binary | ios::ate );
+    }
+    else if (theMode == Storage_VSReadWrite)
+    {
+      myStream.open( aFilePath, ios::in | ios::out | ios::binary );
+    }
+    
+    if (!myStream.rdbuf()->is_open()) {
+      anOpenResult = Storage_VSOpenError;
+    }
+    else
+    {
+      SetOpenMode (theMode);
+    }
+  }
+  else
+  {
+    anOpenResult = Storage_VSAlreadyOpen;
+  }
+
+  return anOpenResult;
+}
+
+//=======================================================================
+//function : IsEnd
+//purpose  : 
+//=======================================================================
+Standard_Boolean Storage_File::IsEnd() const
+{
+  return myStream.eof();
+}
+
+//=======================================================================
+//function : Tell
+//purpose  : 
+//=======================================================================
+Storage_Position Storage_File::Tell()
+{
+  return Storage_Position( OpenMode() == Storage_VSRead ? myStream.tellg() : myStream.tellp() );
+}
+
+//=======================================================================
+//function : Seek
+//purpose  : 
+//=======================================================================
+Standard_Boolean Storage_File::Seek (const Storage_Position& thePos, const Storage_SeekMode aMode)
+{
+  ios::seekdir dir = ios::beg;
+  switch ( aMode )
+  {
+  case Storage_SMEnd:
+    dir = ios::end;
+    break;
+  case Storage_SMCur:
+    dir = ios::cur;
+    break;
+  case Storage_SMBegin:
+  default:
+    dir = ios::beg;
+    break;
+  }
+
+  if ( OpenMode() == Storage_VSRead )
+    myStream.seekg( thePos, dir );
+  else
+    myStream.seekp( thePos, dir );
+
+  return !myStream.fail();
+}
+
+//=======================================================================
+//function : Close
+//purpose  : 
+//=======================================================================
+Standard_Boolean Storage_File::Close()
+{
+  myStream.close();
+
+  SetOpenMode( Storage_VSNone );
+
+  return Standard_True;
+}
+
+//=======================================================================
+//function : CanRead
+//purpose  : 
+//=======================================================================
+Standard_Boolean Storage_File::CanRead() const
+{
+  return myStream.good() && ( OpenMode() == Storage_VSRead || OpenMode() == Storage_VSReadWrite );
+}
+
+//=======================================================================
+//function : CanWrite
+//purpose  : 
+//=======================================================================
+Standard_Boolean Storage_File::CanWrite() const
+{
+  return myStream.good() && ( OpenMode() == Storage_VSWrite || OpenMode() == Storage_VSAppend || OpenMode() == Storage_VSReadWrite );
+}
+
+//=======================================================================
+//function : Read
+//purpose  : 
+//=======================================================================
+Standard_Size Storage_File::Read( const Standard_Address theBuffer, const Standard_Size theSize )
+{
+  myStream.read((char*)theBuffer, theSize);
+
+  return (Standard_Size)myStream.gcount();
+}
+
+//=======================================================================
+//function : Write
+//purpose  : 
+//=======================================================================
+Standard_Size Storage_File::Write (const Standard_Address theBuffer, const Standard_Size theSize)
+{ 
+  Storage_Position aPosBefore = Tell();
+  
+  myStream.write ((char*)theBuffer, theSize);
+  
+  Storage_Position aPosAfter = Tell();
+
+  return aPosAfter - aPosBefore;
+}
+
+//=======================================================================
+//function : Signature
+//purpose  : 
+//=======================================================================
+TCollection_AsciiString Storage_File::Signature() const
+{
+  return myFilePath;
+}
+
+//=======================================================================
+//function : Print
+//purpose  : 
+//=======================================================================
+Standard_OStream& Storage_File::Print (Standard_OStream& theOStream) const
+{
+  return theOStream;
+}
diff --git a/src/Storage/Storage_IODevice.cdl b/src/Storage/Storage_IODevice.cdl
new file mode 100644 (file)
index 0000000..52ad5a4
--- /dev/null
@@ -0,0 +1,103 @@
+-- Created on: 2015-05-18
+-- Created by: Sergey TELKOV
+-- Copyright (c) 2015 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+deferred class IODevice from Storage inherits TShared from MMgt
+       ---Purpose: Root any input output devices. A device define a way
+       -- to store or retrieve a data, for instance a file.
+
+uses Position    from Storage,
+     AsciiString from TCollection,
+     OpenMode    from Storage,
+     Error       from Storage,
+     SeekMode    from Storage,
+     ExtendedString from TCollection,
+     SequenceOfAsciiString from TColStd,
+     SequenceOfExtendedString from TColStd
+     
+raises StreamTypeMismatchError from Storage,
+       StreamFormatError from Storage,
+       StreamWriteError from Storage,
+       StreamExtCharParityError from Storage
+       
+is
+    Initialize;
+
+    Delete( me : mutable ) is redefined;
+
+    Name( me ) returns ExtendedString from TCollection is deferred;
+
+    Open( me : mutable; aMode: OpenMode from Storage ) returns Error from Storage is deferred;
+
+    OpenMode( me ) returns OpenMode from Storage;
+    ---C++: inline
+
+    IsEnd( me ) returns Boolean from Standard is deferred;
+    ---Purpose: returns True if we are at end of the device data.
+
+    Tell( me : mutable ) returns Position from Storage is deferred;
+    ---Purpose: return position in the device. Return -1 upon error.
+
+    Seek( me: mutable; aPos : Position from Storage; aMode: SeekMode from Storage = Storage_SMBegin )
+    returns Boolean from Standard is deferred;
+    ---Purpose: Set new absolute position within the stream
+   
+    Close(me : mutable) returns Boolean from Standard is deferred;
+
+    CanRead(me) returns Boolean from Standard is deferred;
+
+    CanWrite(me) returns Boolean from Standard is deferred;
+
+    Read(me: mutable; aBuffer : Address from Standard;
+                      aSize : Size from Standard)
+    returns Size from Standard is deferred;
+
+    Write(me: mutable; aBuffer : Address from Standard;
+                       aSize : Size from Standard)
+    returns Size from Standard is deferred;
+
+    Signature(me) returns AsciiString from TCollection is deferred;
+
+    Print(me; anOStream:  in out OStream from Standard)
+    returns OStream from Standard is virtual;
+    ---C++: return &
+    ---C++: alias operator <<
+
+    -- SERVICE
+
+    ReadLine(me: mutable; aBuffer : in out CString from Standard; 
+                aSize : Integer from Standard;
+                anEndSymbol: Character from Standard);
+
+    ReadLine(me: mutable; anEndSymbol: Character from Standard ) returns AsciiString from TCollection;
+
+
+    WriteLine(me: mutable; aLine : CString from Standard);
+
+    WriteLine(me: mutable; aLine : CString from Standard; anEndSymbol: Character from Standard);
+
+    WriteLine(me: mutable; aLine : AsciiString from TCollection);
+
+    WriteLine(me: mutable; aLine : AsciiString from TCollection; anEndSymbol: Character from Standard);
+
+    -- PROTECTED
+
+    SetOpenMode(me : mutable; aMode : OpenMode from Storage) is protected;
+    ---C++: inline
+    
+fields
+
+    myOpenMode : OpenMode from Storage;
+
+end;
diff --git a/src/Storage/Storage_IODevice.cxx b/src/Storage/Storage_IODevice.cxx
new file mode 100644 (file)
index 0000000..6f48f52
--- /dev/null
@@ -0,0 +1,90 @@
+// File:      Storage_IODevice.cxx
+// Created:   18.05.15 12:41:53
+// Author:    stv@NETEX
+// Copyright: Open CASCADE 2015
+
+#include <Storage_IODevice.ixx>
+
+//=======================================================================
+//function : Storage_IODevice
+//purpose  : Constructor
+//=======================================================================
+
+Storage_IODevice::Storage_IODevice()
+: myOpenMode(Storage_VSNone)
+{
+}
+
+void Storage_IODevice::Delete()
+{
+}
+  
+void Storage_IODevice::SetOpenMode( const Storage_OpenMode aMode )
+{
+  myOpenMode = aMode;
+}
+
+Standard_OStream& Storage_IODevice::Print( Standard_OStream& anOStream ) const
+{
+    return anOStream;
+}
+
+void Storage_IODevice::ReadLine( Standard_CString& aBuffer, const Standard_Integer aSize, const Standard_Character anEndSymbol )
+{
+  Standard_Integer i = 0;
+  Standard_Boolean aFin = Standard_False;
+  Standard_Character* aBuf = (Standard_Character*)aBuffer;
+  while ( CanRead() && !IsEnd() && i < aSize && !aFin )
+  {
+    Standard_Character c;
+    Read( (Standard_Address)&c, sizeof( Standard_Character ) );
+    aFin = ( c == anEndSymbol );
+    if ( aFin )
+      aBuf[i++] = '\0';
+    else
+      aBuf[i++] = c;
+  }
+}
+  
+TCollection_AsciiString Storage_IODevice::ReadLine( const Standard_Character anEndSymbol )
+{
+  TCollection_AsciiString aLine;
+  Standard_Boolean aFin = Standard_False;
+  while ( CanRead() && !IsEnd() && !aFin )
+  {
+    Standard_Character c;
+    Read( (Standard_Address)&c, sizeof( Standard_Character ) );
+    aFin = ( c == anEndSymbol );
+    if ( !aFin )
+      aLine += c;
+  }
+  return aLine;
+}
+
+void Storage_IODevice::WriteLine( const Standard_CString aLine )
+{
+  WriteLine( aLine, '\n' );
+}
+
+void Storage_IODevice::WriteLine( const TCollection_AsciiString& aLine )
+{
+  WriteLine( aLine, '\n' );
+}
+
+void Storage_IODevice::WriteLine( const Standard_CString aLine, const Standard_Character anEndSymbol )
+{
+  if ( !CanWrite() )
+    return;
+
+  Write( (Standard_Address)aLine, strlen( aLine ) );
+  Write( (Standard_Address)&anEndSymbol, sizeof( Standard_Character ) );
+}
+  
+void Storage_IODevice::WriteLine( const TCollection_AsciiString& aLine, const Standard_Character anEndSymbol )
+{
+  if ( !CanWrite() )
+    return;
+
+  Write( (Standard_Address)aLine.ToCString(), aLine.Length() );
+  Write( (Standard_Address)&anEndSymbol, sizeof( Standard_Character ) );
+}
diff --git a/src/Storage/Storage_IODevice.lxx b/src/Storage/Storage_IODevice.lxx
new file mode 100644 (file)
index 0000000..22e76ba
--- /dev/null
@@ -0,0 +1,9 @@
+// File:      Storage_IODevice.lxx
+// Created:   18.05.15 12:45:50
+// Author:    stv@NETEX
+// Copyright: Open CASCADE 2015
+
+inline Storage_OpenMode Storage_IODevice::OpenMode() const
+{
+  return myOpenMode;
+}
diff --git a/src/Storage/Storage_IStream.cdl b/src/Storage/Storage_IStream.cdl
new file mode 100644 (file)
index 0000000..a35c4a8
--- /dev/null
@@ -0,0 +1,76 @@
+-- Created on: 2015-05-20
+-- Created by: 
+-- Copyright (c) 2015 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class IStream from Storage inherits IODevice from Storage
+       ---Purpose: 
+
+uses Position       from Storage,
+     AsciiString    from TCollection,
+     OpenMode       from Storage,
+     SeekMode       from Storage,
+     Error          from Storage,
+     SStream        from Standard,
+     IStream        from Standard,
+     IStreamPtr     from Standard,
+     ExtendedString from TCollection
+
+raises StreamTypeMismatchError from Storage,
+       StreamFormatError from Storage,
+       StreamWriteError from Storage,
+       StreamExtCharParityError from Storage
+       
+is
+    Create (theStream: in out IStream from Standard) returns IStream from Storage;
+
+    Delete (me: mutable) is redefined;
+
+    Name (me) returns ExtendedString from TCollection is redefined;
+
+    Open (me: mutable; theMode: OpenMode from Storage = Storage_VSWrite) returns Error from Storage;
+    
+    IsEnd (me) returns Boolean from Standard;
+    ---Purpose: returns True if the end of the device data has been reached.
+
+    Tell (me: mutable) returns Position from Storage is redefined;
+    ---Purpose: returns a position in the device. Return -1 upon error.
+
+    Seek( me: mutable; aPos : Position from Storage; aMode: SeekMode from Storage = Storage_SMBegin )
+    returns Boolean from Standard is redefined;
+   
+    Close (me: mutable) returns Boolean from Standard;
+
+    CanRead (me) returns Boolean from Standard;
+
+    CanWrite (me) returns Boolean from Standard;
+
+    Read (me: mutable; theBuffer: Address from Standard; theSize: Size from Standard)
+    returns Size from Standard;
+
+    Write (me: mutable; theBuffer: Address from Standard; theSize: Size from Standard)
+    returns Size from Standard;
+
+    Signature (me) returns AsciiString from TCollection;
+   
+    Print (me; theOStream: in out OStream from Standard)
+    returns OStream from Standard is redefined;
+    ---C++: return &
+
+    fillBuffer(me: mutable)
+    is private;
+
+fields
+    myBuffer: SStream from Standard;
+    myStream: IStreamPtr from Standard;
+end;
diff --git a/src/Storage/Storage_IStream.cxx b/src/Storage/Storage_IStream.cxx
new file mode 100644 (file)
index 0000000..cfc7dbc
--- /dev/null
@@ -0,0 +1,238 @@
+// File:      Storage_OStream.cxx
+// Created:   20.05.15
+// Author:    
+// Copyright: Open CASCADE 2015
+
+#include <Storage_IStream.ixx>
+
+#include <Standard_SStream.hxx>
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+//=======================================================================
+//function : Storage_IStream
+//purpose  : Constructor
+//=======================================================================
+Storage_IStream::Storage_IStream (Standard_IStream& theStream)
+  : Storage_IODevice(),
+    myStream( &theStream ),
+    myBuffer( std::ios::in | std::ios::binary )
+{
+}
+
+//=======================================================================
+//function : Delete
+//purpose  : 
+//=======================================================================
+void Storage_IStream::Delete()
+{
+}
+
+//=======================================================================
+//function : Name
+//purpose  : 
+//=======================================================================
+TCollection_ExtendedString Storage_IStream::Name() const
+{
+  return "";
+}
+
+//=======================================================================
+//function : Open
+//purpose  : 
+//=======================================================================
+Storage_Error Storage_IStream::Open (const Storage_OpenMode theMode)
+{
+  if (theMode != Storage_VSRead)
+  {
+    return Storage_VSOpenError;
+  }
+  
+  Storage_Error anOpenResult = Storage_VSOk;
+  
+  if (OpenMode() == Storage_VSNone)
+  {
+    if ( !myBuffer.good() ) // not good for eof
+      anOpenResult = Storage_VSOpenError;
+    else
+    {
+      SetOpenMode (theMode);
+
+      // clear flags and set the position where the next character is to be inserted 
+      myBuffer.clear();
+      Seek( 0 );
+    }
+  }
+  else
+  {
+    anOpenResult = Storage_VSAlreadyOpen;
+  }
+
+  return anOpenResult;
+}
+
+//=======================================================================
+//function : IsEnd
+//purpose  : 
+//=======================================================================
+Standard_Boolean Storage_IStream::IsEnd() const
+{
+  return myBuffer.eof() && myStream->eof();
+}
+
+//=======================================================================
+//function : Tell
+//purpose  : 
+//=======================================================================
+Storage_Position Storage_IStream::Tell()
+{
+  return Storage_Position( myBuffer.tellg() );
+}
+
+//=======================================================================
+//function : Seek
+//purpose  : 
+//=======================================================================
+Standard_Boolean Storage_IStream::Seek (const Storage_Position& thePos, const Storage_SeekMode aMode )
+{
+  if ( aMode == Storage_SMEnd )
+  {
+    fillBuffer();
+    myBuffer.seekg( thePos, ios::end );
+  }
+  else
+  {
+    Standard_Size aCur = myBuffer.tellg();
+    Standard_Size aPos = aMode == Storage_SMBegin ? thePos : aCur + thePos;
+    if ( aPos > aCur )
+    {
+      myBuffer.seekg( 0, ios::end );
+      Standard_Size aLast = myBuffer.tellg();
+      if ( aLast < aPos )
+      {
+        Standard_Size aCount = aPos - aLast;
+        char* aBuf = (char*)malloc( aCount );
+        myStream->read( aBuf, aCount );
+        Standard_Size aNum = (Standard_Size)myStream->gcount();
+        std::string aStr = myBuffer.str();
+        aStr.append( (char*)aBuf, aNum );
+        myBuffer.str( aStr );
+        free( aBuf );
+        aPos = aLast + aNum;
+      }
+    }
+    if ( aPos != aCur )
+      myBuffer.seekg( aPos );
+  }
+
+  return !myBuffer.fail();
+}
+
+//=======================================================================
+//function : Close
+//purpose  : 
+//=======================================================================
+Standard_Boolean Storage_IStream::Close()
+{
+  SetOpenMode( Storage_VSNone );
+  myBuffer.clear();
+
+  return Standard_True;
+}
+
+//=======================================================================
+//function : CanRead
+//purpose  : 
+//=======================================================================
+Standard_Boolean Storage_IStream::CanRead() const
+{
+    return myBuffer.good() || myStream->good();
+}
+
+//=======================================================================
+//function : CanWrite
+//purpose  : 
+//=======================================================================
+Standard_Boolean Storage_IStream::CanWrite() const
+{
+  return Standard_False;
+}
+
+//=======================================================================
+//function : Read
+//purpose  : 
+//=======================================================================
+Standard_Size Storage_IStream::Read( const Standard_Address theBuffer, const Standard_Size theSize )
+{
+  myBuffer.read((char*)theBuffer, theSize);
+  Standard_Size aCount = (Standard_Size)myBuffer.gcount();
+  if ( aCount < theSize )
+  {
+    myStream->read((char*)theBuffer + aCount, theSize - aCount  );
+    Standard_Size aNum = (Standard_Size)myStream->gcount();
+
+    if ( aNum > 0 )
+    {
+      std::string aStr = myBuffer.str();
+      aStr.append( (char*)theBuffer + aCount, aNum );
+      myBuffer.str( aStr );
+      aCount += aNum;
+
+      myBuffer.clear();
+      myBuffer.seekg( 0, std::ios::end );
+    }
+  }
+
+  return aCount;
+}
+
+//=======================================================================
+//function : Write
+//purpose  : 
+//=======================================================================
+Standard_Size Storage_IStream::Write (const Standard_Address /*theBuffer*/, const Standard_Size /*theSize*/)
+{  
+  return Standard_Size(0);
+}
+
+//=======================================================================
+//function : Signature
+//purpose  : 
+//=======================================================================
+TCollection_AsciiString Storage_IStream::Signature() const
+{
+  return TCollection_AsciiString();
+}
+
+//=======================================================================
+//function : Print
+//purpose  : 
+//=======================================================================
+Standard_OStream& Storage_IStream::Print (Standard_OStream& theOStream) const
+{
+  return theOStream;
+}
+
+//=======================================================================
+//function : fillBuffer
+//purpose  : 
+//=======================================================================
+void Storage_IStream::fillBuffer()
+{
+  Standard_Size aCur = myBuffer.tellg();
+
+  Standard_Size aSize = 8000;
+  char* aBuf = (char*)malloc( aSize );
+  while ( !myStream->eof() )
+  {
+    myStream->read( aBuf, aSize );
+    Standard_Size aNum = (Standard_Size)myStream->gcount();
+    std::string aStr = myBuffer.str();
+    aStr.append( (char*)aBuf, aNum );
+    myBuffer.str( aStr );
+  }
+  free( aBuf );
+
+  myBuffer.seekg( aCur );
+}
diff --git a/src/Storage/Storage_OStream.cdl b/src/Storage/Storage_OStream.cdl
new file mode 100644 (file)
index 0000000..a112de0
--- /dev/null
@@ -0,0 +1,73 @@
+-- Created on: 2015-05-20
+-- Created by: 
+-- Copyright (c) 2015 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class OStream from Storage inherits IODevice from Storage
+       ---Purpose: 
+
+uses Position       from Storage,
+     AsciiString    from TCollection,
+     OpenMode       from Storage,
+     SeekMode       from Storage,
+     Error          from Storage,
+     OStream        from Standard,
+     OStreamPtr     from Standard,
+     SStream        from Standard,
+     ExtendedString from TCollection
+
+raises StreamTypeMismatchError from Storage,
+       StreamFormatError from Storage,
+       StreamWriteError from Storage,
+       StreamExtCharParityError from Storage
+       
+is
+    Create (theStream: in out OStream from Standard) returns OStream from Storage;
+
+    Delete (me: mutable) is redefined;
+
+    Name (me) returns ExtendedString from TCollection is redefined;
+
+    Open (me: mutable; theMode: OpenMode from Storage = Storage_VSWrite) returns Error from Storage;
+    
+    IsEnd (me) returns Boolean from Standard;
+    ---Purpose: returns True if the end of the device data has been reached.
+
+    Tell (me: mutable) returns Position from Storage is redefined;
+    ---Purpose: returns a position in the device. Return -1 upon error.
+
+    Seek( me: mutable; aPos : Position from Storage; aMode: SeekMode from Storage = Storage_SMBegin )
+    returns Boolean from Standard is redefined;
+   
+    Close (me: mutable) returns Boolean from Standard;
+
+    CanRead (me) returns Boolean from Standard;
+
+    CanWrite (me) returns Boolean from Standard;
+
+    Read (me: mutable; theBuffer: Address from Standard; theSize: Size from Standard)
+    returns Size from Standard;
+
+    Write (me: mutable; theBuffer: Address from Standard; theSize: Size from Standard)
+    returns Size from Standard;
+
+    Signature (me) returns AsciiString from TCollection;
+   
+    Print (me; theOStream: in out OStream from Standard)
+    returns OStream from Standard is redefined;
+    ---C++: return &
+
+fields
+    myBuffer : SStream from Standard;
+    myStream : OStreamPtr from Standard;
+end;
diff --git a/src/Storage/Storage_OStream.cxx b/src/Storage/Storage_OStream.cxx
new file mode 100644 (file)
index 0000000..9da1bc8
--- /dev/null
@@ -0,0 +1,189 @@
+// File:      Storage_OStream.cxx
+// Created:   20.05.15
+// Author:    
+// Copyright: Open CASCADE 2015
+
+#include <Storage_OStream.ixx>
+
+#include <Standard_SStream.hxx>
+
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+//=======================================================================
+//function : Storage_OStream
+//purpose  : Constructor
+//=======================================================================
+Storage_OStream::Storage_OStream( Standard_OStream& theStream )
+  : Storage_IODevice(),
+    myStream( &theStream ),
+    myBuffer( std::ios::out | std::ios::binary )
+{
+}
+
+//=======================================================================
+//function : Delete
+//purpose  : 
+//=======================================================================
+void Storage_OStream::Delete()
+{
+}
+
+//=======================================================================
+//function : Name
+//purpose  : 
+//=======================================================================
+TCollection_ExtendedString Storage_OStream::Name() const
+{
+  return "";
+}
+
+//=======================================================================
+//function : Open
+//purpose  : 
+//=======================================================================
+Storage_Error Storage_OStream::Open (const Storage_OpenMode theMode)
+{
+  if (theMode != Storage_VSWrite && theMode != Storage_VSAppend)
+  {
+    return Storage_VSOpenError;
+  }
+  
+  Storage_Error anOpenResult = Storage_VSOk;
+  
+  if (OpenMode() == Storage_VSNone)
+  {
+    if (!myStream->good()) // not good for eof
+    {
+      anOpenResult = Storage_VSOpenError;
+    }
+    else
+    {
+      SetOpenMode (theMode);
+      
+      // clear flags and set the position where the next character is to be inserted 
+      myBuffer.clear();
+      if ( theMode == Storage_VSWrite )
+        myBuffer.seekp(0, ios::beg);
+      else
+        myBuffer.seekp(0, ios::end);
+    }
+  }
+  else
+  {
+    anOpenResult = Storage_VSAlreadyOpen;
+  }
+
+  return anOpenResult;
+}
+
+//=======================================================================
+//function : IsEnd
+//purpose  : 
+//=======================================================================
+Standard_Boolean Storage_OStream::IsEnd() const
+{
+  return myBuffer.eof();
+}
+
+//=======================================================================
+//function : Tell
+//purpose  : 
+//=======================================================================
+Storage_Position Storage_OStream::Tell()
+{
+  return Storage_Position( myBuffer.tellp() );
+}
+
+//=======================================================================
+//function : Seek
+//purpose  : 
+//=======================================================================
+Standard_Boolean Storage_OStream::Seek (const Storage_Position& thePos, const Storage_SeekMode aMode )
+{
+  switch ( aMode )
+  {
+  case Storage_SMEnd:
+    myBuffer.seekp(thePos, ios::end);
+    break;
+  case Storage_SMCur:
+    myBuffer.seekp(thePos, ios::cur);
+    break;
+  case Storage_SMBegin:
+  default:
+    myBuffer.seekp(thePos, ios::beg);
+    break;
+  }
+
+  return !myBuffer.fail();
+}
+
+//=======================================================================
+//function : Close
+//purpose  : 
+//=======================================================================
+Standard_Boolean Storage_OStream::Close()
+{
+  SetOpenMode( Storage_VSNone );
+
+  std::string aStr = myBuffer.str();
+
+  myStream->write( aStr.c_str(), aStr.size() );
+
+  return Standard_True;
+}
+
+//=======================================================================
+//function : CanRead
+//purpose  : 
+//=======================================================================
+Standard_Boolean Storage_OStream::CanRead() const
+{
+  return Standard_False;
+}
+
+//=======================================================================
+//function : CanWrite
+//purpose  : 
+//=======================================================================
+Standard_Boolean Storage_OStream::CanWrite() const
+{
+  return myBuffer.good() && myStream->good();
+}
+
+//=======================================================================
+//function : Read
+//purpose  : 
+//=======================================================================
+Standard_Size Storage_OStream::Read( const Standard_Address /*theBuffer*/, const Standard_Size /*theSize*/ )
+{
+  return Standard_Size(0);
+}
+
+//=======================================================================
+//function : Write
+//purpose  : 
+//=======================================================================
+Standard_Size Storage_OStream::Write (const Standard_Address theBuffer, const Standard_Size theSize)
+{
+  myBuffer.write((char*)theBuffer, theSize);
+  return theSize;
+}
+
+//=======================================================================
+//function : Signature
+//purpose  : 
+//=======================================================================
+TCollection_AsciiString Storage_OStream::Signature() const
+{
+  return TCollection_AsciiString();
+}
+
+//=======================================================================
+//function : Print
+//purpose  : 
+//=======================================================================
+Standard_OStream& Storage_OStream::Print (Standard_OStream& theOStream) const
+{
+  return theOStream;
+}
index cb66edfcd56847e75d7098084b3a06a65738167e..83474cc838b3f732a6ca68b3deeb978cdb82b982 100644 (file)
@@ -105,6 +105,8 @@ is
     class Axis;
     
     class Plane;
+
+    class Presentation;
     
     deferred class Pattern;
        
diff --git a/src/TDataXtd/TDataXtd_Presentation.cdl b/src/TDataXtd/TDataXtd_Presentation.cdl
new file mode 100644 (file)
index 0000000..24f8c13
--- /dev/null
@@ -0,0 +1,162 @@
+-- Created on: 1998-09-30
+-- Created by: Denis PASCAL
+-- Copyright (c) 1998-1999 Matra Datavision
+-- Copyright (c) 1999-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class Presentation from TDataXtd inherits Attribute from TDF
+
+---Purpose: An attribute to associate an
+-- AIS_InteractiveObject to a label in an AIS viewer.
+-- This attribute works in collaboration with TPrsStd_AISViewer.
+-- Note that all the Set... and Unset... attribute
+-- methods as well as the query methods for
+-- visualization attributes and the HasOwn... test
+-- methods are shortcuts to the respective
+-- AIS_InteractiveObject settings.
+
+uses GUID                 from Standard,
+     AttributeIndexedMap  from TDF,
+     DataSet              from TDF,
+     AttributeDelta       from TDF,
+     Label                from TDF,
+     RelocationTable      from TDF
+
+is
+
+    Create returns Presentation from TDataXtd;
+    ---Purpose: Default constructor.
+
+    Set(myclass; theLabel : Label from TDF; theDriverId : GUID from Standard)
+    returns Presentation from TDataXtd;
+    ---Purpose: Creates or retrieves the presentation attribute on
+    -- the label, and sets the GUID driver.
+
+    Set(myclass; theMaster : Attribute from TDF) returns Presentation from TDataXtd;
+    ---Purpose:  Creates or retrieves the presentation attribute attached to master.
+    -- The GUID of the driver will be the GUID of master.
+    -- Master is the attribute you want to display.
+
+    Unset(myclass; theLabel : Label from TDF);
+    ---Purpose: Delete (if exist) the presentation attribute associated to the input label.
+
+    GetID(myclass) returns GUID from Standard;
+    ---Purpose: Returns the GUID for TDataXtd_Presentation attributes.
+    ---C++: return const &
+
+    GetDriverGUID(me) returns GUID from Standard;
+
+    SetDriverGUID(me: mutable ; theGUID : GUID from Standard);
+
+    ID(me)returns GUID from Standard;
+    ---C++: return const &
+
+
+    IsDisplayed(me) returns Boolean from Standard;    
+    ---Purpose: Returns true if this presentation attribute is displayed.
+
+    IsHasOwnMaterial(me) returns Boolean from Standard;
+    ---Purpose: Returns true if this presentation attribute already has a material setting.
+
+    IsHasOwnTransparency(me) returns Boolean from Standard;
+    ---Purpose: Returns true if this presentation attribute already has a transparency setting.
+
+    IsHasOwnColor(me) returns Boolean from Standard;
+    ---Purpose: Returns true if this presentation attribute already has a color setting.
+
+    IsHasOwnWidth(me) returns Boolean from Standard;
+    ---Purpose: Returns true if this presentation attribute already has a width setting.
+
+    IsHasOwnMode(me) returns Boolean from Standard;
+
+    IsHasOwnSelectionMode(me) returns Boolean from Standard;
+
+
+    SetDisplayed(me : mutable; theIsDisplayed : Boolean from Standard);
+
+    SetMaterial(me : mutable; theName : Integer from Standard);
+    ---Purpose: Sets the material for this presentation  attribute.
+
+    SetTransparency(me : mutable; theValue : Real from Standard = 0.6);
+    ---Purpose:
+    -- Sets the transparency value for this presentation attribute.
+    -- @param theValue - parameter of transparency, this value is 0.6 by default.
+
+    SetColor(me: mutable; theColor : Integer from Standard);
+    ---Purpose: Sets the color aColor for this presentation attribute.
+
+    SetWidth(me: mutable; theWidth : Real from Standard);
+    ---Purpose: Sets the width for this presentation attribute.
+
+    SetMode(me: mutable; theMode : Integer from Standard);
+
+    SetSelectionMode(me: mutable; theSelectionMode : Integer from Standard);
+
+
+    Material(me) returns Integer from Standard;
+    ---Purpose: Returns the material setting for this presentation attribute.
+
+    Transparency(me) returns Real from Standard;
+
+    Color(me) returns Integer from Standard;
+
+    Width(me) returns Real from Standard;
+
+    Mode(me)  returns  Integer  from  Standard;
+
+    SelectionMode(me) returns Integer from Standard;
+
+
+    UnsetMaterial(me : mutable);
+    ---Purpose: Removes the material setting from this presentation attribute.
+
+    UnsetTransparency(me : mutable);
+    ---Purpose: Removes the transparency setting from this presentation attribute.
+
+    UnsetColor(me : mutable);
+    ---Purpose: Removes the color setting from this presentation attribute.
+
+    UnsetWidth(me : mutable);
+    ---Purpose: Removes the width setting from this presentation attribute.
+
+    UnsetMode(me : mutable);
+
+    UnsetSelectionMode(me : mutable);
+
+
+    NewEmpty(me) returns Attribute from TDF;
+
+    Restore(me: mutable; theAttribute : Attribute from TDF);
+
+    Paste(me; theInto : Attribute from TDF; theRT : RelocationTable from TDF);
+
+    BackupCopy(me) returns Attribute from TDF is redefined;
+
+fields
+
+    myDriverGUID           : GUID                 from Standard;    
+    myColor                : Integer              from Standard;
+    myMaterial             : Integer              from Standard;
+    myMode                 : Integer              from Standard;
+    mySelectionMode        : Integer              from Standard;
+    myTransparency         : Real                 from Standard;
+    myWidth                : Real                 from Standard;
+    myIsDisplayed          : Boolean              from Standard; 
+    myIsHasOwnColor        : Boolean              from Standard;
+    myIsHasOwnMaterial     : Boolean              from Standard;
+    myIsHasOwnTransparency : Boolean              from Standard;    
+    myIsHasOwnWidth        : Boolean              from Standard;  
+    myIsHasOwnMode         : Boolean              from Standard;
+    myIsHasOwnSelectionMode: Boolean              from Standard;
+
+end Presentation;
\ No newline at end of file
diff --git a/src/TDataXtd/TDataXtd_Presentation.cxx b/src/TDataXtd/TDataXtd_Presentation.cxx
new file mode 100644 (file)
index 0000000..7253935
--- /dev/null
@@ -0,0 +1,566 @@
+// Created on: 2015-04-20
+// Created by: Alexander Zaikin
+// Copyright (c) 1998-1999 Matra Datavision
+// Copyright (c) 1999-2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <TDataXtd_Presentation.ixx>
+
+#include <TDF_DefaultDeltaOnRemoval.hxx>
+#include <TDF_DefaultDeltaOnModification.hxx>
+#include <TDF_DeltaOnAddition.hxx>
+#include <TDF_Tool.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+//=======================================================================
+//function : TDataXtd_Presentation
+//purpose  : Default constructor.
+//=======================================================================
+TDataXtd_Presentation::TDataXtd_Presentation()
+: myDriverGUID           ("00000000-0000-0000-0000-000000000000"),
+  myColor                (516), // Quantity_NOC_WHITE
+  myMaterial             (0),   // Graphic3d_NOM_BRASS
+  myMode                 (0),
+  mySelectionMode        (0),
+  myTransparency         (0.0),
+  myWidth                (0.0),
+  myIsDisplayed          (Standard_False),
+  myIsHasOwnColor        (Standard_False),
+  myIsHasOwnMaterial     (Standard_False),
+  myIsHasOwnTransparency (Standard_False),
+  myIsHasOwnWidth        (Standard_False),
+  myIsHasOwnMode         (Standard_False),
+  myIsHasOwnSelectionMode(Standard_False)
+{}
+
+
+//=======================================================================
+//function : Set
+//purpose  : 
+//=======================================================================
+Handle(TDataXtd_Presentation) TDataXtd_Presentation::Set(const TDF_Label&     theLabel,
+                                                         const Standard_GUID& theDriverId)
+{
+  Handle(TDataXtd_Presentation) aPresentation;
+
+  if ( !theLabel.FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+  {
+    aPresentation = new TDataXtd_Presentation();
+    theLabel.AddAttribute(aPresentation);
+  }
+
+  aPresentation->SetDriverGUID(theDriverId);
+  return aPresentation;
+}
+
+
+//=======================================================================
+//function : Set
+//purpose  : 
+//=======================================================================
+Handle(TDataXtd_Presentation) TDataXtd_Presentation::Set(const Handle(TDF_Attribute)& theMaster)
+{
+  Handle(TDataXtd_Presentation) aPresentation;
+
+  const TDF_Label aLabel = theMaster->Label();
+  if (!aLabel.FindAttribute(TDataXtd_Presentation::GetID(), aPresentation))
+  {
+    aPresentation = new TDataXtd_Presentation();
+    aLabel.AddAttribute(aPresentation);
+  }
+
+  aPresentation->SetDriverGUID( theMaster->ID() );
+  return aPresentation;
+}
+
+
+//=======================================================================
+//function : Unset
+//purpose  : 
+//=======================================================================
+void TDataXtd_Presentation::Unset(const TDF_Label& theLabel)
+{
+  Handle(TDataXtd_Presentation) aPresentation;
+  if (theLabel.FindAttribute(TDataXtd_Presentation::GetID(), aPresentation))
+    theLabel.ForgetAttribute(aPresentation);
+}
+
+
+//=======================================================================
+//function : GetID
+//purpose  : 
+//=======================================================================
+const Standard_GUID& TDataXtd_Presentation::GetID()
+{
+  static Standard_GUID TDataXtd_PresentationID("04fb4d00-5690-11d1-8940-080009dc3333");
+  return TDataXtd_PresentationID;
+}
+
+
+//=======================================================================
+//function : ID
+//purpose  : 
+//=======================================================================
+const Standard_GUID& TDataXtd_Presentation::ID() const
+{
+  return GetID();
+}
+
+
+//=======================================================================
+//function :GetDriverGUID
+//purpose  : 
+//=======================================================================
+Standard_GUID TDataXtd_Presentation::GetDriverGUID() const
+{
+  return myDriverGUID;
+}
+
+
+//=======================================================================
+//function :SetDriverGUID
+//purpose  : 
+//=======================================================================
+void TDataXtd_Presentation::SetDriverGUID(const Standard_GUID& theGUID)
+{
+  if ( myDriverGUID != theGUID )
+  {
+    Backup();
+    myDriverGUID = theGUID;
+  }
+}
+
+
+//=======================================================================
+//function : IsDisplayed
+//purpose  : 
+//=======================================================================
+Standard_Boolean TDataXtd_Presentation::IsDisplayed() const
+{
+  return myIsDisplayed;
+}
+
+
+//=======================================================================
+//function : IsHasOwnMaterial
+//purpose  : 
+//=======================================================================
+Standard_Boolean TDataXtd_Presentation::IsHasOwnMaterial() const
+{
+  return myIsHasOwnMaterial;
+}
+
+
+//=======================================================================
+//function : IsHasOwnTransparency
+//purpose  : 
+//=======================================================================
+Standard_Boolean TDataXtd_Presentation::IsHasOwnTransparency() const
+{
+  return myIsHasOwnTransparency;
+}
+
+
+//=======================================================================
+//function : IsHasOwnColor
+//purpose  : 
+//=======================================================================
+Standard_Boolean TDataXtd_Presentation::IsHasOwnColor() const
+{
+  return myIsHasOwnColor;
+}
+
+
+//=======================================================================
+//function : IsHasOwnWidth
+//purpose  : 
+//=======================================================================
+Standard_Boolean TDataXtd_Presentation::IsHasOwnWidth() const
+{
+  return myIsHasOwnWidth;
+}
+
+
+//=======================================================================
+//function : IsHasOwnMode
+//purpose  : 
+//=======================================================================
+Standard_Boolean TDataXtd_Presentation::IsHasOwnMode() const
+{
+  return myIsHasOwnMode;
+}
+
+
+//=======================================================================
+//function : IsHasOwnSelectionMode
+//purpose  : 
+//=======================================================================
+Standard_Boolean TDataXtd_Presentation::IsHasOwnSelectionMode() const
+{
+  return myIsHasOwnSelectionMode;
+}
+
+
+//=======================================================================
+//function : SetDisplayed
+//purpose  : 
+//=======================================================================
+void TDataXtd_Presentation::SetDisplayed(const Standard_Boolean theIsDisplayed)
+{
+  Backup();
+  myIsDisplayed = theIsDisplayed;
+}
+
+
+//=======================================================================
+//function : SetMaterial
+//purpose  : 
+//=======================================================================
+void TDataXtd_Presentation::SetMaterial(const Standard_Integer theName)
+{
+  Backup();
+  myMaterial         = theName;
+  myIsHasOwnMaterial = Standard_True;
+}
+
+
+//=======================================================================
+//function : SetTransparency
+//purpose  : 
+//=======================================================================
+void TDataXtd_Presentation::SetTransparency(const Standard_Real theValue)
+{
+  Backup();
+  myTransparency = theValue;
+  myIsHasOwnTransparency = Standard_True;
+}
+
+
+//=======================================================================
+//function : SetColor
+//purpose  : 
+//=======================================================================
+void TDataXtd_Presentation::SetColor(const Standard_Integer theColor)
+{
+  Backup();
+  myColor         = theColor;
+  myIsHasOwnColor = Standard_True;
+}
+
+
+//=======================================================================
+//function : SetWidth
+//purpose  : 
+//=======================================================================
+void TDataXtd_Presentation::SetWidth(const Standard_Real theWidth)
+{
+  Backup();
+  myWidth         = theWidth;
+  myIsHasOwnWidth = Standard_True;
+}
+
+
+//=======================================================================
+//function : SetMode
+//purpose  : 
+//=======================================================================
+void TDataXtd_Presentation::SetMode(const Standard_Integer theMode)
+{
+  Backup();
+  myMode         = theMode;
+  myIsHasOwnMode = Standard_True;
+}
+
+
+//=======================================================================
+//function : SetSelectionMode
+//purpose  : 
+//=======================================================================
+void TDataXtd_Presentation::SetSelectionMode(const Standard_Integer theSelectionMode)
+{
+  Backup();
+  myIsHasOwnSelectionMode = Standard_True;
+  mySelectionMode         = theSelectionMode;
+}
+
+
+//=======================================================================
+//function : Material
+//purpose  : 
+//=======================================================================
+Standard_Integer TDataXtd_Presentation::Material() const
+{
+  return myMaterial;
+}
+
+
+//=======================================================================
+//function : Transparency
+//purpose  : 
+//=======================================================================
+Standard_Real TDataXtd_Presentation::Transparency() const
+{
+  return myTransparency;
+}
+
+
+//=======================================================================
+//function : Color
+//purpose  : 
+//=======================================================================
+Standard_Integer TDataXtd_Presentation::Color() const
+{
+  return myColor;
+}
+
+
+//=======================================================================
+//function : Width
+//purpose  : 
+//=======================================================================
+Standard_Real TDataXtd_Presentation::Width() const
+{
+   return myWidth;
+}
+
+
+//=======================================================================
+//function : Mode
+//purpose  : 
+//=======================================================================
+Standard_Integer TDataXtd_Presentation::Mode() const
+{
+  return myMode;
+}
+
+
+//=======================================================================
+//function : SelectionMode
+//purpose  : 
+//=======================================================================
+Standard_Integer TDataXtd_Presentation::SelectionMode() const
+{
+  return mySelectionMode;
+}
+
+
+//=======================================================================
+//function : UnsetMaterial
+//purpose  : 
+//=======================================================================
+void TDataXtd_Presentation::UnsetMaterial()
+{
+  Backup();
+  myIsHasOwnMaterial = Standard_False;
+}
+
+
+//=======================================================================
+//function : UnsetTransparency
+//purpose  : 
+//=======================================================================
+void TDataXtd_Presentation::UnsetTransparency()
+{
+  myIsHasOwnTransparency = Standard_False;
+}
+
+
+//=======================================================================
+//function : UnsetColor
+//purpose  : 
+//=======================================================================
+void TDataXtd_Presentation::UnsetColor()
+{
+  Backup();
+  myIsHasOwnColor = Standard_False;
+}
+
+
+//=======================================================================
+//function : UnsetWidth
+//purpose  : 
+//=======================================================================
+void TDataXtd_Presentation::UnsetWidth()
+{
+  Backup();
+  myIsHasOwnWidth = Standard_False;
+}
+
+
+//=======================================================================
+//function : UnsetMode
+//purpose  : 
+//=======================================================================
+void TDataXtd_Presentation::UnsetMode()
+{
+  Backup();
+  myIsHasOwnMode = Standard_False;
+}
+
+
+//=======================================================================
+//function : UnsetSelectionMode
+//purpose  : 
+//=======================================================================
+void TDataXtd_Presentation::UnsetSelectionMode()
+{
+  Backup();
+  myIsHasOwnSelectionMode = Standard_False;
+}
+
+
+//=======================================================================
+//function : BackupCopy
+//purpose  : 
+//=======================================================================
+Handle(TDF_Attribute) TDataXtd_Presentation::BackupCopy() const
+{
+  Handle(TDataXtd_Presentation) aCopy = new TDataXtd_Presentation;
+
+  aCopy->myIsDisplayed   = myIsDisplayed;
+  aCopy->myDriverGUID    = myDriverGUID;
+  aCopy->mySelectionMode = mySelectionMode;
+  aCopy->myTransparency  = myTransparency;
+  aCopy->myColor         = myColor;
+  aCopy->myMode          = myMode;
+  aCopy->myWidth         = myWidth;
+  aCopy->myMaterial      = myMaterial;
+
+  aCopy->myIsHasOwnColor         = myIsHasOwnColor;
+  aCopy->myIsHasOwnMaterial      = myIsHasOwnMaterial;
+  aCopy->myIsHasOwnWidth         = myIsHasOwnWidth;
+  aCopy->myIsHasOwnMode          = myIsHasOwnMode;
+  aCopy->myIsHasOwnTransparency  = myIsHasOwnTransparency;
+  aCopy->myIsHasOwnSelectionMode = myIsHasOwnSelectionMode;
+
+  return aCopy;
+}
+
+
+//=======================================================================
+//function : NewEmpty
+//purpose  : 
+//=======================================================================
+Handle(TDF_Attribute) TDataXtd_Presentation::NewEmpty() const
+{
+  return new TDataXtd_Presentation();
+}
+
+
+//=======================================================================
+//function : Restore
+//purpose  : 
+//=======================================================================
+void TDataXtd_Presentation::Restore(const Handle(TDF_Attribute)& theAttribute)
+{
+  Handle(TDataXtd_Presentation) aPresentation =
+    Handle(TDataXtd_Presentation)::DownCast(theAttribute);
+
+  myIsHasOwnMaterial = aPresentation->IsHasOwnMaterial();
+  myMaterial = aPresentation->Material();
+
+  myIsHasOwnColor = aPresentation->IsHasOwnColor();
+  myColor = aPresentation->Color();
+
+  myIsHasOwnWidth = aPresentation->IsHasOwnWidth();
+  myWidth = aPresentation->Width();
+
+  myIsHasOwnMode = aPresentation->IsHasOwnMode();
+  myMode = aPresentation->Mode();
+
+  myIsHasOwnSelectionMode = aPresentation->IsHasOwnSelectionMode();
+  mySelectionMode = aPresentation->SelectionMode();
+
+  myIsHasOwnTransparency = aPresentation->IsHasOwnTransparency();
+  myTransparency = aPresentation->Transparency();
+
+  myIsDisplayed = aPresentation->IsDisplayed();
+  myDriverGUID  = aPresentation->GetDriverGUID();
+}
+
+
+//=======================================================================
+//function : Paste
+//purpose  : 
+//=======================================================================
+void TDataXtd_Presentation::Paste(const Handle(TDF_Attribute)& theInto,
+                                  const Handle(TDF_RelocationTable)&) const
+{
+  Handle(TDataXtd_Presentation) anInto =
+    Handle(TDataXtd_Presentation)::DownCast(theInto);
+
+  anInto->Backup();
+
+  if (myIsHasOwnMaterial)
+  {
+    anInto->myMaterial = myMaterial;
+    anInto->myIsHasOwnMaterial = Standard_True;
+  }
+  else
+  {
+    anInto->myIsHasOwnMaterial = Standard_False;
+  }
+
+  if (myIsHasOwnColor)
+  {
+    anInto->myColor = myColor;
+    anInto->myIsHasOwnColor = Standard_True;
+  }
+  else
+  {
+    anInto->myIsHasOwnColor = Standard_False;
+  }
+
+  if(myIsHasOwnWidth)
+  {
+    anInto->myWidth = myWidth;
+    anInto->myIsHasOwnWidth = Standard_True;
+  }
+  else
+  {
+    anInto->myIsHasOwnWidth = Standard_False;
+  }
+
+  if (myIsHasOwnMode)
+  {
+    anInto->myMode = myMode;
+    anInto->myIsHasOwnMode = Standard_True;
+  }
+  else
+  {
+    anInto->myIsHasOwnMode = Standard_False;
+  }
+
+  if (myIsHasOwnSelectionMode)
+  {
+    anInto->mySelectionMode = mySelectionMode;
+    anInto->myIsHasOwnSelectionMode = Standard_True;
+  }
+  else
+  {
+    anInto->myIsHasOwnSelectionMode = Standard_False;
+  }
+
+  if (myIsHasOwnTransparency)
+  {
+    anInto->myTransparency = myTransparency;
+    anInto->myIsHasOwnTransparency = Standard_True;
+  }
+  else
+  {
+    anInto->myIsHasOwnTransparency = Standard_False;
+  }
+
+  anInto->myIsDisplayed = myIsDisplayed;
+  anInto->myDriverGUID  = myDriverGUID;
+}
index b4b00d038f84d214f52f56a93151facbaa8215fb..0f509b1e498fcb00c6b15e56c1161a94e41776b6 100644 (file)
@@ -56,7 +56,8 @@ uses
      TDF,
      TColStd,
      TCollection,
-     Resource
+     Resource,
+     Storage
 
 is
 
index 700360d068b48d766351e18893e2c9d3cccc5e26..1d63b54789e5e813d1ae4fdb01dbd852b1482a11 100644 (file)
@@ -52,8 +52,9 @@ uses Manager                  from Resource,
      ExtendedString           from TCollection,
      SequenceOfExtendedString from TColStd,
      ReaderStatus             from PCDM,
-     StoreStatus              from PCDM
-
+     StoreStatus              from PCDM,
+     IODevice                 from Storage
+     
 raises NoSuchObject from Standard
 
 is
@@ -183,22 +184,69 @@ is
   
     returns Integer from Standard;
 
-    Open (me : mutable; path :     ExtendedString from TCollection;
-                        aDoc : out Document from TDocStd)
+    Open (me : mutable; thePath :     ExtendedString from TCollection;
+                        theDoc  : out Document from TDocStd)
        ---Purpose: Retrieves the document aDoc stored under the
        -- name aName in the directory directory.
        -- In order not to override a version of aDoc which
        -- is already in memory, this method can be made
        -- to depend on the value returned by IsInSession.
     returns ReaderStatus from PCDM;
+    
+    Open (me : mutable; aDevice : in out IODevice from Storage;
+                        aDoc : out Document from TDocStd)
+       ---Purpose: Retrieves the document aDoc from the device 
+       -- In order not to override a version of aDoc which
+       -- is already in memory, this method can be made
+       -- to depend on the value returned by IsInSession.
+    returns ReaderStatus from PCDM is protected;
+    
+    Open (me : mutable; theIStream : in out IStream from Standard;
+                        aDoc : out Document from TDocStd)
+       ---Purpose: Retrieves the document aDoc from the stream
+       -- In order not to override a version of aDoc which
+       -- is already in memory, this method can be made
+       -- to depend on the value returned by IsInSession.
+    returns ReaderStatus from PCDM;
 
-    SaveAs (me : mutable; aDoc : Document from TDocStd;
-                          path : ExtendedString from TCollection)
-       ---Purpose:  Save the  active document  in the file  <name> in the
-       --           path <path> ; o verwrites  the file  if  it already exists.
+    SaveAs (me : mutable; theDoc : Document from TDocStd;
+                          thePath: 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;
+                          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; 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.  
         -- Exceptions:
@@ -206,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;
-                          path : ExtendedString from TCollection;
-                         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 689961b0a92ebcbfe0f90b80b9e2ed66c0b7ba48..c05e613ffec7b50cde22be881d1496f112e25a5d 100644 (file)
@@ -23,6 +23,9 @@
 #include <Standard_ErrorHandler.hxx>
 #include <Standard_NotImplemented.hxx>
 #include <Standard_DomainError.hxx>
+#include <Storage_File.hxx>
+#include <Storage_IStream.hxx>
+#include <Storage_OStream.hxx>
 #include <Plugin_Failure.hxx>
 #include <TDF_Label.hxx>
 #include <CDF_Store.hxx>
@@ -188,24 +191,36 @@ Standard_Integer TDocStd_Application::IsInSession (const TCollection_ExtendedStr
     return 0;
 }
 
+PCDM_ReaderStatus TDocStd_Application::Open(const TCollection_ExtendedString& thePath,
+                                            Handle(TDocStd_Document)& theDoc)
+{
+  Handle(Storage_File) aDevice = new Storage_File(thePath);
+  return Open (aDevice, theDoc);
+}
+
 //=======================================================================
 //function : Open
 //purpose  :
 //=======================================================================
 
-PCDM_ReaderStatus TDocStd_Application::Open(const TCollection_ExtendedString& path,Handle(TDocStd_Document)& aDoc) {
+PCDM_ReaderStatus TDocStd_Application::Open(Handle(Storage_IODevice)& aDevice,
+                                            Handle(TDocStd_Document)& aDoc)
+{
+/*
   PCDM_ReaderStatus status = PCDM_RS_DriverFailure;
   TDocStd_PathParser tool (path);
   TCollection_ExtendedString directory = tool.Trek();
   TCollection_ExtendedString file = tool.Name();
   file+=".";
   file+=tool.Extension();
-  status = CanRetrieve(directory,file);
-  if (status != PCDM_RS_OK) return status;
+*/
+  PCDM_ReaderStatus status = CanRetrieve(aDevice);
+  if (status != PCDM_RS_OK)
+    return status;
   try {
     OCC_CATCH_SIGNALS
     Handle(TDocStd_Document) D =
-      Handle(TDocStd_Document)::DownCast(Retrieve(directory,file));
+      Handle(TDocStd_Document)::DownCast(Retrieve(aDevice));
     CDF_Application::Open(D);
     aDoc = D;
   }
@@ -213,9 +228,6 @@ PCDM_ReaderStatus TDocStd_Application::Open(const TCollection_ExtendedString& pa
 //    status = GetRetrieveStatus();
     Handle(Standard_Failure) F = Standard_Failure::Caught();
     if (!F.IsNull() && !MessageDriver().IsNull()) {
-//      Standard_SStream aMsg;
-//      aMsg << Standard_Failure::Caught() << endl;
-//      cout << "TDocStd_Application::Open(): " << aMsg.rdbuf()->str() << endl;
       TCollection_ExtendedString aString (F->GetMessageString());
       MessageDriver()->Write(aString.ToExtString());
     }
@@ -227,46 +239,114 @@ PCDM_ReaderStatus TDocStd_Application::Open(const TCollection_ExtendedString& pa
   return status;
 }
 
+//=======================================================================
+//function : Open
+//purpose  :
+//=======================================================================
+
+PCDM_ReaderStatus TDocStd_Application::Open( Standard_IStream& theIStream,
+                                             Handle(TDocStd_Document)& aDoc )
+{
+  Handle(Storage_IStream) aDevice = new Storage_IStream(theIStream);
+  return Open (aDevice, aDoc);
+}
+
 //=======================================================================
 //function : SaveAs
 //purpose  :
 //=======================================================================
 
-PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,const TCollection_ExtendedString& path) {
-  TDocStd_PathParser tool (path);
-  TCollection_ExtendedString directory = tool.Trek();
-  TCollection_ExtendedString file = tool.Name();
-  file+=".";
-  file+=tool.Extension();
+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 );
+}
+
+//=======================================================================
+//function : SaveAs
+//purpose  :
+//=======================================================================
+
+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 : 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 );
+}
+
+//=======================================================================
+//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.SetFolder(directory))
-  {
-    TCollection_ExtendedString aMsg ("TDocStd_Application::SaveAs() - folder ");
-    aMsg += directory;
-    aMsg += " does not exist";
-    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());
+  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;
   }
-  if(storer.StoreStatus() == PCDM_SS_OK)
-    D->SetSaved();
-#ifdef OCCT_DEBUG
-  cout<<"TDocStd_Application::SaveAs(): The status = "<<storer.StoreStatus()<<endl;
-#endif
-  return storer.StoreStatus();
+  return aStatus;
 }
 
 //=======================================================================
@@ -331,49 +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 TCollection_ExtendedString& path,
-                                             TCollection_ExtendedString& theStatusMessage) 
-{ 
-  TDocStd_PathParser tool (path);
-  PCDM_StoreStatus aStatus = PCDM_SS_Failure;
-  TCollection_ExtendedString directory = tool.Trek();   
-  TCollection_ExtendedString file = tool.Name();   
-  file+=".";   
-  file+=tool.Extension();
-  D->Open(this);
-  CDF_Store storer (D);  
-  if (storer.SetFolder(directory)) {
-    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 such directory ") + directory;
-    aStatus = PCDM_SS_Failure;
-  }
-  return aStatus;
-}
-
 //=======================================================================
 //function : Save
 //purpose  : 
index 720da3c7f5a5bcee89d786f968d58571f71e5792..8f2fb935e3ae0c66b86bf2ec73b96e6c1d1ce05f 100644 (file)
@@ -40,6 +40,8 @@
 
 #include <CDM_MetaData.hxx>
 
+#include <Storage_File.hxx>
+
 // List should have a RemoveLast...
 #define TDocStd_List_RemoveLast(theList) \
 TDF_ListIteratorOfDeltaList it(theList); \
@@ -115,10 +117,13 @@ TCollection_ExtendedString TDocStd_Document::GetName () const
 
 TCollection_ExtendedString TDocStd_Document::GetPath () const
 {
-  return CDM_Document::MetaData()->Path();
+  TCollection_ExtendedString aPath;
+  Handle(Storage_File) aFile = Handle(Storage_File)::DownCast(CDM_Document::MetaData()->Device());
+  if ( !aFile.IsNull() )
+    aPath = aFile->Path();
+  return aPath;
 }
 
-
 //=======================================================================
 //function : SetData
 //purpose  : 
index 27b51d73ab4cabb71562b25843697477cae0317e..5f24c3518ffd60024bae9a1ce785df0e041cdada 100755 (executable)
@@ -6,5 +6,4 @@ TKG3d
 TKCAF
 TKCDF
 TKLCAF
-TKV3d
 TKBinL
index 8778d0a0fea7f4f35a80be1fbe6dc0e91efd9ccb..fcd751ccb1088caed33c8a59ece7188102376948 100755 (executable)
@@ -1,4 +1,3 @@
 BinDrivers
 BinMDataXtd
-BinMPrsStd
 BinMNaming
index e1cae0b3321f32b6bbf8deb6b8efa1c44b956990..1265220edbcb686890e1df1bbab14a23c46605b9 100755 (executable)
@@ -3,10 +3,8 @@ TKGeomBase
 TKBRep
 TKTopAlgo
 TKMath
-TKService
 TKG2d
 TKG3d
 TKCDF
 TKLCAF
-TKV3d
 TKBO
index 241a01ff1e3d168f5a5fe5e0c5b7061ede6dda75..6c5156383fffba67f00661f719f708426f6e54a9 100755 (executable)
@@ -1,4 +1,3 @@
 TDataXtd
 TNaming
-TPrsStd
 AppStd
index f368834083e06e4b98488898e37477709b2e5c44..476e0a6bb5e3ab20e04f49c812a89315197eec77 100755 (executable)
@@ -17,4 +17,5 @@ TKPrim
 TKBool
 TKBO
 TKCAF
+TKVCAF
 TKViewerTest
index 26e986d08ee65db01fc4ea6860358d1c47e07d7f..7be442d5d1d84ae27c06e95e26e5954391fae337 100755 (executable)
@@ -4,8 +4,6 @@ TKMath
 TKernel
 TKCDF
 TKG2d
-TKV3d
-TKService
 TKG3d
 TKPShape
 TKCAF
index 10549ef0b932340be3fffccc8aab8414f02deddb..6988c5811b2c4b981fb62c4985d3a54102170798 100755 (executable)
@@ -1,6 +1,4 @@
 PDataXtd
 PNaming
-PPrsStd
 MDataXtd
-MPrsStd
 MNaming
index 064a33ea09da43bca4e564173a6df974fabc6cf9..5394813a26bbcd72fe2ec664e1a2a79e0d981298 100755 (executable)
@@ -24,6 +24,7 @@ TKShHealing
 TKOffset
 TKFeat
 TKCAF
+TKVCAF
 TKIGES
 TKXSBase
 TKMesh
diff --git a/src/TKVCAF/EXTERNLIB b/src/TKVCAF/EXTERNLIB
new file mode 100644 (file)
index 0000000..5939526
--- /dev/null
@@ -0,0 +1,13 @@
+TKernel
+TKGeomBase
+TKBRep
+TKTopAlgo
+TKMath
+TKService
+TKG2d
+TKG3d
+TKCDF
+TKLCAF
+TKBO
+TKCAF
+TKV3d
diff --git a/src/TKVCAF/FILES b/src/TKVCAF/FILES
new file mode 100644 (file)
index 0000000..ca4f0e5
--- /dev/null
@@ -0,0 +1,2 @@
+EXTERNLIB
+PACKAGES
diff --git a/src/TKVCAF/PACKAGES b/src/TKVCAF/PACKAGES
new file mode 100644 (file)
index 0000000..7acb218
--- /dev/null
@@ -0,0 +1 @@
+TPrsStd
index 6f521bbafa11e1913f515b66aa2191139414c423..67daea8ff206c302f85058ba5e302697dd664aae 100755 (executable)
@@ -8,6 +8,4 @@ TKG2d
 TKG3d
 TKMesh
 TKHLR
-TKService
 TKGeomAlgo
-TKV3d
index a82c32bc9da1d042f5618f8ee0874f5b441b7008..501cf383d4bc6c0e89686374836603d41cf510e1 100755 (executable)
@@ -1,11 +1,10 @@
 TKBRep
 TKernel
 TKMath
-TKService
 TKG2d
 TKTopAlgo
-TKV3d
 TKCDF
 TKLCAF
 TKG3d
 TKCAF
+
index 0dcdadc5260734a20fc4d55fd06f1e817a5bbd7a..6a4ffc5f1774dd2c30ab14303c3e79bc039d331a 100755 (executable)
@@ -10,6 +10,7 @@ TKService
 TKXSBase
 TKG2d
 TKCAF
+TKVCAF
 TKDraw
 TKTopAlgo
 TKLCAF
index 28cccd904f2d5b207403872c3613051b104e8c2e..02c5575dc4aa2cecfb78743c19fda73268d825af 100755 (executable)
@@ -1,6 +1,5 @@
 TKCDF
 TKernel
-TKV3d
 TKMath
 TKBRep
 TKG2d
index aa2c6823df6a28e129104b118e1c5f5fbc1a0966..be38b360a337d11161490111a1d240d85bd3626b 100755 (executable)
@@ -1,4 +1,3 @@
 XmlDrivers
 XmlMDataXtd
 XmlMNaming
-XmlMPrsStd
index fb50befa127efddcc0247c41ff63591708d902dc..bc9b7e7de196a18e29a57f6f8bba506f0f0a86e2 100755 (executable)
@@ -1,7 +1,7 @@
 00000000-0000-0000-0000-000000000000   Reserved
 ffffffff-ffff-ffff-ffff-ffffffffffff   Reserved
 
-04fb4d00-5690-11d1-8940-080009dc3333   TPrsStd_AISPresentation
+3680ac6c-47ae-4366-bb94-26abb6e07341   TPrsStd_AISPresentation
 04fb4d01-5690-11d1-8940-080009dc3333   TPrsStd_ColorAttribute
 04fb4d02-5690-11d1-8940-080009dc3333   TPrsStd_TransparencyAttribute
 04fb4d04-5690-11d1-8940-080009dc3333   TPrsStd_GraphicAttribute
index 3e474f3f5faa5f75aae7758603075f6fea83e33a..aec72fa8d48d5603c921b533601e6499052f426f 100644 (file)
@@ -1,7 +1,7 @@
 -- Created on: 1998-09-30
 -- Created by: Denis PASCAL
 -- Copyright (c) 1998-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
+-- Copyright (c) 1999-2015 OPEN CASCADE SAS
 --
 -- This file is part of Open CASCADE Technology software library.
 --
 -- Alternatively, this file may be used under the terms of Open CASCADE
 -- commercial license or contractual agreement.
 
--- Lastly modified by :
--- +---------------------------------------------------------------------------+
--- !      ivan ! SetMode                                 ! 5-04-2001! 3.0-00-1!
--- +---------------------------------------------------------------------------+
-
-
-
 class AISPresentation from TPrsStd inherits Attribute from TDF
 
-       ---Purpose: An attribute to associate an
+---Purpose: An attribute to associate an
 -- AIS_InteractiveObject to a label in an AIS viewer.
 -- This attribute works in collaboration with TPrsStd_AISViewer.
 -- Note that all the Set... and Unset... attribute
@@ -38,198 +31,193 @@ uses GUID                 from Standard,
      AttributeDelta       from TDF,
      Label                from TDF,
      RelocationTable      from TDF,
+     Presentation         from TDataXtd,
      InteractiveObject    from AIS,
-     Length               from Quantity,
+     InteractiveContext   from AIS,
      NameOfColor          from Quantity,
      PlaneAngle           from Quantity,
-     NameOfMaterial       from Graphic3d,
-     Drawer               from Prs3d
+     NameOfMaterial       from Graphic3d
+
 is
 
     GetID (myclass) returns GUID from Standard;
-       ---Purpose: Returns the GUID for TPrsStd_AISPresentation attributes.
-       ---C++: return const &
+    ---Purpose: Returns the GUID for TPrsStd_AISPresentation attributes.
+    ---C++: return const &
 
     Set (myclass;  L : Label from TDF; driver : GUID from Standard)
-       ---Purpose: Creates or retrieves the presentation attribute on
-       -- the label L, and sets the GUID driver.
+    ---Purpose: Creates or retrieves the presentation attribute on
+    -- the label L, and sets the GUID driver.
     returns AISPresentation from TPrsStd;        
 
-    Unset (myclass;  L : Label from TDF);
+    Unset (myclass;  theLabel : Label from TDF);
     ---Purpose: Delete (if exist) the presentation attribute associated to the label <L>.
 
-
     Set (myclass;  master : Attribute from TDF)
-        ---Purpose:  Creates or retrieves the AISPresentation
-        -- attribute attached to master.
-        -- The GUID of the driver will be the GUID of master.
-        -- master is the attribute you want to display.
+    ---Purpose:  Creates or retrieves the AISPresentation
+    -- attribute attached to master.
+    -- The GUID of the driver will be the GUID of master.
+    -- master is the attribute you want to display.
     returns AISPresentation from TPrsStd;
 
 
     ---Category: Presentation attribute implementation
     --          ======================================
-    
+
     Create returns AISPresentation from TPrsStd;
-    
+
     SetDisplayed(me : mutable; B : Boolean from Standard);
-    
+
     Display (me : mutable; update : Boolean from Standard = Standard_False);
-       ---Purpose: Display presentation of object in AIS viewer.
-       --          If <update> = True then AISObject is recomputed and all 
-       --          the visualization settings are applied
-    
+    ---Purpose: Display presentation of object in AIS viewer.
+    -- If <update> = True then AISObject is recomputed and all 
+    -- the visualization settings are applied
+
     Erase (me : mutable; remove : Boolean from Standard = Standard_False);
-       ---Purpose: Removes the presentation of this AIS
-       -- presentation attribute from the TPrsStd_AISViewer.
-       -- If remove is true, this AIS presentation attribute
-       -- is removed from the interactive context.
-    
+    ---Purpose: Removes the presentation of this AIS
+    -- presentation attribute from the TPrsStd_AISViewer.
+    -- If remove is true, this AIS presentation attribute
+    -- is removed from the interactive context.
+
     Update (me : mutable);
     ---Purpose: Recompute presentation of object and apply the visualization settings
-    
-    
+
     GetDriverGUID (me) returns GUID from Standard; 
-     
+
     SetDriverGUID (me: mutable ; guid : GUID from Standard);
-    
-    IsDisplayed (me)
-    returns Boolean from Standard;    
----Purpose:
--- Returns true if this AIS presentation attribute is displayed.
-    GetAIS (me) returns InteractiveObject from AIS;
-    ---Purpose: Returns AIS_InteractiveObject stored in the presentation attribute
-    
-    AISUpdate (me : mutable)
-    ---Purpose: Updates AIS_InteractiveObject stored in the attribute
-    --          and applies the visualization settings
-    is private;
 
-    AISDisplay (me : mutable)
-    ---Purpose: Displays AIS_InteractiveObject stored in the attribute
-    is private;
+    IsDisplayed (me) returns Boolean from Standard;
+    ---Purpose: Returns true if this AIS presentation attribute is displayed.
 
-    AISErase (me : mutable; remove : Boolean from Standard = Standard_False)
-    ---Purpose: Erases AIS_InteractiveObject stored in the attribute in 
-    --          the viewer; If <remove> = True then AISObject is removed 
-    --          from AIS_InteractiveContext instead of simple erasing in the viewer
-    is private;
-    
     ---Category: Visualization settings of AIS_InteractiveObject
     --          ================================================
-    
+
     Material(me) returns NameOfMaterial from Graphic3d;
+    ---Purpose:
+    -- Returns the material setting for this presentation attribute.
+
+    SetMaterial(me : mutable; aName : NameOfMaterial from Graphic3d);
+    ---Purpose: Sets the material aName for this presentation  attribute.
+
+    HasOwnMaterial(me) returns Boolean from Standard;
+    ---Purpose: Returns true if this presentation attribute already has a material setting.
 
----Purpose:
--- Returns the material setting for this presentation attribute.    
-    SetMaterial(me : mutable; aName : NameOfMaterial from Graphic3d); 
----Purpose:        Sets the material aName for this presentation  attribute.    
-    HasOwnMaterial(me) returns Boolean from Standard; 
----Purpose: Returns true if this presentation attribute already has a material setting.    
     UnsetMaterial(me : mutable);
----Purpose: Removes the material setting from this presentation attribute.
+    ---Purpose: Removes the material setting from this presentation attribute.
+
     SetTransparency(me : mutable; aValue : Real from Standard=0.6);
---- Purpose:
--- Sets the transparency value aValue for this
--- presentation attribute.
--- This value is 0.6 by default.    
+    --- Purpose:
+    -- Sets the transparency value aValue for this presentation attribute.
+    -- This value is 0.6 by default.
+
     Transparency(me) returns Real from Standard;
-    
+
     HasOwnTransparency(me) returns Boolean from Standard;
----Purpose: Returns true if this presentation attribute already has a transparency setting.    
+    ---Purpose: Returns true if this presentation attribute already has a transparency setting.
+
     UnsetTransparency(me : mutable);
----Purpose: Removes the transparency setting from this presentation attribute.  
+    ---Purpose: Removes the transparency setting from this presentation attribute.
+
     Color(me) returns NameOfColor from Quantity;
-    
+
     SetColor(me: mutable; aColor : NameOfColor from Quantity);
----Purpose: Sets the color aColor for this presentation attribute.    
+    ---Purpose: Sets the color aColor for this presentation attribute.
+
     HasOwnColor(me) returns Boolean from Standard;
----Purpose: Returns true if this presentation attribute already has a color setting.    
-    UnsetColor(me : mutable); 
----Purpose: Removes the color setting from this presentation attribute.    
-    Width(me) returns Real from Standard ;
-    
+    ---Purpose: Returns true if this presentation attribute already has a color setting.
+
+    UnsetColor(me : mutable);
+    ---Purpose: Removes the color setting from this presentation attribute.
+
+    Width(me) returns Real from Standard;
+
     SetWidth(me: mutable; aWidth : Real from Standard);
----Purpose: Sets the width aWidth for this presentation attribute.    
+    ---Purpose: Sets the width aWidth for this presentation attribute.
+
     HasOwnWidth(me) returns Boolean from Standard;
----Purpose: Returns true if this presentation attribute already has a width setting.
-    UnsetWidth(me : mutable); 
----Purpose: Removes the width setting from this presentation attribute.     
-    Mode(me)  returns  Integer  from  Standard;  
-     
-    SetMode(me: mutable; theMode : Integer from Standard);  
-    
+    ---Purpose: Returns true if this presentation attribute already has a width setting.
+
+    UnsetWidth(me : mutable);
+    ---Purpose: Removes the width setting from this presentation attribute.
+
+    Mode(me)  returns  Integer  from  Standard;
+
+    SetMode(me: mutable; theMode : Integer from Standard);
+
     HasOwnMode(me) returns Boolean from Standard;
-    UnsetMode(me : mutable); 
+
+    UnsetMode(me : mutable);
 
     SelectionMode(me) returns Integer from Standard;
-    
-    SetSelectionMode(me: mutable; theSelectionMode : Integer from Standard);  
+
+    SetSelectionMode(me: mutable; theSelectionMode : Integer from Standard);
 
     HasOwnSelectionMode(me) returns Boolean from Standard;
+
     UnsetSelectionMode(me : mutable); 
 
-               
     ---Category: Methods of TDF_Attribute
     --           ========================
-    
+
     ID(me)returns GUID from Standard;
     ---C++: return const &
 
-    NewEmpty(me)
-    returns Attribute from TDF;    
-    Restore(me: mutable; with : Attribute from TDF);
+    NewEmpty(me) returns Attribute from TDF;
 
-    Paste (me; into : Attribute from TDF;
-              RT   : RelocationTable from TDF);     
+    Restore(me: mutable; theWith : Attribute from TDF);
+
+    Paste(me; into : Attribute from TDF; RT : RelocationTable from TDF);
 
     BackupCopy(me) returns Attribute from TDF is redefined;
-    
+
     ---Category: Callbacks for viewer updating
     --           =============================
 
-    AfterAddition (me: mutable)
-    is redefined;    
+    AfterAddition (me: mutable) is redefined;    
 
-    BeforeRemoval (me: mutable)
-    is redefined;
+    BeforeRemoval (me: mutable) is redefined;
 
-    BeforeForget(me: mutable)
-    is redefined;
+    BeforeForget(me: mutable) is redefined;
+
+    AfterResume(me: mutable) is redefined;    
 
-    AfterResume(me: mutable)   
-    is redefined;    
-    
     BeforeUndo (me: mutable; anAttDelta : AttributeDelta from TDF;
-                             forceIt    : Boolean from Standard = Standard_False)
-    returns Boolean from Standard
-    is redefined;
-    
+                forceIt    : Boolean from Standard = Standard_False)
+    returns Boolean from Standard is redefined;
+
     AfterUndo (me: mutable; anAttDelta : AttributeDelta from TDF;
-                            forceIt    : Boolean from Standard = Standard_False)
+               forceIt    : Boolean from Standard = Standard_False)
     ---Purpose: update AIS viewer according to delta
-    returns Boolean from Standard
-    is redefined;
-   
+    returns Boolean from Standard is redefined;
+
+    getAISContext(me) returns InteractiveContext from AIS
+    ---Purpose: Returns interactive context associated with presentation.
+    is private;
+
+    getData(me) returns Presentation from TDataXtd 
+    ---Purpose: Returns data presentation attribute connected associated with presentation.
+    is private;
+
+    GetAIS(me) returns InteractiveObject from AIS;
+    ---Purpose: Returns AIS_InteractiveObject stored in the presentation attribute.
+
+    AISUpdate (me : mutable)
+    ---Purpose: Updates AIS_InteractiveObject stored in the attribute
+    -- and applies the visualization settings
+    is private;
+
+    AISDisplay (me : mutable)
+    ---Purpose: Displays AIS_InteractiveObject stored in the attribute
+    is private;
+
+    AISErase (me : mutable; remove : Boolean from Standard = Standard_False)
+    ---Purpose: Erases AIS_InteractiveObject stored in the attribute in 
+    -- the viewer; If <remove> = True then AISObject is removed 
+    -- from AIS_InteractiveContext instead of simple erasing in the viewer
+    is private;
+
 fields
 
-    myDriverGUID       : GUID                 from Standard;    
-    myTransparency     : Real                 from Standard;
-    myColor            : NameOfColor          from Quantity;
-    myMaterial         : NameOfMaterial       from Graphic3d;
-    myWidth            : Real                 from Standard; 
-    myMode             : Integer              from Standard;
-    mySelectionMode    : Integer              from Standard;
-    isDisplayed        : Boolean              from Standard; 
-    hasOwnColor        : Boolean              from Standard;
-    hasOwnMaterial     : Boolean              from Standard;
-    hasOwnTransparency : Boolean              from Standard;    
-    hasOwnWidth        : Boolean              from Standard;  
-    hasOwnMode         : Boolean              from Standard;
-    hasOwnSelectionMode: Boolean              from Standard;
-    myAIS              : InteractiveObject    from AIS;    
+    myDriverGUID       : GUID                 from Standard;
+    myAIS              : InteractiveObject    from AIS;
 end AISPresentation;
 
index 70c171c3dbd20678600b70c114a8ba09e243a35d..638f83ff16062dbba765b1271b92252f7b0bfff7 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-// Lastly modified by :
-// +---------------------------------------------------------------------------+
-// !      ivan ! SetMode                                 ! 5-04-2001! 3.0-00-1!
-// +---------------------------------------------------------------------------+
 #include <TPrsStd_AISPresentation.ixx>
 
 #include <TDF_DefaultDeltaOnRemoval.hxx>
 #include <TDF_DeltaOnAddition.hxx>
 #include <TDF_Tool.hxx>
 #include <TCollection_ExtendedString.hxx>
+#include <TDataXtd_Presentation.hxx>
 #include <TPrsStd_AISViewer.hxx>
 #include <AIS_InteractiveContext.hxx>
 #include <AIS_InteractiveObject.hxx>
 #include <TPrsStd_Driver.hxx>
 #include <TPrsStd_DriverTable.hxx>
 
+
+//=======================================================================
+//function : TPrsStd_AISPresentation
+//purpose  : Constructor
+//=======================================================================
+TPrsStd_AISPresentation::TPrsStd_AISPresentation ()
+: myDriverGUID("00000000-0000-0000-0000-000000000000")
+{
+}
+
+
 //=======================================================================
 //function : Set
 //purpose  : 
 //=======================================================================
-Handle(TPrsStd_AISPresentation) TPrsStd_AISPresentation::Set(const TDF_Label& L,const Standard_GUID& driver) 
-{   
-
-  Handle(TPrsStd_AISPresentation) P; 
+Handle(TPrsStd_AISPresentation) TPrsStd_AISPresentation::Set
+             ( const TDF_Label& theLabel, const Standard_GUID& theDriver )
+{
+  Handle(TPrsStd_AISPresentation) aPresentation;
 
-  if (!L.FindAttribute(TPrsStd_AISPresentation::GetID(),P)) { 
-    P = new TPrsStd_AISPresentation ();  
-    L.AddAttribute(P);
+  if ( !theLabel.FindAttribute(TPrsStd_AISPresentation::GetID(), aPresentation) )
+  {
+    aPresentation = new TPrsStd_AISPresentation();
+    theLabel.AddAttribute(aPresentation);
   }
-  P->SetDriverGUID(driver);   
-  return P;
+
+  aPresentation->SetDriverGUID(theDriver);
+  return aPresentation;
 }
 
 
@@ -53,13 +63,12 @@ Handle(TPrsStd_AISPresentation) TPrsStd_AISPresentation::Set(const TDF_Label& L,
 //function : Unset
 //purpose  : 
 //=======================================================================
-void TPrsStd_AISPresentation::Unset (const TDF_Label& L)
-{   
-  Handle(TPrsStd_AISPresentation) P;  
+void TPrsStd_AISPresentation::Unset (const TDF_Label& theLabel)
+{
+  Handle(TPrsStd_AISPresentation) aPresentation;
 
-  if (L.FindAttribute(TPrsStd_AISPresentation::GetID(),P)) { 
-    L.ForgetAttribute(P);
-  }
+  if ( theLabel.FindAttribute(TPrsStd_AISPresentation::GetID(), aPresentation) )
+    theLabel.ForgetAttribute(aPresentation);
 }
 
 
@@ -67,67 +76,41 @@ void TPrsStd_AISPresentation::Unset (const TDF_Label& L)
 //function : Set
 //purpose  : 
 //=======================================================================
-Handle(TPrsStd_AISPresentation) TPrsStd_AISPresentation::Set (const Handle(TDF_Attribute)& master) 
-{  
-  Handle(TPrsStd_AISPresentation) P;  
-
-  if (!master->Label().FindAttribute(TPrsStd_AISPresentation::GetID(),P)) { 
-    P = new TPrsStd_AISPresentation ();  
-    master->Label().AddAttribute(P);
-  }   
-
-  P->SetDriverGUID( master->ID() );
+Handle(TPrsStd_AISPresentation) TPrsStd_AISPresentation::Set(const Handle(TDF_Attribute)& theMaster)
+{
+  Handle(TPrsStd_AISPresentation) aPresentation;
+  if ( !theMaster->Label().FindAttribute(TPrsStd_AISPresentation::GetID(), aPresentation) )
+  { 
+    aPresentation = new TPrsStd_AISPresentation ();
+    theMaster->Label().AddAttribute(aPresentation);
+  }
 
-  return P;
+  aPresentation->SetDriverGUID( theMaster->ID() );
+  return aPresentation;
 }
 
 
-
-
 //=======================================================================
 //function : GetID
 //purpose  : 
 //=======================================================================
-const Standard_GUID& TPrsStd_AISPresentation::GetID() 
+const Standard_GUID& TPrsStd_AISPresentation::GetID()
 {
-  static Standard_GUID TPrsStd_AISPresentationID("04fb4d00-5690-11d1-8940-080009dc3333");
+  static Standard_GUID TPrsStd_AISPresentationID("3680ac6c-47ae-4366-bb94-26abb6e07341");
   return TPrsStd_AISPresentationID;
 }
 
 
-//=======================================================================
-//function : TPrsStd_AISPresentation
-//purpose  : 
-//=======================================================================
-TPrsStd_AISPresentation::TPrsStd_AISPresentation () : 
-myDriverGUID("00000000-0000-0000-0000-000000000000"),
-myTransparency(0.),
-myColor(Quantity_NOC_WHITE),
-myMaterial(Graphic3d_NOM_BRASS),
-myWidth(0.),
-myMode(0),
-mySelectionMode(0),
-isDisplayed(Standard_False),
-hasOwnColor(Standard_False),
-hasOwnMaterial(Standard_False),
-hasOwnTransparency(Standard_False),
-hasOwnWidth(Standard_False),
-hasOwnMode(Standard_False),
-hasOwnSelectionMode(Standard_False)
-{}
-
-
 //=======================================================================
 //function : Display
 //purpose  : 
 //=======================================================================
-void TPrsStd_AISPresentation::Display (const Standard_Boolean update)
+void TPrsStd_AISPresentation::Display(const Standard_Boolean theIsUpdate)
 {
-   
-  if( update || myAIS.IsNull() ) {
+  if ( theIsUpdate || myAIS.IsNull() )
     AISUpdate();
-  }
-  AISDisplay();     
+
+  AISDisplay();
 }
 
 
@@ -135,17 +118,23 @@ void TPrsStd_AISPresentation::Display (const Standard_Boolean update)
 //function : Erase
 //purpose  : 
 //=======================================================================
-void TPrsStd_AISPresentation::Erase (const Standard_Boolean remove)
-{  
-  if( isDisplayed ) AISErase(remove);   
+void TPrsStd_AISPresentation::Erase(const Standard_Boolean theIsRemove)
+{
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+  {
+    if ( aPresentation.IsNull() == Standard_False && aPresentation->IsDisplayed() )
+      AISErase(theIsRemove);
+  }
 }
 
+
 //=======================================================================
 //function : Update
 //purpose  : 
 //=======================================================================
-void  TPrsStd_AISPresentation::Update ()
-{  
+void  TPrsStd_AISPresentation::Update()
+{
   AISUpdate();
 }
 
@@ -154,9 +143,24 @@ void  TPrsStd_AISPresentation::Update ()
 //function : IsDisplayed
 //purpose  : 
 //=======================================================================
-Standard_Boolean TPrsStd_AISPresentation::IsDisplayed () const
+Standard_Boolean TPrsStd_AISPresentation::IsDisplayed() const
 {
-  return isDisplayed;
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+    return aPresentation->IsDisplayed();
+
+  return Standard_False;
+}
+
+
+//=======================================================================
+//function : SetDisplayed
+//purpose  : 
+//=======================================================================
+void TPrsStd_AISPresentation::SetDisplayed(const Standard_Boolean theIsDisplayed)
+{
+  Handle(TDataXtd_Presentation) aPresentation = getData();
+  return aPresentation->SetDisplayed(theIsDisplayed);
 }
 
 
@@ -164,13 +168,13 @@ Standard_Boolean TPrsStd_AISPresentation::IsDisplayed () const
 //function :SetDriverGUID
 //purpose  : 
 //=======================================================================
-void TPrsStd_AISPresentation::SetDriverGUID(const Standard_GUID& guid) 
+void TPrsStd_AISPresentation::SetDriverGUID(const Standard_GUID& theGUID)
 {
-  // OCC2932 correction
-  if(myDriverGUID == guid) return;
+  if ( myDriverGUID == theGUID )
+    return;
 
-  Backup(); 
-  myDriverGUID = guid;
+  Backup();
+  myDriverGUID = theGUID;
 }
 
 
@@ -190,210 +194,270 @@ Standard_GUID TPrsStd_AISPresentation::GetDriverGUID() const
 //=======================================================================
 Graphic3d_NameOfMaterial TPrsStd_AISPresentation::Material() const
 {
-  return myMaterial; 
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+    return static_cast<Graphic3d_NameOfMaterial>( aPresentation->Material() );
+
+  return Graphic3d_NOM_BRASS;
 }
 
+
 //=======================================================================
 //function :HasMaterial
 //purpose  : 
 //=======================================================================
 Standard_Boolean TPrsStd_AISPresentation::HasOwnMaterial() const
 {
-  return hasOwnMaterial;
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+    return aPresentation->IsHasOwnMaterial();
+
+  return Standard_False;
 }
 
+
 //=======================================================================
-//function :UnsetMaterial
+//function : UnsetMaterial
 //purpose  : 
 //=======================================================================
 void TPrsStd_AISPresentation::UnsetMaterial()
 {
-  // OCC2932 correction
-  if(hasOwnMaterial == Standard_False && !myAIS.IsNull()) {
-      if(!myAIS->HasMaterial())
-       return;
-  }
-    
-  Backup();
-  hasOwnMaterial = Standard_False;
-  if( myAIS.IsNull() ) AISUpdate();
-  if( !myAIS.IsNull() &&  myAIS->HasMaterial() ) {
-    Handle(AIS_InteractiveContext) ctx;
-    Handle(TPrsStd_AISViewer) viewer;
-    if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext(); 
-    if( !ctx.IsNull() )   
-      ctx->UnsetMaterial(myAIS, Standard_False);
-    else  
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( !FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+    return;
+
+  if ( !aPresentation->IsHasOwnMaterial() )
+    if( !myAIS.IsNull() && !myAIS->HasMaterial() )
+      return;
+
+  aPresentation->UnsetMaterial();
+
+  if ( myAIS.IsNull() )
+    AISUpdate();
+
+  if ( !myAIS.IsNull() && myAIS->HasMaterial() )
+  {
+    Handle(AIS_InteractiveContext) aContext = getAISContext();
+
+    if ( !aContext.IsNull() )
+      aContext->UnsetMaterial(myAIS, Standard_False);
+    else
       myAIS->UnsetMaterial();
   }
 }
 
+
 //=======================================================================
-//function :SetMaterial
+//function : SetMaterial
 //purpose  : 
 //=======================================================================
-void TPrsStd_AISPresentation::SetMaterial(const Graphic3d_NameOfMaterial aName) 
+void TPrsStd_AISPresentation::SetMaterial(const Graphic3d_NameOfMaterial theName)
 {
-  // OCC2932 correction
-  if(myMaterial == aName && hasOwnMaterial == Standard_True && !myAIS.IsNull()) {
-      if(myAIS->HasMaterial() && myAIS->Material() == aName)
-       return;
-  }
+  const Standard_Integer aName = static_cast<Standard_Integer>(theName);
 
-  Backup();
-  myMaterial = aName;
-  hasOwnMaterial = Standard_True;
-  if( myAIS.IsNull() ) AISUpdate();
-  if( !myAIS.IsNull() ) { 
-    if( myAIS->HasMaterial() && myAIS->Material() == aName ) return;   // AIS has already had that material     
-    Handle(AIS_InteractiveContext) ctx;
-    Handle(TPrsStd_AISViewer) viewer;
-    if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext(); 
-    if( !ctx.IsNull() )   
-      ctx->SetMaterial(myAIS, aName,  Standard_False);
-    else  
-      myAIS->SetMaterial(aName);
+  Handle(TDataXtd_Presentation) aPresentation = getData();
+
+  if ( aPresentation->IsHasOwnMode() && aPresentation->Material() == aName )
+    if ( !myAIS.IsNull() && myAIS->HasMaterial() && myAIS->Material() == theName )
+      return;
+
+  aPresentation->SetMaterial(aName);
+
+  if ( myAIS.IsNull() )
+    AISUpdate();
+
+  if ( !myAIS.IsNull() )
+  {
+    if ( myAIS->HasMaterial() && myAIS->Material() == theName )
+      return;   // AIS has already had that material
+
+    Handle(AIS_InteractiveContext) aContext = getAISContext();
+
+    if ( !aContext.IsNull() )
+      aContext->SetMaterial(myAIS, theName,  Standard_False);
+    else
+      myAIS->SetMaterial(theName);
   }
 }
 
 
 //=======================================================================
-//function :SetTransparency
+//function :Transparency
 //purpose  : 
 //=======================================================================
-void TPrsStd_AISPresentation::SetTransparency(const Standard_Real aValue) 
+Standard_Real TPrsStd_AISPresentation::Transparency() const
 {
-  // OCC2932 correction
-  if(hasOwnTransparency == Standard_True && myTransparency == aValue && !myAIS.IsNull())
-      if(myAIS->Transparency() == aValue)
-       return;
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+    return aPresentation->Transparency();
 
-  Backup();
-  myTransparency = aValue;
-  hasOwnTransparency = Standard_True;
-  if( myAIS.IsNull() ) AISUpdate(); 
-  if( !myAIS.IsNull() ) { 
-    if( myAIS->Transparency() == aValue ) return;   // AIS has already had that transparency 
-    Handle(AIS_InteractiveContext) ctx;
-    Handle(TPrsStd_AISViewer) viewer;
-    if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext();
-    if( !ctx.IsNull() )  
-      ctx->SetTransparency(myAIS, aValue, Standard_False);
-    else 
-      myAIS->SetTransparency(aValue);
-  }
+  return 0.0;
 }
 
 
 //=======================================================================
-//function :Transparency
+//function :SetTransparency
 //purpose  : 
 //=======================================================================
-Standard_Real TPrsStd_AISPresentation::Transparency() const
+void TPrsStd_AISPresentation::SetTransparency(const Standard_Real theValue)
 {
-  return myTransparency;
+  Handle(TDataXtd_Presentation) aPresentation = getData();
+
+  if( aPresentation->IsHasOwnTransparency() && aPresentation->Transparency() == theValue )
+    if ( !myAIS.IsNull() && myAIS->Transparency() == theValue )
+      return;
+
+  aPresentation->SetTransparency(theValue);
+
+  if ( myAIS.IsNull() )
+    AISUpdate();
+
+  if ( !myAIS.IsNull() )
+  {
+    if ( myAIS->Transparency() == theValue )
+      return;   // AIS has already had that transparency 
+
+    Handle(AIS_InteractiveContext) aContext = getAISContext();
+
+    if ( !aContext.IsNull() )
+      aContext->SetTransparency(myAIS, theValue, Standard_False);
+    else
+      myAIS->SetTransparency(theValue);
+  }
 }
 
+
 //=======================================================================
 //function :UnsetTransparency
 //purpose  : 
 //=======================================================================
 void TPrsStd_AISPresentation::UnsetTransparency()
 {
-  // OCC2932 correction
-  if(!hasOwnTransparency)
-    return;
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+  {
+    if ( !aPresentation->IsHasOwnTransparency() )
+      return;
 
-  Backup(); 
-  hasOwnTransparency = Standard_False;
-  if( myAIS.IsNull() ) AISUpdate();
-  if( !myAIS.IsNull() ) {
-    Handle(AIS_InteractiveContext) ctx;
-    Handle(TPrsStd_AISViewer) viewer;
-    if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext(); 
-    if( !ctx.IsNull() )   
-      ctx->UnsetTransparency(myAIS, Standard_False);
-    else  
+    aPresentation->UnsetTransparency();
+  }
+
+  if ( myAIS.IsNull() )
+    AISUpdate();
+
+  if ( !myAIS.IsNull() )
+  {
+    Handle(AIS_InteractiveContext) aContext = getAISContext();
+
+    if( !aContext.IsNull() )
+      aContext->UnsetTransparency(myAIS, Standard_False);
+    else
       myAIS->UnsetTransparency();
   }
 }
 
+
 //=======================================================================
-//function :HasTransparency
+//function : HasTransparency
 //purpose  : 
 //=======================================================================
 Standard_Boolean TPrsStd_AISPresentation::HasOwnTransparency() const
 {
-  return hasOwnTransparency;
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+    return aPresentation->IsHasOwnTransparency();
+
+  return Standard_False;
 }
 
+
 //=======================================================================
-//function :Color
+//function : Color
 //purpose  : 
 //=======================================================================
 Quantity_NameOfColor TPrsStd_AISPresentation::Color() const
 {
-  return myColor;
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+    return static_cast<Quantity_NameOfColor>(aPresentation->Color());
+
+  return Quantity_NOC_WHITE;
 }
 
 //=======================================================================
-//function :HasColor
+//function : HasOwnColor
 //purpose  : 
 //=======================================================================
 Standard_Boolean TPrsStd_AISPresentation::HasOwnColor() const
 {
-  return hasOwnColor;
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+    return aPresentation->IsHasOwnColor();
+
+  return Standard_False;
 }
 
+
 //=======================================================================
-//function :UnsetColor
+//function : UnsetColor
 //purpose  : 
 //=======================================================================
 void TPrsStd_AISPresentation::UnsetColor()
 {
-  // OCC2932 correction
-  if(!hasOwnColor && !myAIS.IsNull()) 
-      if(!myAIS->HasColor())
-       return;
-  
-  Backup();
-  hasOwnColor = Standard_False;
-  if( myAIS.IsNull() ) AISUpdate();
-  if( !myAIS.IsNull() &&  myAIS->HasColor() ) {
-    Handle(AIS_InteractiveContext) ctx;
-    Handle(TPrsStd_AISViewer) viewer;
-    if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext(); 
-    if( !ctx.IsNull() )   
-      ctx->UnsetColor(myAIS, Standard_False);
-    else  
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+  {
+    if ( aPresentation->IsHasOwnColor() )
+      if ( !myAIS.IsNull() && !myAIS->HasColor() )
+        return;
+
+    aPresentation->UnsetColor();
+  }
+
+  if ( myAIS.IsNull() )
+    AISUpdate();
+
+  if ( !myAIS.IsNull() && myAIS->HasColor() )
+  {
+    Handle(AIS_InteractiveContext) aContext = getAISContext();
+
+    if ( !aContext.IsNull() )
+      aContext->UnsetColor(myAIS, Standard_False);
+    else
       myAIS->UnsetColor();
   }
 }
 
+
 //=======================================================================
-//function :SetColor
+//function : SetColor
 //purpose  : 
 //=======================================================================
-void TPrsStd_AISPresentation::SetColor(const Quantity_NameOfColor aColor) 
+void TPrsStd_AISPresentation::SetColor(const Quantity_NameOfColor theColor)
 {
-  // OCC2932 correction
-  if(hasOwnColor && myColor == aColor && ! myAIS.IsNull()) 
-    if(myAIS->HasColor() && myAIS->Color() == aColor ) 
+  Handle(TDataXtd_Presentation) aPresentation = getData();
+
+  const Standard_Integer aColor = static_cast<Standard_Integer>(theColor);
+  if ( aPresentation->IsHasOwnColor() && aPresentation->Color() == aColor )
+    if ( !myAIS.IsNull() && myAIS->HasColor() && myAIS->Color() == theColor )
       return;
-  
-  Backup();
-  myColor = aColor;
-  hasOwnColor = Standard_True;
-  if( myAIS.IsNull() ) AISUpdate();
-  if( !myAIS.IsNull() ) {
-    if( myAIS->HasColor() && myAIS->Color() == aColor ) return;   // AIS has already had that color     
-    Handle(AIS_InteractiveContext) ctx;
-    Handle(TPrsStd_AISViewer) viewer;
-    if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext();
-    if( !ctx.IsNull() )  
-      ctx->SetColor(myAIS, aColor, Standard_False);
+
+  aPresentation->SetColor(aColor);
+
+  if ( myAIS.IsNull() )
+    AISUpdate();
+
+  if ( !myAIS.IsNull() )
+  {
+    if ( myAIS->HasColor() && myAIS->Color() == theColor )
+      return;   // AIS has already had that color
+
+    Handle(AIS_InteractiveContext) aContext = getAISContext();
+
+    if( !aContext.IsNull() )
+      aContext->SetColor(myAIS, theColor, Standard_False);
     else 
-      myAIS->SetColor(aColor);
+      myAIS->SetColor(theColor);
   }
 }
 
@@ -404,208 +468,273 @@ void TPrsStd_AISPresentation::SetColor(const Quantity_NameOfColor aColor)
 //=======================================================================
 Standard_Real TPrsStd_AISPresentation::Width() const
 {
-   return myWidth;
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+    return aPresentation->Width();
+
+  return 0.0;
 }
 
+
 //=======================================================================
-//function :HasWidth
+//function : HasWidth
 //purpose  : 
 //=======================================================================
 Standard_Boolean TPrsStd_AISPresentation::HasOwnWidth() const
 {
-  return hasOwnWidth;
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+    return aPresentation->IsHasOwnWidth();
+
+  return Standard_False;
 }
 
+
 //=======================================================================
-//function :SetWidth
+//function : SetWidth
 //purpose  : 
 //=======================================================================
-void TPrsStd_AISPresentation::SetWidth(const Standard_Real aWidth) 
+void TPrsStd_AISPresentation::SetWidth(const Standard_Real theWidth)
 {
-  // OCC2932 correction
-  if(hasOwnWidth && myWidth == aWidth && myAIS.IsNull()) 
-    if(myAIS->HasWidth() && myAIS->Width() == aWidth ) 
+  Handle(TDataXtd_Presentation) aPresentation = getData();
+
+  if ( aPresentation->IsHasOwnWidth() && aPresentation->Width() == theWidth )
+    if ( !myAIS.IsNull() && myAIS->HasWidth() && myAIS->Width() == theWidth )
       return;
 
-  Backup();
-  myWidth = aWidth;
-  hasOwnWidth = Standard_True;
-  if( myAIS.IsNull() ) AISUpdate();
-  if( !myAIS.IsNull() ) {
-    if( myAIS->HasWidth() && myAIS->Width() == aWidth ) return;   // AIS has already had that width     
-    Handle(AIS_InteractiveContext) ctx;
-    Handle(TPrsStd_AISViewer) viewer;
-    if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext();
-    if( !ctx.IsNull() )  
-      ctx->SetWidth(myAIS, aWidth, Standard_False);
+  aPresentation->SetWidth(theWidth);
+
+  if( !myAIS.IsNull() )
+  {
+    if ( myAIS->HasWidth() && myAIS->Width() == theWidth )
+      return;   // AIS has already had that width
+
+    Handle(AIS_InteractiveContext) aContext = getAISContext();
+
+    if( !aContext.IsNull() )
+      aContext->SetWidth(myAIS, theWidth, Standard_False);
     else 
-      myAIS->SetWidth(aWidth);
+      myAIS->SetWidth(theWidth);
   }
 }
 
+
 //=======================================================================
-//function :UnsetWidth
+//function : UnsetWidth
 //purpose  : 
 //=======================================================================
 void TPrsStd_AISPresentation::UnsetWidth()
 {
-  // OCC2932 correction
-  if(!hasOwnWidth && !myAIS.IsNull())
-    if(!myAIS->HasWidth())
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( !FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+  {
+    // create new
+    return;
+  }
+
+  if ( !aPresentation->IsHasOwnWidth() )
+    if ( !myAIS.IsNull() && !myAIS->HasWidth() )
       return;
 
-  Backup();
-  hasOwnWidth = Standard_False;
-  if( myAIS.IsNull() ) AISUpdate();
-  if( !myAIS.IsNull() &&  myAIS->HasWidth() ) {
-    Handle(AIS_InteractiveContext) ctx;
-    Handle(TPrsStd_AISViewer) viewer;
-    if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext(); 
-    if( !ctx.IsNull() )   
-      ctx->UnsetWidth(myAIS, Standard_False);
-    else  
+  aPresentation->UnsetWidth();
+
+  if( myAIS.IsNull() )
+    AISUpdate();
+
+  if ( !myAIS.IsNull() && myAIS->HasWidth() )
+  {
+    Handle(AIS_InteractiveContext) aContext = getAISContext();
+
+    if ( !aContext.IsNull() )
+      aContext->UnsetWidth(myAIS, Standard_False);
+    else
       myAIS->UnsetWidth();
   }
 }
 
 
-
 //=======================================================================
 //function : Mode
 //purpose  : 
 //=======================================================================
-
 Standard_Integer TPrsStd_AISPresentation::Mode() const
 {
-   return myMode;
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+    return aPresentation->Mode();
+
+  return 0;
 }
 
+
 //=======================================================================
-//function :HasOwnMode
+//function : HasOwnMode
 //purpose  : 
 //=======================================================================
 Standard_Boolean TPrsStd_AISPresentation::HasOwnMode() const
 {
-  return hasOwnMode;
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+    return aPresentation->IsHasOwnMode();
+
+  return Standard_False;
 }
 
+
 //=======================================================================
-//function :SetMode
+//function : SetMode
 //purpose  : 
 //=======================================================================
-void TPrsStd_AISPresentation::SetMode(const Standard_Integer theMode) 
+void TPrsStd_AISPresentation::SetMode(const Standard_Integer theMode)
 {
-  // OCC2932 correction
-  if(hasOwnMode && myMode == theMode && !myAIS.IsNull()) 
-    if(myAIS->DisplayMode() == theMode ) 
+  Handle(TDataXtd_Presentation) aPresentation = getData();
+
+  if ( aPresentation->IsHasOwnMode() && aPresentation->Mode() == theMode )
+    if ( !myAIS.IsNull() && myAIS->DisplayMode() == theMode )
       return;
 
-  Backup();
-  myMode = theMode;
-  hasOwnMode = Standard_True;
-  if( myAIS.IsNull() ) AISUpdate();
-  if( !myAIS.IsNull() ) {
-    if(  myAIS->DisplayMode() == theMode ) return;   // AIS has already had that mode    
-    Handle(AIS_InteractiveContext) ctx;
-    Handle(TPrsStd_AISViewer) viewer;
-    if( TPrsStd_AISViewer::Find(Label(), viewer) )
-      ctx = viewer->GetInteractiveContext();
-    if( !ctx.IsNull() )  
-      ctx->SetDisplayMode(myAIS, theMode, Standard_False);
+  aPresentation->SetMode(theMode);
+
+  if ( myAIS.IsNull() )
+    AISUpdate();
+
+  if ( !myAIS.IsNull() )
+  {
+    if (  myAIS->DisplayMode() == theMode )
+      return;   // AIS has already had that mode
+
+    Handle(AIS_InteractiveContext) aContext = getAISContext();
+
+    if( !aContext.IsNull() )
+      aContext->SetDisplayMode(myAIS, theMode, Standard_False);
     else 
       myAIS->SetDisplayMode(theMode);
   }
 }
 
+
 //=======================================================================
-//function :UnsetMode
+//function : UnsetMode
 //purpose  : 
 //=======================================================================
 void TPrsStd_AISPresentation::UnsetMode()
 {
-  // OCC2932 correction
-  if(HasOwnMode() == Standard_False && myAIS.IsNull() == Standard_False)
-    if(!myAIS->HasDisplayMode())
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( !FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+    return;
+
+  if ( !aPresentation->IsHasOwnMode() )
+    if ( !myAIS.IsNull() && !myAIS->HasDisplayMode() )
       return;
 
-  Backup();
-  hasOwnMode = Standard_False;
-  if( myAIS.IsNull() ) AISUpdate();
-  if( !myAIS.IsNull() &&  myAIS->HasDisplayMode() ) {
-       Handle(AIS_InteractiveContext) ctx;
-       Handle(TPrsStd_AISViewer) viewer;
-       if( TPrsStd_AISViewer::Find(Label(), viewer) )
-       ctx = viewer->GetInteractiveContext(); 
-       if( !ctx.IsNull() )
-        ctx->UnsetDisplayMode(myAIS, Standard_False);
-    else  
-               myAIS->UnsetDisplayMode();
+  aPresentation->UnsetMode();
+
+  if ( myAIS.IsNull() )
+    AISUpdate();
+
+  if( !myAIS.IsNull() &&  myAIS->HasDisplayMode() )
+  {
+    Handle(AIS_InteractiveContext) aContext = getAISContext();
+
+    if ( !aContext.IsNull() )
+      aContext->UnsetDisplayMode(myAIS, Standard_False);
+    else
+      myAIS->UnsetDisplayMode();
   }
 }
 
+
 //=======================================================================
 //function : SelectionMode
 //purpose  : 
 //=======================================================================
-
 Standard_Integer TPrsStd_AISPresentation::SelectionMode() const
 {
-   return mySelectionMode;
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+    return aPresentation->SelectionMode();
+
+  return 0;
 }
 
+
 //=======================================================================
-//function :HasOwnSelectionMode
+//function : HasOwnSelectionMode
 //purpose  : 
 //=======================================================================
 Standard_Boolean TPrsStd_AISPresentation::HasOwnSelectionMode() const
 {
-  return hasOwnSelectionMode;
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+    return aPresentation->IsHasOwnSelectionMode();
+
+  return Standard_False;
 }
 
+
 //=======================================================================
-//function :SetSelectionMode
+//function : SetSelectionMode
 //purpose  : 
 //=======================================================================
-void TPrsStd_AISPresentation::SetSelectionMode(const Standard_Integer theSelectionMode) 
+void TPrsStd_AISPresentation::SetSelectionMode(const Standard_Integer theSelectionMode)
 {
-  // OCC2932 correction
-  if(hasOwnSelectionMode && mySelectionMode == theSelectionMode && !myAIS.IsNull())
-    if(myAIS->SelectionMode() == theSelectionMode )
+  Handle(TDataXtd_Presentation) aPresentation = getData();
+
+  if ( aPresentation->IsHasOwnSelectionMode() &&
+       aPresentation->SelectionMode() == theSelectionMode )
+  {
+    if ( !myAIS.IsNull() && myAIS->SelectionMode() == theSelectionMode )
+      return;
+  }
+
+  aPresentation->SetSelectionMode(theSelectionMode);
+
+  if ( myAIS.IsNull() )
+    AISUpdate();
+
+  if ( !myAIS.IsNull() )
+  {
+    if ( myAIS->SelectionMode() == theSelectionMode )
       return;
 
-  Backup();
-  mySelectionMode = theSelectionMode;
-  hasOwnSelectionMode = Standard_True;
-  if( myAIS.IsNull() ) AISUpdate();
-  if( !myAIS.IsNull() ) {
-    if(  myAIS->SelectionMode() == theSelectionMode ) return;
     myAIS->SetSelectionMode(theSelectionMode);
   }
 }
 
+
 //=======================================================================
-//function :UnsetSelectionMode
+//function : UnsetSelectionMode
 //purpose  : 
 //=======================================================================
 void TPrsStd_AISPresentation::UnsetSelectionMode()
 {
-  if(!hasOwnSelectionMode && !myAIS.IsNull())
-    if(!myAIS->HasSelectionMode())
-      return;
+  Handle(TDataXtd_Presentation) aPresentation;
+  if ( FindAttribute(TDataXtd_Presentation::GetID(), aPresentation) )
+  {
 
-  Backup();
-  hasOwnSelectionMode = Standard_False;
-  if( myAIS.IsNull() ) AISUpdate();
-  if( !myAIS.IsNull() &&  myAIS->HasSelectionMode() ) {
-    myAIS->UnsetSelectionMode();
+    if ( !aPresentation->IsHasOwnSelectionMode() )
+      if ( !myAIS.IsNull() && !myAIS->HasSelectionMode() )
+        return;
+
+    aPresentation->UnsetSelectionMode();
   }
+
+  if ( myAIS.IsNull() )
+    AISUpdate();
+
+  if ( !myAIS.IsNull() && myAIS->HasSelectionMode() )
+    myAIS->UnsetSelectionMode();
 }
 
+
 //=======================================================================
 //function : ID
 //purpose  : 
 //=======================================================================
-const Standard_GUID& TPrsStd_AISPresentation::ID() const { return GetID(); }
+const Standard_GUID& TPrsStd_AISPresentation::ID() const
+{
+  return GetID();
+}
 
 
 //=======================================================================
@@ -614,23 +743,7 @@ const Standard_GUID& TPrsStd_AISPresentation::ID() const { return GetID(); }
 //=======================================================================
 Handle(TDF_Attribute) TPrsStd_AISPresentation::BackupCopy() const 
 {
-  Handle(TPrsStd_AISPresentation) copy = new TPrsStd_AISPresentation;
-  copy->myTransparency = myTransparency;
-  copy->myColor = myColor;
-  copy->myMode= myMode;
-  copy->myWidth= myWidth;
-  copy->myMaterial = myMaterial;
-  copy->hasOwnColor = hasOwnColor;
-  copy->hasOwnMaterial = hasOwnMaterial;
-  copy->hasOwnWidth = hasOwnWidth;
-  copy->hasOwnMode=hasOwnMode;
-  copy->hasOwnTransparency = hasOwnTransparency;
-  copy->myAIS.Nullify();
-  copy->isDisplayed = isDisplayed;
-  copy->myDriverGUID = myDriverGUID;
-  copy->mySelectionMode= mySelectionMode;
-  copy->hasOwnSelectionMode = hasOwnSelectionMode;
-  return copy; 
+  return new TPrsStd_AISPresentation;
 }
 
 
@@ -640,140 +753,68 @@ Handle(TDF_Attribute) TPrsStd_AISPresentation::BackupCopy() const
 //=======================================================================
 Handle(TDF_Attribute) TPrsStd_AISPresentation::NewEmpty() const
 {   
-  return new TPrsStd_AISPresentation ();
+  return new TPrsStd_AISPresentation();
 }
 
+
 //=======================================================================
-//function : Restore
+//function : Paste
 //purpose  : 
 //=======================================================================
-void TPrsStd_AISPresentation::Restore (const Handle(TDF_Attribute)& With) 
-{ 
-  Handle(TPrsStd_AISPresentation) with = Handle(TPrsStd_AISPresentation)::DownCast(With);
+void TPrsStd_AISPresentation::Restore(const Handle(TDF_Attribute)& theWith)
+{
+  Handle(TPrsStd_AISPresentation) aWith =
+    Handle(TPrsStd_AISPresentation)::DownCast(theWith);
 
   myAIS.Nullify();
-
-  if(!with->HasOwnMaterial()) hasOwnMaterial = Standard_False;
-  else { 
-    hasOwnMaterial = Standard_True;
-  }
-  myMaterial = with->Material();
-
-  if(!with->HasOwnColor()) hasOwnColor = Standard_False;
-  else { 
-    hasOwnColor = Standard_True;
-  }
-  myColor = with->Color(); 
-
-  if(!with->HasOwnWidth()) hasOwnWidth = Standard_False;
-  else { 
-    hasOwnWidth = Standard_True;
-  }
-  myWidth = with->Width();
-
- if(!with->HasOwnMode()) hasOwnMode = Standard_False;
-  else { 
-    hasOwnMode = Standard_True;
-  }
-  myMode = with->Mode();
-  
-  if(!with->HasOwnSelectionMode()) hasOwnSelectionMode = Standard_False;
-  else { 
-    hasOwnSelectionMode = Standard_True;
-  }
-  mySelectionMode = with->SelectionMode();
-
-  if(!with->HasOwnTransparency()) hasOwnTransparency = Standard_False;
-  else { 
-    hasOwnTransparency = Standard_True;
-  }
-  myTransparency = with->Transparency();
-
-  isDisplayed = with->IsDisplayed();
-  myDriverGUID  = with->GetDriverGUID();
+  myDriverGUID  = aWith->GetDriverGUID();
 }
 
+
 //=======================================================================
 //function : Paste
 //purpose  : 
 //=======================================================================
-void TPrsStd_AISPresentation::Paste (const Handle(TDF_Attribute)& Into,
-                                    const Handle(TDF_RelocationTable)& ) const
-{  
-  Handle(TPrsStd_AISPresentation) into = Handle(TPrsStd_AISPresentation)::DownCast(Into);
-  
-  into->Backup();
-
-  if(!hasOwnMaterial) into->hasOwnMaterial = Standard_False;
-  else {
-    into->myMaterial = myMaterial;
-    into->hasOwnMaterial = Standard_True;
-  }
-
-  if(!hasOwnColor) into->hasOwnColor = Standard_False;
-  else {
-    into->myColor = myColor; 
-    into->hasOwnColor = Standard_True;
-  }
-
-  if(!hasOwnWidth) into->hasOwnWidth = Standard_False;
-  else {
-    into->myWidth = myWidth;
-    into->hasOwnWidth = Standard_True;
-  }
- if(!hasOwnMode) into->hasOwnMode = Standard_False;
-  else {
-    into->myMode = myMode;
-    into->hasOwnMode = Standard_True;
-  }
-
- if(!hasOwnSelectionMode) into->hasOwnSelectionMode = Standard_False;
-  else {
-    into->mySelectionMode = mySelectionMode;
-    into->hasOwnSelectionMode = Standard_True;
-  }
-
-  if(!hasOwnTransparency) into->hasOwnTransparency = Standard_False;
-  else {
-    into->myTransparency = myTransparency;
-    into->hasOwnTransparency = Standard_True;
-  }
-
-  if (into->isDisplayed)
-    into->AISErase(Standard_True);
-
-  into->isDisplayed = isDisplayed;   
-  into->myDriverGUID = myDriverGUID;
+void TPrsStd_AISPresentation::Paste (const Handle(TDF_Attribute)& theInto,
+                                     const Handle(TDF_RelocationTable)& ) const
+{
+  Handle(TPrsStd_AISPresentation) anInto =
+    Handle(TPrsStd_AISPresentation)::DownCast(theInto);
 
-  into->myAIS.Nullify();
+  anInto->Backup();
+  anInto->myAIS.Nullify();
 }
 
+
 //=======================================================================
 //function : AfterAddition
 //purpose  : erase if displayed
 //=======================================================================
 void TPrsStd_AISPresentation::AfterAddition() 
-{ 
+{
   AfterResume();
 }
 
+
 //=======================================================================
 //function : BeforeRemoval
 //purpose  : erase if displayed
 //=======================================================================
 void TPrsStd_AISPresentation::BeforeRemoval() 
-{ 
-   BeforeForget();
+{
+  BeforeForget();
 }
 
+
 //=======================================================================
 //function : BeforeForget
 //purpose  : erase if displayed
 //=======================================================================
 void TPrsStd_AISPresentation::BeforeForget() 
 { 
-  if( !myAIS.IsNull() ) {
-    AISErase(Standard_True);   //Remove AISObject from context
+  if ( !myAIS.IsNull() )
+  { // Remove AISObject from context.
+    AISErase(Standard_True);
     myAIS.Nullify();
   }
 }
@@ -783,32 +824,39 @@ void TPrsStd_AISPresentation::BeforeForget()
 //function : AfterResume
 //purpose  : display if displayed
 //=======================================================================
-void TPrsStd_AISPresentation::AfterResume() 
+void TPrsStd_AISPresentation::AfterResume()
 {
   AISUpdate();
-  if( IsDisplayed() ) AISDisplay();
-  else AISErase();
+
+  if ( IsDisplayed() )
+    AISDisplay();
+  else
+    AISErase();
 }
 
+
 //=======================================================================
 //function : BeforeUndo
 //purpose  : le NamedShape associe doit etre present
 //=======================================================================
-
 Standard_Boolean TPrsStd_AISPresentation::BeforeUndo (const Handle(TDF_AttributeDelta)& AD,
-                                                     const Standard_Boolean ) 
+                                                      const Standard_Boolean ) 
 {
   Handle(TPrsStd_AISPresentation) P;
-  AD->Label().FindAttribute(TPrsStd_AISPresentation::GetID(), P); 
+  AD->Label().FindAttribute(TPrsStd_AISPresentation::GetID(), P);
 
-  if (AD->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) {    
-    if( !P.IsNull() ) P->BeforeForget();
+  if (AD->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition)))
+  {
+    if ( !P.IsNull() )
+      P->BeforeForget();
   }
   else if (AD->IsKind(STANDARD_TYPE(TDF_DefaultDeltaOnRemoval))) {
-  }  
-  else if (AD->IsKind(STANDARD_TYPE(TDF_DefaultDeltaOnModification))) {
-    if( !P.IsNull() ) P->BeforeForget();
-  } 
+  }
+  else if (AD->IsKind(STANDARD_TYPE(TDF_DefaultDeltaOnModification)))
+  {
+    if ( !P.IsNull() )
+      P->BeforeForget();
+  }
 
   return Standard_True;
 }
@@ -818,113 +866,134 @@ Standard_Boolean TPrsStd_AISPresentation::BeforeUndo (const Handle(TDF_Attribute
 //function : AfterUndo
 //purpose  : le NamedShape associe doit etre present
 //=======================================================================
-
 Standard_Boolean TPrsStd_AISPresentation::AfterUndo (const Handle(TDF_AttributeDelta)& AD,
-                                                    const Standard_Boolean ) 
+                                                     const Standard_Boolean ) 
 { 
   Handle(TPrsStd_AISPresentation) P;
   AD->Label().FindAttribute(TPrsStd_AISPresentation::GetID(), P);
 
-  if (AD->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) {
+  if (AD->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition)))
+  {}
+  else if (AD->IsKind(STANDARD_TYPE(TDF_DefaultDeltaOnRemoval)))
+  {
+    if ( !P.IsNull() )
+      P->AfterAddition();
   }
-  else if (AD->IsKind(STANDARD_TYPE(TDF_DefaultDeltaOnRemoval))) {  
-    if( !P.IsNull() ) P->AfterAddition();
-  }  
-  else if (AD->IsKind(STANDARD_TYPE(TDF_DefaultDeltaOnModification))) {
-    if( !P.IsNull() ) P->AfterResume();
+  else if (AD->IsKind(STANDARD_TYPE(TDF_DefaultDeltaOnModification)))
+  {
+    if ( !P.IsNull() )
+      P->AfterResume();
   }
 
   return Standard_True;
 }
 
 
-
 //=======================================================================
 //function : AISUpdate
 //purpose  : 
 //=======================================================================
-
-void TPrsStd_AISPresentation::AISUpdate ()
-{ 
+void TPrsStd_AISPresentation::AISUpdate()
+{
   Backup();
 
-  Handle(AIS_InteractiveContext) ctx;
-  if(!Label().IsNull()) {  
-    Handle(TPrsStd_AISViewer) viewer;
-    if( TPrsStd_AISViewer::Find(Label(), viewer) ) ctx = viewer->GetInteractiveContext();
-
-    Handle(TPrsStd_Driver) driver;
-    if (TPrsStd_DriverTable::Get()->FindDriver(GetDriverGUID(), driver)) {
-      if (myAIS.IsNull()) {              // build a new  AIS
-       Handle(AIS_InteractiveObject) newais;
-       if (driver->Update (Label(), newais))  {
-         myAIS = newais;
-         newais->SetOwner(this);
-       }
+  Handle(AIS_InteractiveContext) aContext;
+  if ( !Label().IsNull() )
+  {
+    aContext = getAISContext();
+
+    Handle(TPrsStd_Driver) aDriver;
+    if ( TPrsStd_DriverTable::Get()->FindDriver(GetDriverGUID(), aDriver) )
+    {
+      // Build a new  AIS.
+      if ( myAIS.IsNull() )
+      {
+        Handle(AIS_InteractiveObject) aNewObj;
+        if ( aDriver->Update(Label(), aNewObj) )
+        {
+          myAIS = aNewObj;
+          aNewObj->SetOwner(this);
+        }
       }
-      else {
-       Handle(AIS_InteractiveObject) theais = myAIS;
-       if (driver->Update (Label(), theais)) {
-         if (! (theais ==  myAIS)) {    
-           if(!ctx.IsNull()) ctx->Remove(myAIS);
-           myAIS = theais;               //Driver has built new AIS
-           theais->SetOwner(this);
-         }
-       }
+      else
+      {
+        Handle(AIS_InteractiveObject) anObj = myAIS;
+        if ( aDriver->Update(Label(), anObj) )
+          if ( !(anObj ==  myAIS) )
+          {
+            if ( !aContext.IsNull() )
+              aContext->Remove(myAIS);
+
+            // Driver has built new AIS.
+            myAIS = anObj;
+            anObj->SetOwner(this);
+          }
       }
     }
   }
   else return;
 
-//Apply the visualization settings
-  if( !myAIS.IsNull() ) {
-
-    if( hasOwnColor ) { 
-      if( !(myAIS->HasColor()) || (myAIS->HasColor() && myAIS->Color() != myColor) ) {
-       if(!ctx.IsNull()) ctx->SetColor(myAIS, myColor, Standard_False);
-       else myAIS->SetColor(myColor);  
-      }
-    } 
+  // Apply the visualization settings.
+  if ( !myAIS.IsNull() )
+  {
+    if ( HasOwnColor() )
+    {
+      Quantity_NameOfColor aColor = Color();
+      if ( !(myAIS->HasColor()) || (myAIS->HasColor() && myAIS->Color() != aColor) )
+        if ( !aContext.IsNull() )
+          aContext->SetColor(myAIS, aColor, Standard_False);
+        else
+          myAIS->SetColor(aColor);
+    }
 
-    if( hasOwnMaterial ) { 
-      if( !(myAIS->HasMaterial()) || (myAIS->HasMaterial() && myAIS->Material() != myMaterial) ) {
-       if(!ctx.IsNull()) ctx->SetMaterial(myAIS, myMaterial, Standard_False );
-       else myAIS->SetMaterial(myMaterial);  
-      }
-    } 
-    
-    if( hasOwnTransparency ) {
-      if(  myAIS->Transparency() != myTransparency )  {
-       if(!ctx.IsNull()) ctx->SetTransparency(myAIS, myTransparency, Standard_False);
-       else myAIS->SetTransparency(myTransparency);  
-      }
+    if ( HasOwnMaterial() )
+    {
+      Graphic3d_NameOfMaterial aMaterial = Material();
+      if ( !(myAIS->HasMaterial()) || (myAIS->HasMaterial() && myAIS->Material() != aMaterial) )
+        if ( !aContext.IsNull() )
+          aContext->SetMaterial(myAIS, aMaterial, Standard_False );
+        else
+          myAIS->SetMaterial(aMaterial);
     }
 
-    if( hasOwnWidth ) { 
-      if( !(myAIS->HasWidth()) || (myAIS->HasWidth() && myAIS->Width() != myWidth) ) {
-       if(!ctx.IsNull()) ctx->SetWidth(myAIS, myWidth, Standard_False);
-       else myAIS->SetWidth(myWidth); 
-      }
+    if ( HasOwnTransparency() )
+    {
+      const Standard_Real aTransparency = Transparency();
+      if ( myAIS->Transparency() != aTransparency )
+        if( !aContext.IsNull() )
+          aContext->SetTransparency(myAIS, aTransparency, Standard_False);
+        else
+          myAIS->SetTransparency(aTransparency);
     }
 
-    if( hasOwnMode) { 
-      if(  myAIS->DisplayMode() != myMode ) {
-         myAIS->SetDisplayMode(myMode); 
-      } 
-     
-           
+    if ( HasOwnWidth() )
+    {
+      const Standard_Real aWidth = Width();
+      if ( !(myAIS->HasWidth()) || (myAIS->HasWidth() && myAIS->Width() != aWidth) )
+        if ( !aContext.IsNull() )
+          aContext->SetWidth(myAIS, aWidth, Standard_False);
+        else
+          myAIS->SetWidth(aWidth);
     }
 
-    if (hasOwnSelectionMode) { 
-      if (myAIS->SelectionMode() != mySelectionMode ) {
-       myAIS->SetSelectionMode(mySelectionMode); 
-      } 
+    if ( HasOwnMode() )
+    {
+      const Standard_Integer aMode = Mode();
+      if ( myAIS->DisplayMode() != aMode )
+        myAIS->SetDisplayMode(aMode);
     }
 
+    if ( HasOwnSelectionMode() )
+    {
+      const Standard_Integer aMode = SelectionMode();
+      if (myAIS->SelectionMode() != aMode )
+        myAIS->SetSelectionMode(aMode);
+    }
   }
-  
-  if( isDisplayed && !ctx.IsNull() ) ctx->Redisplay(myAIS, Standard_False);
+
+  if ( !aContext.IsNull() && IsDisplayed() )
+    aContext->Redisplay(myAIS, Standard_False);
+
   return;
 }
 
@@ -932,25 +1001,27 @@ void TPrsStd_AISPresentation::AISUpdate ()
 //function : AISDisplay
 //purpose  : 
 //=======================================================================
+void TPrsStd_AISPresentation::AISDisplay()
+{
+  if ( !Label().IsNull() )
+  {
+    Handle(AIS_InteractiveContext) aContext = getAISContext();
 
-void TPrsStd_AISPresentation::AISDisplay ()
-{   
-  
-  if (!Label().IsNull()) {  
-    Handle(TPrsStd_AISViewer) viewer;
-    if( !TPrsStd_AISViewer::Find(Label(), viewer) ) return;   
-    Handle(AIS_InteractiveContext) ctx = viewer->GetInteractiveContext();
-    if( ctx.IsNull() ) return;
-
-    if (!myAIS.IsNull()) { 
-
-      if( !(myAIS->GetContext()).IsNull() && (myAIS->GetContext()) != ctx ) myAIS->GetContext()->Remove(myAIS);
-      
-      if( isDisplayed && ctx->IsDisplayed(myAIS) ) return;
-
-      ctx->Display(myAIS, Standard_False);
-      
-      if( ctx->IsDisplayed(myAIS) ) SetDisplayed(Standard_True); 
+    if ( aContext.IsNull() )
+      return;
+
+    if ( !myAIS.IsNull() )
+    {
+      if ( !(myAIS->GetContext()).IsNull() && (myAIS->GetContext()) != aContext )
+        myAIS->GetContext()->Remove(myAIS);
+
+      if ( IsDisplayed() && aContext->IsDisplayed(myAIS) )
+        return;
+
+      aContext->Display(myAIS, Standard_False);
+
+      if ( aContext->IsDisplayed(myAIS) )
+        SetDisplayed(Standard_True);
     }
   }
 }
@@ -960,37 +1031,51 @@ void TPrsStd_AISPresentation::AISDisplay ()
 //function : AISErase
 //purpose  : 
 //=======================================================================
+void TPrsStd_AISPresentation::AISErase(const Standard_Boolean theIsRemove)
+{
+  SetDisplayed(Standard_False);
+  Handle(AIS_InteractiveContext) aContext, anOwnContext;
 
-void TPrsStd_AISPresentation::AISErase (const Standard_Boolean remove)
-{   
-  SetDisplayed(Standard_False);  
-  Handle(AIS_InteractiveContext) ctx, ownctx;
-
-  if ( !myAIS.IsNull() ) {   
-    
-    if ( !Label().IsNull()) {  
+  if ( !myAIS.IsNull() )
+  {
+    if ( !Label().IsNull() )
+    {
       Handle(TPrsStd_AISViewer) viewer;
-      if( !TPrsStd_AISViewer::Find(Label(), viewer) ) return;  
-      ownctx = myAIS->GetContext();
-      ctx = viewer->GetInteractiveContext();
-      if( remove ) {
-       if( !ctx.IsNull() ) ctx->Remove (myAIS,Standard_False); 
-       if( !ownctx.IsNull() && ownctx != ctx ) ownctx->Remove (myAIS,Standard_False);
+      if( !TPrsStd_AISViewer::Find(Label(), viewer) )
+        return;
+      anOwnContext = myAIS->GetContext();
+      aContext = viewer->GetInteractiveContext();
+
+      if ( theIsRemove )
+      {
+        if ( !aContext.IsNull() )
+          aContext->Remove(myAIS, Standard_False);
+        if ( !anOwnContext.IsNull() && anOwnContext != aContext )
+          anOwnContext->Remove(myAIS, Standard_False);
+
         myAIS->SetToUpdate();
       }
-      else {
-       if( !ctx.IsNull() ) ctx->Erase (myAIS,Standard_False); 
-       if( !ownctx.IsNull() && ownctx != ctx ) ownctx->Erase (myAIS,Standard_False);
+      else
+      {
+        if ( !aContext.IsNull() )
+          aContext->Erase(myAIS, Standard_False);
+        if ( !anOwnContext.IsNull() && anOwnContext != aContext )
+          anOwnContext->Erase(myAIS, Standard_False);
       }
     }
-    else {
-     if( remove ) {
-      if( !ownctx.IsNull() ) {
-       ownctx->Remove (myAIS,Standard_False);
-       myAIS->SetToUpdate();
+    else
+    {
+      if ( theIsRemove )
+      {
+        if ( !anOwnContext.IsNull() )
+        {
+          anOwnContext->Remove(myAIS, Standard_False);
+          myAIS->SetToUpdate();
+        }
       }
-     } else
-      if( !ownctx.IsNull() ) ownctx->Erase (myAIS,Standard_False); 
+      else
+        if( !anOwnContext.IsNull() )
+          anOwnContext->Erase(myAIS, Standard_False);
     }
   }
 }
@@ -1007,12 +1092,24 @@ Handle(AIS_InteractiveObject) TPrsStd_AISPresentation::GetAIS() const
 
 
 //=======================================================================
-//function :SetDisplayed
+//function : getAISContext
 //purpose  : 
 //=======================================================================
-void TPrsStd_AISPresentation::SetDisplayed(const Standard_Boolean B) 
+Handle(AIS_InteractiveContext) TPrsStd_AISPresentation::getAISContext() const
 {
-  Backup();
-  isDisplayed = B;
+  Handle(TPrsStd_AISViewer) aViewer;
+  if ( TPrsStd_AISViewer::Find(Label(), aViewer) )
+    return aViewer->GetInteractiveContext();
+
+  return Handle_AIS_InteractiveContext();
 }
 
+
+//=======================================================================
+//function : getData
+//purpose  : 
+//=======================================================================
+Handle(TDataXtd_Presentation) TPrsStd_AISPresentation::getData() const
+{
+  return TDataXtd_Presentation::Set(this);
+}
index 5f2e9163c5dab1055f4f3cfb74b71a48ef243fff..9a92a3381bfc2fed74851b4848f7fe1f235153fe 100644 (file)
@@ -33,7 +33,7 @@ const Standard_GUID& TPrsStd_AISViewer::GetID ()
 //=======================================================================
 
 Handle(TPrsStd_AISViewer) TPrsStd_AISViewer::New (const TDF_Label& acces, 
-                                                 const Handle(V3d_Viewer)& viewer)
+                                                  const Handle(V3d_Viewer)& viewer)
 {   
   Handle(TPrsStd_AISViewer) V;
   if (acces.Root().FindAttribute(TPrsStd_AISViewer::GetID(),V)) { 
@@ -50,7 +50,7 @@ Handle(TPrsStd_AISViewer) TPrsStd_AISViewer::New (const TDF_Label& acces,
 //purpose  : 
 //=======================================================================
 Handle(TPrsStd_AISViewer) TPrsStd_AISViewer::New (const TDF_Label& acces, 
-                                                 const Handle(AIS_InteractiveContext)& IC) 
+                                                  const Handle(AIS_InteractiveContext)& IC) 
 {   
   Handle(TPrsStd_AISViewer) V;
   if (acces.Root().FindAttribute(TPrsStd_AISViewer::GetID(),V)) { 
@@ -67,7 +67,7 @@ Handle(TPrsStd_AISViewer) TPrsStd_AISViewer::New (const TDF_Label& acces,
 //purpose  : 
 //=======================================================================
 Standard_Boolean TPrsStd_AISViewer::Find (const TDF_Label& acces, 
-                                         Handle(TPrsStd_AISViewer)& V) 
+                                          Handle(TPrsStd_AISViewer)& V) 
 { 
   return (acces.Root().FindAttribute(TPrsStd_AISViewer::GetID(),V)); 
 }
@@ -77,7 +77,7 @@ Standard_Boolean TPrsStd_AISViewer::Find (const TDF_Label& acces,
 //purpose  : 
 //=======================================================================
 Standard_Boolean TPrsStd_AISViewer::Find (const TDF_Label& acces, 
-                                         Handle(AIS_InteractiveContext)& IC)
+                                          Handle(AIS_InteractiveContext)& IC)
 { 
   Handle(TPrsStd_AISViewer) V; 
   if (acces.Root().FindAttribute(TPrsStd_AISViewer::GetID(),V)) { 
@@ -93,7 +93,7 @@ Standard_Boolean TPrsStd_AISViewer::Find (const TDF_Label& acces,
 //=======================================================================
 
 Standard_Boolean TPrsStd_AISViewer::Find (const TDF_Label& acces, 
-                                         Handle(V3d_Viewer)& VIEW) 
+                                          Handle(V3d_Viewer)& VIEW) 
 { 
   Handle(TPrsStd_AISViewer) V;
   if (acces.Root().FindAttribute(TPrsStd_AISViewer::GetID(),V)) { 
@@ -139,9 +139,9 @@ TPrsStd_AISViewer::TPrsStd_AISViewer()
 
 void TPrsStd_AISViewer::Update () const
 {
-  myInteractiveContext->UpdateCurrentViewer();  
+  myInteractiveContext->UpdateCurrentViewer();
 }
+
 //=======================================================================
 //function : SetInteractiveContext
 //purpose  : 
@@ -196,7 +196,7 @@ Handle(TDF_Attribute) TPrsStd_AISViewer::NewEmpty() const
 //=======================================================================
 
 void TPrsStd_AISViewer::Paste (const Handle(TDF_Attribute)&,
-                            const Handle(TDF_RelocationTable)&) const
+                               const Handle(TDF_RelocationTable)&) const
 {
 }
 
index 2029372ca4da4727a18bdc0188b48d2856abb127..48504ca7caab8a7e3230bd10ae6882d43dfb8986 100644 (file)
@@ -21,8 +21,8 @@ is
     xgetenv(aCString: CString from Standard)
     returns ExtendedString from TCollection;
     
-    OpenFile(aFile: in out BaseDriver from Storage; aName: ExtendedString from TCollection; aMode : OpenMode from Storage)
-    returns Error from Storage;
+--    OpenFile(aFile: in out BaseDriver from Storage; aName: ExtendedString from TCollection; aMode : OpenMode from Storage)
+--    returns Error from Storage;
     
     AddToUserInfo(aData: Data from Storage; anInfo: ExtendedString from TCollection);
     
index 7b3ab129ee63047db7c1e3a918ab5574e5c5eb3e..c5272313b229523e116b977466274cb1dd228fed 100644 (file)
@@ -44,14 +44,14 @@ TCollection_ExtendedString UTL::Extension(const TCollection_ExtendedString& aFil
     theExtension.Remove(1, 1);
   return TCollection_ExtendedString(theExtension);
 }
-
+/*
 Storage_Error UTL::OpenFile(Storage_BaseDriver& aDriver, 
                             const TCollection_ExtendedString& aFileName, 
                             const Storage_OpenMode aMode) 
 {
   return aDriver.Open(TCollection_AsciiString(aFileName),aMode);
 }
-
+*/
 void UTL::AddToUserInfo(const Handle(Storage_Data)& aData, 
                         const TCollection_ExtendedString& anInfo) 
 {
index 27e94e64b0e3b83a75168d2c504c3b2ce07b89a9..dda6a176e15587e2f23a411043c6bf3f6f74bfd3 100644 (file)
@@ -23,7 +23,6 @@
 #include <XmlMDataXtd.hxx>
 #include <XmlMDocStd.hxx>
 #include <XmlMNaming.hxx>
-#include <XmlMPrsStd.hxx>
 #include <XmlMFunction.hxx>
 
 #include <Standard_GUID.hxx>
@@ -82,7 +81,6 @@ Handle(XmlMDF_ADriverTable) XmlDrivers::AttributeDrivers
   XmlMNaming    ::AddDrivers (aTable, theMessageDriver);
   XmlMFunction  ::AddDrivers (aTable, theMessageDriver); 
   XmlMDocStd    ::AddDrivers (aTable, theMessageDriver); 
-  XmlMPrsStd    ::AddDrivers (aTable, theMessageDriver); 
   //
   return aTable;
 }
index 9b4514ecb0cec4fe934a6913b80e8ff07bb1166b..17967a006b7e86f8920a51bc40c4bdfc436504cd 100644 (file)
@@ -17,6 +17,7 @@ package XmlLDrivers
 
 uses
     Standard,
+    Storage,
     TDF,
     TDocStd,
     TCollection,
index 53ea25c661557859ef06327d85a936b8c09bca9f..02fa668238d37e1ca18c694a894f02b478d2c875 100644 (file)
@@ -21,6 +21,7 @@ uses
     Document                   from PCDM,
     Document                   from CDM,
     Document                   from TDocStd,
+    IODevice          from Storage,
     Application                        from CDM,
     ADriver                    from XmlMDF, 
     ADriverTable               from XmlMDF,
@@ -45,7 +46,7 @@ is
        returns Document from CDM is redefined virtual;
     -- pure virtual method definition
 
-    Read(me:mutable; theFileName:    ExtendedString from TCollection;
+    Read(me:mutable; theDevice: IODevice from Storage;
                     theNewDocument: Document    from CDM;
                     theApplication: Application from CDM) is redefined virtual;
     -- 
@@ -78,6 +79,6 @@ is
 fields
     myDrivers  : ADriverTable          from XmlMDF      is protected;
     myRelocTable: RRelocationTable     from XmlObjMgt   is protected;
-    myFileName  : ExtendedString        from TCollection is protected;
+    myDevice  : IODevice from Storage is protected;
 
 end DocumentRetrievalDriver;
index 084d4c5dcb4e6646e6123b92d51cd89a90f69c77..255e5444d156720be95b0407a70b85e8b0714daf 100644 (file)
@@ -34,6 +34,9 @@
 #include <UTL.hxx>
 #include <OSD_Path.hxx>
 
+#include <Storage_File.hxx>
+#include <Storage_IStream.hxx>
+
 #ifdef WNT
 # include <tchar.h>
 #endif  // WNT
@@ -182,19 +185,52 @@ void XmlLDrivers_DocumentRetrievalDriver::Make (const Handle(PCDM_Document)&,
 //purpose  : 
 //=======================================================================
 void XmlLDrivers_DocumentRetrievalDriver::Read
-  (const TCollection_ExtendedString& theFileName,
+  (const Handle(Storage_IODevice)&   theDevice,
    const Handle(CDM_Document)&       theNewDocument,
    const Handle(CDM_Application)&    theApplication)
 {
   myReaderStatus = PCDM_RS_DriverFailure;
-  myFileName = theFileName;
   Handle(CDM_MessageDriver) aMessageDriver = theApplication -> MessageDriver();
   ::take_time (~0, " +++++ Start RETRIEVE procedures ++++++", aMessageDriver);
 
+  myDevice = theDevice;
+
   // 1. Read DOM_Document from file
   LDOMParser aParser;
-  TCollection_AsciiString aName (theFileName,'?');
-  if (aParser.parse(aName.ToCString()))
+
+  Standard_Boolean aRes = Standard_True;
+  Handle(Storage_File) aFile = Handle(Storage_File)::DownCast(myDevice);
+  if ( !aFile.IsNull() )
+  {
+    TCollection_AsciiString aPath( aFile->Path() );
+    aRes = aParser.parse( aPath.ToCString() );
+  }
+  else if ( !myDevice.IsNull() && myDevice->CanRead() )
+  {
+    if ( myDevice->Open( Storage_VSRead ) == Storage_VSOk )
+    {
+        Standard_Size aSize = 8000;
+        char* aBuf = (char*)malloc( aSize );
+        std::string aStr;
+        while ( !myDevice->IsEnd() )
+        {
+            Standard_Size aNum = myDevice->Read( aBuf, aSize );
+            aStr.append( aBuf, aNum );
+        }
+        free( aBuf );
+
+        myDevice->Close();
+
+        Standard_SStream aStream( std::ios::in );
+        aStream.str( aStr );
+
+        aRes = aParser.parse( aStream );
+    }
+    else
+        myReaderStatus = PCDM_RS_OpenError;
+  }
+
+  if (aRes)
   {
     TCollection_AsciiString aData;
     cout << aParser.GetError(aData) << ": " << aData << endl;
@@ -222,7 +258,13 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
   const Handle(CDM_MessageDriver) aMsgDriver =
     theApplication -> MessageDriver();
   // 1. Read info // to be done
-  TCollection_AsciiString anAbsoluteDirectory = GetDirFromFile(myFileName);
+  TCollection_AsciiString anAbsoluteDirectory;
+  Handle(Storage_File) aStorageFile = Handle(Storage_File)::DownCast(myDevice);
+  if (!aStorageFile.IsNull())
+  {
+    anAbsoluteDirectory = GetDirFromFile(aStorageFile->Path());
+  }
+  
   Standard_Integer aCurDocVersion = 0;
   TCollection_ExtendedString anInfo;
   const XmlObjMgt_Element anInfoElem =
@@ -314,57 +356,52 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
         }
         // Add new ref!
         /////////////
-    TCollection_ExtendedString theFolder,theName;
-        //TCollection_ExtendedString theFile=myReferences(myIterator).FileName();
-        TCollection_ExtendedString f(aPath);
-#ifndef WNT
-        
-        Standard_Integer i= f.SearchFromEnd("/");
-        TCollection_ExtendedString n = f.Split(i); 
-        f.Trunc(f.Length()-1);
-        theFolder = f;
-        theName = n;
-#else
-        OSD_Path p = UTL::Path(f);
-        Standard_ExtCharacter      chr;
-        TCollection_ExtendedString dir, dirRet, name;
-        
-        dir = UTL::Disk(p);
-        dir += UTL::Trek(p);
-        
-        for ( int i = 1; i <= dir.Length (); ++i ) {
-    
-    chr = dir.Value ( i );
-    
-    switch ( chr ) {
-      
-    case _TEXT( '|' ):
-      dirRet += _TEXT( "/" );
-      break;
-      
-    case _TEXT( '^' ):
-      
-      dirRet += _TEXT( ".." );
-      break;
-      
-    default:
-      dirRet += chr;
-      
-    }  
-        }
-        theFolder = dirRet;
-        theName   = UTL::Name(p); theName+= UTL::Extension(p);
-#endif  // WNT
+//    TCollection_ExtendedString theFolder,theName;
+//        //TCollection_ExtendedString theFile=myReferences(myIterator).FileName();
+//        TCollection_ExtendedString f(aPath);
+//#ifndef WNT
+//        
+//        Standard_Integer i= f.SearchFromEnd("/");
+//        TCollection_ExtendedString n = f.Split(i); 
+//        f.Trunc(f.Length()-1);
+//        theFolder = f;
+//        theName = n;
+//#else
+//        OSD_Path p = UTL::Path(f);
+//        Standard_ExtCharacter      chr;
+//        TCollection_ExtendedString dir, dirRet, name;
+//        
+//        dir = UTL::Disk(p);
+//        dir += UTL::Trek(p);
+//        
+//        for ( int i = 1; i <= dir.Length (); ++i ) {
+//    
+//    chr = dir.Value ( i );
+//    
+//    switch ( chr ) {
+//      
+//    case _TEXT( '|' ):
+//      dirRet += _TEXT( "/" );
+//      break;
+//      
+//    case _TEXT( '^' ):
+//      
+//      dirRet += _TEXT( ".." );
+//      break;
+//      
+//    default:
+//      dirRet += chr;
+//      
+//    }  
+//        }
+//        theFolder = dirRet;
+//        theName   = UTL::Name(p); theName+= UTL::Extension(p);
+//#endif  // WNT
         
-        Handle(CDM_MetaData) aMetaData =  CDM_MetaData::LookUp(theFolder,theName,aPath,aPath,UTL::IsReadOnly(aFileName));
-////////////
-        theNewDocument->CreateReference(aMetaData,aRefId,
-             theApplication,aDocumentVersion,Standard_False);
+        Handle(CDM_MetaData) aMetaData =  CDM_MetaData::LookUp(myDevice, UTL::IsReadOnly(aFileName));
 
-        
+        theNewDocument->CreateReference (aMetaData, aRefId, theApplication, aDocumentVersion, Standard_False);
       }
-
-      
     }
     if(anInfo == START_REF)
       isRef = Standard_True;
index ae6c94fb4719c39039575dd791b29ee21600cd18..4b9101baf8b151c2226e67fa91c3e593106c4879 100644 (file)
@@ -25,7 +25,8 @@ uses
     Element                    from XmlObjMgt,
     SRelocationTable           from XmlObjMgt,
     ADriverTable               from XmlMDF,
-    MessageDriver               from CDM
+    MessageDriver               from CDM,
+    IODevice                    from Storage
 
 is
     Create (theCopyright: ExtendedString from TCollection)
@@ -36,13 +37,13 @@ is
     -- pure virtual method definition
 
     Write            (me: mutable;theDocument: Document       from CDM;
-                                  theFileName: ExtendedString from TCollection)
+                                  theDevice: IODevice from Storage)
        is redefined virtual;
     -- Write <aDocument> to the xml file <theFileName>
 
     WriteToDomDocument(me:mutable; theDocument: Document from CDM;
                                   thePDoc    : out Element from XmlObjMgt;
-                                  theFileName: ExtendedString from TCollection)
+                                  theDevice: IODevice from Storage)
        returns Boolean from Standard
        is virtual protected;
 
index 1aa875ef100a6ca7a1bf520bdf36329b8bbb6e12..7897511aac0c50fc63ddaa7359ab320328afe6da 100644 (file)
@@ -102,7 +102,7 @@ void XmlLDrivers_DocumentStorageDriver::AddNamespace
 //=======================================================================
 void XmlLDrivers_DocumentStorageDriver::Write
                           (const Handle(CDM_Document)&       theDocument,
-                           const TCollection_ExtendedString& theFileName)
+                           const Handle(Storage_IODevice)& theDevice)
 {
   Handle(CDM_MessageDriver) aMessageDriver =
     theDocument -> Application() -> MessageDriver();
@@ -114,22 +114,23 @@ void XmlLDrivers_DocumentStorageDriver::Write
   // Fill the document with data
   XmlObjMgt_Element anElement = aDOMDoc.getDocumentElement();
 
-  if (WriteToDomDocument (theDocument, anElement, theFileName) == Standard_False) {
+  if (WriteToDomDocument (theDocument, anElement, theDevice) == Standard_False) {
     // Write DOM_Document into XML file,
-    FILE * aFile = OSD_OpenFile(theFileName, "wt");
+    theDevice->Open( Storage_VSWrite );
 
-    if (aFile) {
-      LDOM_XmlWriter aWriter (aFile);
+    if (theDevice->CanWrite()) {
+      LDOM_XmlWriter aWriter (theDevice);
       aWriter.SetIndentation(1);
       aWriter << aDOMDoc;
-      fclose(aFile);
+      theDevice->Close();
       ::take_time (0, " +++++ Fin formatting to XML : ", aMessageDriver);
-
-    }else{
+    }
+    else
+    {
       SetIsError (Standard_True);
       SetStoreStatus(PCDM_SS_WriteFailure);
       TCollection_ExtendedString aMsg =
-        TCollection_ExtendedString("Error: the file ") + theFileName +
+        TCollection_ExtendedString("Error: the device ") + theDevice->Name() +
           " cannot be opened for writing";
       aMessageDriver -> Write (aMsg.ToExtString());
         Standard_Failure::Raise("File cannot be opened for writing");
@@ -147,7 +148,7 @@ void XmlLDrivers_DocumentStorageDriver::Write
 Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
                                   (const Handle(CDM_Document)&  theDocument,
                                    XmlObjMgt_Element&           theElement,
-                                  const TCollection_ExtendedString& theFileName)
+                                  const Handle(Storage_IODevice)& theDevice)
 {
   SetIsError(Standard_False);
   Handle(CDM_MessageDriver) aMessageDriver =
@@ -255,7 +256,7 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
   Handle(Storage_Data) theData = new Storage_Data;
   //PCDM_ReadWriter::WriteFileFormat( theData, theDocument );
   PCDM_ReadWriter::Writer()->WriteReferenceCounter(theData,theDocument);
-  PCDM_ReadWriter::Writer()->WriteReferences(theData,theDocument,theFileName);
+  PCDM_ReadWriter::Writer()->WriteReferences(theData,theDocument,theDevice);
   PCDM_ReadWriter::Writer()->WriteExtensions(theData,theDocument);
   PCDM_ReadWriter::Writer()->WriteVersion(theData,theDocument);
 
index c99ba2d3d311664ceee06b5a3fd094dd4678f1dc..f4e0253d357033ddfa6683afe6b9d55d2f4bda15 100644 (file)
@@ -40,6 +40,10 @@ is
         class PlacementDriver;
         
         class PatternStdDriver;
+
+        class PresentationDriver;
+
+        class PositionDriver;
         
 
     AddDrivers (aDriverTable : ADriverTable  from XmlMDF;
index b8fc213ce31026ca9ea2ae79e5dbcc196804db03..1d0f959b57fc4d5c7c78a26828d475daec18ca60 100644 (file)
@@ -25,6 +25,8 @@
 #include <XmlMDataXtd_ConstraintDriver.hxx>
 #include <XmlMDataXtd_PlacementDriver.hxx>
 #include <XmlMDataXtd_PatternStdDriver.hxx>
+#include <XmlMDataXtd_PositionDriver.hxx>
+#include <XmlMDataXtd_PresentationDriver.hxx>
 
 static Standard_Integer myDocumentVersion = -1;
 //=======================================================================
@@ -34,14 +36,16 @@ static Standard_Integer myDocumentVersion = -1;
 void XmlMDataXtd::AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable,
                               const Handle(CDM_MessageDriver)&   anMsgDrv)
 {
-  aDriverTable-> AddDriver (new XmlMDataXtd_ShapeDriver         (anMsgDrv));
-  aDriverTable-> AddDriver (new XmlMDataXtd_PointDriver         (anMsgDrv));
-  aDriverTable-> AddDriver (new XmlMDataXtd_AxisDriver          (anMsgDrv));
-  aDriverTable-> AddDriver (new XmlMDataXtd_PlaneDriver         (anMsgDrv));
-  aDriverTable-> AddDriver (new XmlMDataXtd_GeometryDriver      (anMsgDrv));
-  aDriverTable-> AddDriver (new XmlMDataXtd_ConstraintDriver    (anMsgDrv));
-  aDriverTable-> AddDriver (new XmlMDataXtd_PlacementDriver     (anMsgDrv));
-  aDriverTable-> AddDriver (new XmlMDataXtd_PatternStdDriver    (anMsgDrv));
+  aDriverTable->AddDriver(new XmlMDataXtd_ShapeDriver         (anMsgDrv));
+  aDriverTable->AddDriver(new XmlMDataXtd_PointDriver         (anMsgDrv));
+  aDriverTable->AddDriver(new XmlMDataXtd_AxisDriver          (anMsgDrv));
+  aDriverTable->AddDriver(new XmlMDataXtd_PlaneDriver         (anMsgDrv));
+  aDriverTable->AddDriver(new XmlMDataXtd_GeometryDriver      (anMsgDrv));
+  aDriverTable->AddDriver(new XmlMDataXtd_ConstraintDriver    (anMsgDrv));
+  aDriverTable->AddDriver(new XmlMDataXtd_PlacementDriver     (anMsgDrv));
+  aDriverTable->AddDriver(new XmlMDataXtd_PatternStdDriver    (anMsgDrv));
+  aDriverTable->AddDriver(new XmlMDataXtd_PositionDriver      (anMsgDrv)); 
+  aDriverTable->AddDriver(new XmlMDataXtd_PresentationDriver  (anMsgDrv));
 }
 
 //=======================================================================
diff --git a/src/XmlMDataXtd/XmlMDataXtd_PositionDriver.cdl b/src/XmlMDataXtd/XmlMDataXtd_PositionDriver.cdl
new file mode 100644 (file)
index 0000000..34701f2
--- /dev/null
@@ -0,0 +1,42 @@
+-- Created on: 2001-09-04
+-- Created by: Julia DOROVSKIKH
+-- Copyright (c) 2001-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class PositionDriver from XmlMDataXtd  inherits ADriver from XmlMDF
+
+        ---Purpose: Attribute Driver.
+
+uses
+    SRelocationTable from XmlObjMgt,
+    RRelocationTable from XmlObjMgt,
+    Persistent       from XmlObjMgt,
+    MessageDriver    from CDM,
+    Attribute        from TDF
+
+is
+    Create (theMessageDriver:MessageDriver from CDM)
+        returns PositionDriver from XmlMDataXtd;
+
+    NewEmpty (me)  returns Attribute from TDF;
+
+    Paste(me; Source     : Persistent from XmlObjMgt;
+              Target     : Attribute from TDF;
+              RelocTable : out RRelocationTable from XmlObjMgt)
+        returns Boolean from Standard;
+
+    Paste(me; Source     : Attribute from TDF;
+              Target     : in out Persistent from XmlObjMgt;
+              RelocTable : out SRelocationTable from XmlObjMgt);
+
+end PositionDriver;
diff --git a/src/XmlMDataXtd/XmlMDataXtd_PositionDriver.cxx b/src/XmlMDataXtd/XmlMDataXtd_PositionDriver.cxx
new file mode 100644 (file)
index 0000000..7403efc
--- /dev/null
@@ -0,0 +1,123 @@
+// Created on: 2001-09-04
+// Created by: Julia DOROVSKIKH
+// Copyright (c) 2001-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <XmlMDataXtd_PositionDriver.ixx>
+
+#include <XmlObjMgt.hxx>
+#include <TDataXtd_Position.hxx>
+#include <gp_XYZ.hxx>
+
+#include <stdio.h>
+
+//=======================================================================
+//function : XmlMDataXtd_PositionDriver
+//purpose  : Constructor
+//=======================================================================
+XmlMDataXtd_PositionDriver::XmlMDataXtd_PositionDriver
+                        (const Handle(CDM_MessageDriver)& theMsgDriver)
+: XmlMDF_ADriver (theMsgDriver, NULL)
+{}
+
+//=======================================================================
+//function : NewEmpty
+//purpose  : 
+//=======================================================================
+Handle(TDF_Attribute) XmlMDataXtd_PositionDriver::NewEmpty() const
+{
+  return (new TDataXtd_Position());
+}
+
+//=======================================================================
+//function : Paste
+//purpose  : persistent -> transient (retrieve)
+//=======================================================================
+Standard_Boolean XmlMDataXtd_PositionDriver::Paste
+                (const XmlObjMgt_Persistent&  theSource,
+                 const Handle(TDF_Attribute)& theTarget,
+                 XmlObjMgt_RRelocationTable&  ) const
+{
+  Handle(TDataXtd_Position) aTPos = Handle(TDataXtd_Position)::DownCast(theTarget);
+
+  // position
+  XmlObjMgt_DOMString aPosStr = XmlObjMgt::GetStringValue(theSource.Element());
+  if (aPosStr == NULL)
+  {
+    WriteMessage ("Cannot retrieve position string from element");
+    return Standard_False;
+  }
+
+  gp_Pnt aPos;
+  Standard_Real aValue;
+  Standard_CString aValueStr = Standard_CString(aPosStr.GetString());
+
+  // X
+  if (!XmlObjMgt::GetReal(aValueStr, aValue))
+  {
+    TCollection_ExtendedString aMessageString =
+      TCollection_ExtendedString
+        ("Cannot retrieve X coordinate for TDataXtd_Position attribute as \"")
+          + aValueStr + "\"";
+    WriteMessage (aMessageString);
+    return Standard_False;
+  }
+  aPos.SetX(aValue);
+
+  // Y
+  if (!XmlObjMgt::GetReal(aValueStr, aValue))
+  {
+    TCollection_ExtendedString aMessageString =
+      TCollection_ExtendedString
+        ("Cannot retrieve Y coordinate for TDataXtd_Position attribute as \"")
+          + aValueStr + "\"";
+    WriteMessage (aMessageString);
+    return Standard_False;
+  }
+  aPos.SetY(aValue);
+
+  // Z
+  if (!XmlObjMgt::GetReal(aValueStr, aValue))
+  {
+    TCollection_ExtendedString aMessageString =
+      TCollection_ExtendedString
+        ("Cannot retrieve Z coordinate for TDataXtd_Position attribute as \"")
+          + aValueStr + "\"";
+    WriteMessage (aMessageString);
+    return Standard_False;
+  }
+  aPos.SetZ(aValue);
+
+  aTPos->SetPosition(aPos);
+
+  return Standard_True;
+}
+
+//=======================================================================
+//function : Paste
+//purpose  : transient -> persistent (store)
+//=======================================================================
+void XmlMDataXtd_PositionDriver::Paste
+                (const Handle(TDF_Attribute)& theSource,
+                 XmlObjMgt_Persistent&        theTarget,
+                 XmlObjMgt_SRelocationTable&  ) const
+{
+  Handle(TDataXtd_Position) aTPos = Handle(TDataXtd_Position)::DownCast(theSource);
+  if (!aTPos.IsNull())
+  {
+    gp_Pnt aPos = aTPos->GetPosition();
+    char buf [64];
+    Sprintf (buf, "%.17g %.17g %.17g", aPos.X(), aPos.Y(), aPos.Z());
+    XmlObjMgt::SetStringValue(theTarget.Element(), buf);
+  }
+}
diff --git a/src/XmlMDataXtd/XmlMDataXtd_PresentationDriver.cdl b/src/XmlMDataXtd/XmlMDataXtd_PresentationDriver.cdl
new file mode 100644 (file)
index 0000000..b39195e
--- /dev/null
@@ -0,0 +1,42 @@
+-- Created on: 2001-09-04
+-- Created by: Julia DOROVSKIKH
+-- Copyright (c) 2001-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement.
+
+class PresentationDriver from XmlMDataXtd  inherits ADriver from XmlMDF
+
+        ---Purpose: Attribute Driver.
+
+uses
+    SRelocationTable from XmlObjMgt,
+    RRelocationTable from XmlObjMgt,
+    Persistent       from XmlObjMgt,
+    MessageDriver    from CDM,
+    Attribute        from TDF
+
+is
+    Create (theMessageDriver:MessageDriver from CDM)
+        returns PresentationDriver from XmlMDataXtd;
+
+    NewEmpty (me)  returns Attribute from TDF;
+
+    Paste(me; Source     : Persistent from XmlObjMgt;
+              Target     : Attribute from TDF;
+              RelocTable : out RRelocationTable from XmlObjMgt)
+        returns Boolean from Standard;
+
+    Paste(me; Source     : Attribute from TDF;
+              Target     : in out Persistent from XmlObjMgt;
+              RelocTable : out SRelocationTable from XmlObjMgt);
+
+end PresentationDriver;
diff --git a/src/XmlMDataXtd/XmlMDataXtd_PresentationDriver.cxx b/src/XmlMDataXtd/XmlMDataXtd_PresentationDriver.cxx
new file mode 100644 (file)
index 0000000..a20b36d
--- /dev/null
@@ -0,0 +1,239 @@
+// Created on: 2001-09-04
+// Created by: Julia DOROVSKIKH
+// Copyright (c) 2001-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <XmlMDataXtd_PresentationDriver.ixx>
+
+#include <XmlObjMgt.hxx>
+
+#include <TDataXtd_Presentation.hxx>
+
+IMPLEMENT_DOMSTRING (GuidString,        "guid")
+IMPLEMENT_DOMSTRING (IsDisplayedString, "isdisplayed")
+IMPLEMENT_DOMSTRING (ColorString,       "color")
+IMPLEMENT_DOMSTRING (MaterialString,    "material")
+IMPLEMENT_DOMSTRING (TransparencyString,"transparency")
+IMPLEMENT_DOMSTRING (WidthString,       "width")
+IMPLEMENT_DOMSTRING (ModeString,        "mode")
+
+IMPLEMENT_DOMSTRING (DisplayedString,   "true")
+
+//=======================================================================
+//function : XmlMDataXtd_PresentationDriver
+//purpose  : Constructor
+//=======================================================================
+XmlMDataXtd_PresentationDriver::XmlMDataXtd_PresentationDriver
+  (const Handle(CDM_MessageDriver)& theMsgDriver)
+  : XmlMDF_ADriver (theMsgDriver, NULL)
+{}
+
+//=======================================================================
+//function : NewEmpty
+//purpose  : 
+//=======================================================================
+Handle(TDF_Attribute) XmlMDataXtd_PresentationDriver::NewEmpty() const
+{
+  return (new TDataXtd_Presentation());
+}
+
+//=======================================================================
+//function : Paste
+//purpose  : persistent -> transient (retrieve)
+//=======================================================================
+Standard_Boolean XmlMDataXtd_PresentationDriver::Paste
+  (const XmlObjMgt_Persistent&  theSource,
+  const Handle(TDF_Attribute)& theTarget,
+  XmlObjMgt_RRelocationTable&  ) const
+{
+  TCollection_ExtendedString aMessageString;
+  XmlObjMgt_DOMString aDOMStr;
+
+  Handle(TDataXtd_Presentation) aTPrs =
+    Handle(TDataXtd_Presentation)::DownCast(theTarget);
+  const XmlObjMgt_Element& anElem = theSource;
+
+  //convert attribute value into GUID
+  aDOMStr = anElem.getAttribute(::GuidString());
+  if (aDOMStr == NULL)
+  {
+    WriteMessage("Cannot retrieve guid string from attribute");
+    return Standard_False;
+  }
+  Standard_CString aGuidStr = (Standard_CString) aDOMStr.GetString();
+  aTPrs->SetDriverGUID(aGuidStr);
+
+  // is displayed
+  aDOMStr = anElem.getAttribute(::IsDisplayedString());
+  aTPrs->SetDisplayed(aDOMStr != NULL);
+
+  Standard_Integer anIValue;
+
+  // color
+  aDOMStr = anElem.getAttribute(::ColorString());
+  if (aDOMStr != NULL)
+  {
+    if (!aDOMStr.GetInteger(anIValue))
+    {
+      aMessageString = TCollection_ExtendedString
+        ("Cannot retrieve Integer value from \"") + aDOMStr + "\"";
+      WriteMessage (aMessageString);
+      return Standard_False;
+    }
+    aTPrs->SetColor(anIValue);
+  }
+  else
+  {
+    aTPrs->UnsetColor();
+  }
+
+  // material
+  aDOMStr = anElem.getAttribute(::MaterialString());
+  if (aDOMStr != NULL)
+  {
+    if (!aDOMStr.GetInteger(anIValue))
+    {
+      aMessageString = TCollection_ExtendedString
+        ("Cannot retrieve Integer value from \"") + aDOMStr + "\"";
+      WriteMessage (aMessageString);
+      return Standard_False;
+    }
+    aTPrs->SetMaterial(anIValue);
+  }
+  else
+  {
+    aTPrs->UnsetMaterial();
+  }
+
+  Standard_Real aValue;
+
+  // transparency
+  aDOMStr = anElem.getAttribute(::TransparencyString());
+  if (aDOMStr != NULL)
+  {
+    if (!XmlObjMgt::GetReal(aDOMStr, aValue))
+    {
+      aMessageString = TCollection_ExtendedString
+        ("Cannot retrieve Real value from \"") + aDOMStr + "\"";
+      WriteMessage (aMessageString);
+      return Standard_False;
+    }
+    aTPrs->SetTransparency(aValue);
+  }
+  else
+  {
+    aTPrs->UnsetTransparency();
+  }
+
+  // width
+  aDOMStr = anElem.getAttribute(::WidthString());
+  if (aDOMStr != NULL)
+  {
+    if (!XmlObjMgt::GetReal(aDOMStr, aValue))
+    {
+      aMessageString = TCollection_ExtendedString
+        ("Cannot retrieve Real value from \"") + aDOMStr + "\"";
+      WriteMessage (aMessageString);
+      return Standard_False;
+    }
+    aTPrs->SetWidth(aValue);
+  }
+  else
+  {
+    aTPrs->UnsetWidth();
+  }
+
+  // mode
+  aDOMStr = anElem.getAttribute(::ModeString());
+  if (aDOMStr != NULL)
+  {
+    if (!aDOMStr.GetInteger(anIValue))
+    {
+      aMessageString = TCollection_ExtendedString
+        ("Cannot retrieve Integer value from \"") + aDOMStr + "\"";
+      WriteMessage (aMessageString);
+      return Standard_False;
+    }
+    aTPrs->SetMode(anIValue);
+  }
+  else
+  {
+    aTPrs->UnsetMode();
+  }
+
+  return Standard_True;
+}
+
+//=======================================================================
+//function : Paste
+//purpose  : transient -> persistent (store)
+//=======================================================================
+void XmlMDataXtd_PresentationDriver::Paste
+                                  (const Handle(TDF_Attribute)& theSource,
+                                   XmlObjMgt_Persistent&        theTarget,
+                                   XmlObjMgt_SRelocationTable&) const
+{
+  Handle(TDataXtd_Presentation) aTPrs =
+    Handle(TDataXtd_Presentation)::DownCast(theSource);
+  if (aTPrs.IsNull()) return;
+
+  //convert GUID into attribute value
+  Standard_Character aGuidStr [40];
+  Standard_PCharacter pGuidStr;
+  pGuidStr=aGuidStr;
+  aTPrs->GetDriverGUID().ToCString (pGuidStr);
+  theTarget.Element().setAttribute(::GuidString(), aGuidStr);
+
+  // is displayed
+  if (aTPrs->IsDisplayed())
+    theTarget.Element().setAttribute(::IsDisplayedString(), ::DisplayedString());
+
+  Standard_Integer aNb;
+
+  // color
+  if (aTPrs->IsHasOwnColor())
+  {
+    aNb = aTPrs->Color();
+    theTarget.Element().setAttribute(::ColorString(), aNb);
+  }
+
+  // material
+  if (aTPrs->IsHasOwnMaterial())
+  {
+    aNb = (Standard_Integer)(aTPrs->Material());
+    theTarget.Element().setAttribute(::MaterialString(), aNb);
+  }
+
+  // transparency
+  if (aTPrs->IsHasOwnTransparency())
+  {
+    TCollection_AsciiString aRNbStr (aTPrs->Transparency());
+    theTarget.Element().setAttribute(::TransparencyString(), aRNbStr.ToCString());
+  }
+
+  // width
+  if (aTPrs->IsHasOwnWidth())
+  {
+    TCollection_AsciiString aRNbStr (aTPrs->Width());
+    theTarget.Element().setAttribute(::WidthString(), aRNbStr.ToCString());
+  }
+
+#ifdef OCC6010
+  // mode
+  if (aTPrs->IsHasOwnMode())
+  {
+    aNb = aTPrs->Mode();
+    theTarget.Element().setAttribute(::ModeString(), aNb);
+  }
+#endif
+}
diff --git a/src/XmlMPrsStd/XmlMPrsStd.cdl b/src/XmlMPrsStd/XmlMPrsStd.cdl
deleted file mode 100644 (file)
index 667308b..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
--- Created on: 2001-07-09
--- Created by: Julia DOROVSKIKH
--- Copyright (c) 2001-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-package XmlMPrsStd
-
-
-uses
-    TDF,
-    CDM,
-    XmlMDF,
-    XmlObjMgt
-
-is
-    ---Category: Classes
-    --           =============================================================
-
-    class PositionDriver;
-
-    class AISPresentationDriver;
-
-    AddDrivers (aDriverTable    : ADriverTable  from XmlMDF;
-                theMessageDriver: MessageDriver from CDM);
-        ---Purpose: Adds the attribute storage drivers to <aDriverTable>.
-
-end XmlMPrsStd;
diff --git a/src/XmlMPrsStd/XmlMPrsStd.cxx b/src/XmlMPrsStd/XmlMPrsStd.cxx
deleted file mode 100644 (file)
index 9989ab3..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-// Created on: 2001-07-09
-// Created by: Julia DOROVSKIKH
-// Copyright (c) 2001-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <XmlMPrsStd.ixx>
-
-#include <XmlMPrsStd_PositionDriver.hxx>
-#include <XmlMPrsStd_AISPresentationDriver.hxx>
-
-///=======================================================================
-//function : AddDrivers
-//purpose  : 
-//=======================================================================
-void XmlMPrsStd::AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable,
-                             const Handle(CDM_MessageDriver)&   aMessageDriver)
-{
-  aDriverTable->AddDriver(new XmlMPrsStd_PositionDriver(aMessageDriver)); 
-  aDriverTable->AddDriver(new XmlMPrsStd_AISPresentationDriver(aMessageDriver));
-}
diff --git a/src/XmlMPrsStd/XmlMPrsStd_AISPresentationDriver.cdl b/src/XmlMPrsStd/XmlMPrsStd_AISPresentationDriver.cdl
deleted file mode 100644 (file)
index 540ec13..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
--- Created on: 2001-09-04
--- Created by: Julia DOROVSKIKH
--- Copyright (c) 2001-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class AISPresentationDriver from XmlMPrsStd  inherits ADriver from XmlMDF
-
-        ---Purpose: Attribute Driver.
-
-uses
-    SRelocationTable from XmlObjMgt,
-    RRelocationTable from XmlObjMgt,
-    Persistent       from XmlObjMgt,
-    MessageDriver    from CDM,
-    Attribute        from TDF
-
-is
-    Create (theMessageDriver:MessageDriver from CDM)
-        returns AISPresentationDriver from XmlMPrsStd;
-
-    NewEmpty (me)  returns Attribute from TDF;
-
-    Paste(me; Source     : Persistent from XmlObjMgt;
-              Target     : Attribute from TDF;
-              RelocTable : out RRelocationTable from XmlObjMgt)
-        returns Boolean from Standard;
-
-    Paste(me; Source     : Attribute from TDF;
-              Target     : in out Persistent from XmlObjMgt;
-              RelocTable : out SRelocationTable from XmlObjMgt);
-
-end AISPresentationDriver;
diff --git a/src/XmlMPrsStd/XmlMPrsStd_AISPresentationDriver.cxx b/src/XmlMPrsStd/XmlMPrsStd_AISPresentationDriver.cxx
deleted file mode 100644 (file)
index 93f4685..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-// Created on: 2001-09-04
-// Created by: Julia DOROVSKIKH
-// Copyright (c) 2001-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <XmlMPrsStd_AISPresentationDriver.ixx>
-
-#include <XmlObjMgt.hxx>
-
-#include <TPrsStd_AISPresentation.hxx>
-
-IMPLEMENT_DOMSTRING (GuidString,        "guid")
-IMPLEMENT_DOMSTRING (IsDisplayedString, "isdisplayed")
-IMPLEMENT_DOMSTRING (ColorString,       "color")
-IMPLEMENT_DOMSTRING (MaterialString,    "material")
-IMPLEMENT_DOMSTRING (TransparencyString,"transparency")
-IMPLEMENT_DOMSTRING (WidthString,       "width")
-IMPLEMENT_DOMSTRING (ModeString,        "mode")
-
-IMPLEMENT_DOMSTRING (DisplayedString,   "true")
-
-//=======================================================================
-//function : XmlMPrsStd_AISPresentationDriver
-//purpose  : Constructor
-//=======================================================================
-XmlMPrsStd_AISPresentationDriver::XmlMPrsStd_AISPresentationDriver
-                        (const Handle(CDM_MessageDriver)& theMsgDriver)
-      : XmlMDF_ADriver (theMsgDriver, NULL)
-{}
-
-//=======================================================================
-//function : NewEmpty
-//purpose  : 
-//=======================================================================
-Handle(TDF_Attribute) XmlMPrsStd_AISPresentationDriver::NewEmpty() const
-{
-  return (new TPrsStd_AISPresentation());
-}
-
-//=======================================================================
-//function : Paste
-//purpose  : persistent -> transient (retrieve)
-//=======================================================================
-Standard_Boolean XmlMPrsStd_AISPresentationDriver::Paste
-                                (const XmlObjMgt_Persistent&  theSource,
-                                 const Handle(TDF_Attribute)& theTarget,
-                                 XmlObjMgt_RRelocationTable&  ) const
-{
-  TCollection_ExtendedString aMessageString;
-  XmlObjMgt_DOMString aDOMStr;
-
-  Handle(TPrsStd_AISPresentation) aTPrs =
-    Handle(TPrsStd_AISPresentation)::DownCast(theTarget);
-  const XmlObjMgt_Element& anElem = theSource;
-
-  //convert attribute value into GUID
-  aDOMStr = anElem.getAttribute(::GuidString());
-  if (aDOMStr == NULL)
-  {
-    WriteMessage("Cannot retrieve guid string from attribute");
-    return Standard_False;
-  }
-  Standard_CString aGuidStr = (Standard_CString) aDOMStr.GetString();
-  aTPrs->SetDriverGUID(aGuidStr);
-
-  // is displayed
-  aDOMStr = anElem.getAttribute(::IsDisplayedString());
-  aTPrs->SetDisplayed(aDOMStr != NULL);
-
-  Standard_Integer anIValue;
-
-  // color
-  aDOMStr = anElem.getAttribute(::ColorString());
-  if (aDOMStr != NULL)
-  {
-    if (!aDOMStr.GetInteger(anIValue))
-    {
-      aMessageString = TCollection_ExtendedString
-        ("Cannot retrieve Integer value from \"") + aDOMStr + "\"";
-      WriteMessage (aMessageString);
-      return Standard_False;
-    }
-    aTPrs->SetColor((Quantity_NameOfColor)anIValue);
-  }
-  else
-  {
-    aTPrs->UnsetColor();
-  }
-
-  // material
-  aDOMStr = anElem.getAttribute(::MaterialString());
-  if (aDOMStr != NULL)
-  {
-    if (!aDOMStr.GetInteger(anIValue))
-    {
-      aMessageString = TCollection_ExtendedString
-        ("Cannot retrieve Integer value from \"") + aDOMStr + "\"";
-      WriteMessage (aMessageString);
-      return Standard_False;
-    }
-    aTPrs->SetMaterial((Graphic3d_NameOfMaterial)anIValue);
-  }
-  else
-  {
-    aTPrs->UnsetMaterial();
-  }
-
-  Standard_Real aValue;
-
-  // transparency
-  aDOMStr = anElem.getAttribute(::TransparencyString());
-  if (aDOMStr != NULL)
-  {
-    if (!XmlObjMgt::GetReal(aDOMStr, aValue))
-    {
-      aMessageString = TCollection_ExtendedString
-        ("Cannot retrieve Real value from \"") + aDOMStr + "\"";
-      WriteMessage (aMessageString);
-      return Standard_False;
-    }
-    aTPrs->SetTransparency(aValue);
-  }
-  else
-  {
-    aTPrs->UnsetTransparency();
-  }
-
-  // width
-  aDOMStr = anElem.getAttribute(::WidthString());
-  if (aDOMStr != NULL)
-  {
-    if (!XmlObjMgt::GetReal(aDOMStr, aValue))
-    {
-      aMessageString = TCollection_ExtendedString
-        ("Cannot retrieve Real value from \"") + aDOMStr + "\"";
-      WriteMessage (aMessageString);
-      return Standard_False;
-    }
-    aTPrs->SetWidth(aValue);
-  }
-  else
-  {
-    aTPrs->UnsetWidth();
-  }
-
-  // mode
-  aDOMStr = anElem.getAttribute(::ModeString());
-  if (aDOMStr != NULL)
-  {
-    if (!aDOMStr.GetInteger(anIValue))
-    {
-      aMessageString = TCollection_ExtendedString
-        ("Cannot retrieve Integer value from \"") + aDOMStr + "\"";
-      WriteMessage (aMessageString);
-      return Standard_False;
-    }
-    aTPrs->SetMode(anIValue);
-  }
-  else
-  {
-    aTPrs->UnsetMode();
-  }
-
-  return Standard_True;
-}
-
-//=======================================================================
-//function : Paste
-//purpose  : transient -> persistent (store)
-//=======================================================================
-void XmlMPrsStd_AISPresentationDriver::Paste
-                                        (const Handle(TDF_Attribute)& theSource,
-                                         XmlObjMgt_Persistent&        theTarget,
-                                         XmlObjMgt_SRelocationTable&  ) const
-{
-  Handle(TPrsStd_AISPresentation) aTPrs =
-    Handle(TPrsStd_AISPresentation)::DownCast(theSource);
-  if (aTPrs.IsNull()) return;
-
-  //convert GUID into attribute value
-  Standard_Character aGuidStr [40];
-  Standard_PCharacter pGuidStr;
-  pGuidStr=aGuidStr;
-  aTPrs->GetDriverGUID().ToCString (pGuidStr);
-  theTarget.Element().setAttribute(::GuidString(), aGuidStr);
-
-  // is displayed
-  if (aTPrs->IsDisplayed())
-    theTarget.Element().setAttribute(::IsDisplayedString(), ::DisplayedString());
-
-  Standard_Integer aNb;
-
-  // color
-  if (aTPrs->HasOwnColor())
-  {
-    aNb = (Standard_Integer)(aTPrs->Color());
-    theTarget.Element().setAttribute(::ColorString(), aNb);
-  }
-
-  // material
-  if (aTPrs->HasOwnMaterial())
-  {
-    aNb = (Standard_Integer)(aTPrs->Material());
-    theTarget.Element().setAttribute(::MaterialString(), aNb);
-  }
-
-  // transparency
-  if (aTPrs->HasOwnTransparency())
-  {
-    TCollection_AsciiString aRNbStr (aTPrs->Transparency());
-    theTarget.Element().setAttribute(::TransparencyString(), aRNbStr.ToCString());
-  }
-
-  // width
-  if (aTPrs->HasOwnWidth())
-  {
-    TCollection_AsciiString aRNbStr (aTPrs->Width());
-    theTarget.Element().setAttribute(::WidthString(), aRNbStr.ToCString());
-  }
-
-#ifdef OCC6010
-  // mode
-  if (aTPrs->HasOwnMode())
-  {
-    aNb = aTPrs->Mode();
-    theTarget.Element().setAttribute(::ModeString(), aNb);
-  }
-#endif
-}
diff --git a/src/XmlMPrsStd/XmlMPrsStd_PositionDriver.cdl b/src/XmlMPrsStd/XmlMPrsStd_PositionDriver.cdl
deleted file mode 100644 (file)
index ad3d76c..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
--- Created on: 2001-09-04
--- Created by: Julia DOROVSKIKH
--- Copyright (c) 2001-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class PositionDriver from XmlMPrsStd  inherits ADriver from XmlMDF
-
-        ---Purpose: Attribute Driver.
-
-uses
-    SRelocationTable from XmlObjMgt,
-    RRelocationTable from XmlObjMgt,
-    Persistent       from XmlObjMgt,
-    MessageDriver    from CDM,
-    Attribute        from TDF
-
-is
-    Create (theMessageDriver:MessageDriver from CDM)
-        returns PositionDriver from XmlMPrsStd;
-
-    NewEmpty (me)  returns Attribute from TDF;
-
-    Paste(me; Source     : Persistent from XmlObjMgt;
-              Target     : Attribute from TDF;
-              RelocTable : out RRelocationTable from XmlObjMgt)
-        returns Boolean from Standard;
-
-    Paste(me; Source     : Attribute from TDF;
-              Target     : in out Persistent from XmlObjMgt;
-              RelocTable : out SRelocationTable from XmlObjMgt);
-
-end PositionDriver;
diff --git a/src/XmlMPrsStd/XmlMPrsStd_PositionDriver.cxx b/src/XmlMPrsStd/XmlMPrsStd_PositionDriver.cxx
deleted file mode 100644 (file)
index bf575b5..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-// Created on: 2001-09-04
-// Created by: Julia DOROVSKIKH
-// Copyright (c) 2001-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <XmlMPrsStd_PositionDriver.ixx>
-
-#include <XmlObjMgt.hxx>
-#include <TDataXtd_Position.hxx>
-#include <gp_XYZ.hxx>
-
-#include <stdio.h>
-
-//=======================================================================
-//function : XmlMPrsStd_PositionDriver
-//purpose  : Constructor
-//=======================================================================
-XmlMPrsStd_PositionDriver::XmlMPrsStd_PositionDriver
-                        (const Handle(CDM_MessageDriver)& theMsgDriver)
-      : XmlMDF_ADriver (theMsgDriver, NULL)
-{}
-
-//=======================================================================
-//function : NewEmpty
-//purpose  : 
-//=======================================================================
-Handle(TDF_Attribute) XmlMPrsStd_PositionDriver::NewEmpty() const
-{
-  return (new TDataXtd_Position());
-}
-
-//=======================================================================
-//function : Paste
-//purpose  : persistent -> transient (retrieve)
-//=======================================================================
-Standard_Boolean XmlMPrsStd_PositionDriver::Paste
-                (const XmlObjMgt_Persistent&  theSource,
-                 const Handle(TDF_Attribute)& theTarget,
-                 XmlObjMgt_RRelocationTable&  ) const
-{
-  Handle(TDataXtd_Position) aTPos = Handle(TDataXtd_Position)::DownCast(theTarget);
-
-  // position
-  XmlObjMgt_DOMString aPosStr = XmlObjMgt::GetStringValue(theSource.Element());
-  if (aPosStr == NULL)
-  {
-    WriteMessage ("Cannot retrieve position string from element");
-    return Standard_False;
-  }
-
-  gp_Pnt aPos;
-  Standard_Real aValue;
-  Standard_CString aValueStr = Standard_CString(aPosStr.GetString());
-
-  // X
-  if (!XmlObjMgt::GetReal(aValueStr, aValue))
-  {
-    TCollection_ExtendedString aMessageString =
-      TCollection_ExtendedString
-        ("Cannot retrieve X coordinate for TDataXtd_Position attribute as \"")
-          + aValueStr + "\"";
-    WriteMessage (aMessageString);
-    return Standard_False;
-  }
-  aPos.SetX(aValue);
-
-  // Y
-  if (!XmlObjMgt::GetReal(aValueStr, aValue))
-  {
-    TCollection_ExtendedString aMessageString =
-      TCollection_ExtendedString
-        ("Cannot retrieve Y coordinate for TDataXtd_Position attribute as \"")
-          + aValueStr + "\"";
-    WriteMessage (aMessageString);
-    return Standard_False;
-  }
-  aPos.SetY(aValue);
-
-  // Z
-  if (!XmlObjMgt::GetReal(aValueStr, aValue))
-  {
-    TCollection_ExtendedString aMessageString =
-      TCollection_ExtendedString
-        ("Cannot retrieve Z coordinate for TDataXtd_Position attribute as \"")
-          + aValueStr + "\"";
-    WriteMessage (aMessageString);
-    return Standard_False;
-  }
-  aPos.SetZ(aValue);
-
-  aTPos->SetPosition(aPos);
-
-  return Standard_True;
-}
-
-//=======================================================================
-//function : Paste
-//purpose  : transient -> persistent (store)
-//=======================================================================
-void XmlMPrsStd_PositionDriver::Paste
-                (const Handle(TDF_Attribute)& theSource,
-                 XmlObjMgt_Persistent&        theTarget,
-                 XmlObjMgt_SRelocationTable&  ) const
-{
-  Handle(TDataXtd_Position) aTPos = Handle(TDataXtd_Position)::DownCast(theSource);
-  if (!aTPos.IsNull())
-  {
-    gp_Pnt aPos = aTPos->GetPosition();
-    char buf [64];
-    Sprintf (buf, "%.17g %.17g %.17g", aPos.X(), aPos.Y(), aPos.Z());
-    XmlObjMgt::SetStringValue(theTarget.Element(), buf);
-  }
-}