aNamedShapeDriver->ReadShapeSection( aStrStream );
}
else
- WriteMessage( "BinDrivers_DocumentRetrievalDriver: can't read all section data." );
+ WriteMessage( "BinDrivers_DocumentRetrievalDriver: can't read all shape section data." );
}
catch(Standard_Failure) {
if ( aBuf )
#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
try {
OCC_CATCH_SIGNALS
- aNamedShapeDriver->WriteShapeSection (theDevice);
+ 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 + aMethStr + "Shape Section :";
+ TCollection_ExtendedString aStr = anErrorStr + "BinDrivers_DocumentStorageDriver, Shape Section :";
WriteMessage (aStr + aFailure->GetMessageString());
}
}
ReadShapeSection (me: mutable; theIS: in out IStream from Standard);
---Purpose: Input the shapes from Bin Document file
- ReadShapeSection (me: mutable; theDevice : IODevice from Storage);
- ---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
- WriteShapeSection (me: mutable; theDevice : IODevice from Storage);
- ---Purpose: Output the shapes into Bin Document file
-
Clear (me:mutable);
---Purpose: Clear myShapeSet
myShapeSet.Clear();
}
-//=======================================================================
-//function : WriteShapeSection
-//purpose :
-//=======================================================================
-
-void BinMNaming_NamedShapeDriver::WriteShapeSection (const Handle(Storage_IODevice)& theDevice)
-{
- if (!theDevice->CanWrite())
- {
- return;
- }
-
- Handle(Storage_OStream) aStream = Handle(Storage_OStream)::DownCast(theDevice);
- if (!aStream.IsNull())
- {
- WriteShapeSection (*aStream->Stream());
- }
-}
-
//=======================================================================
//function : Clear
//purpose :
else
theIS.seekg(aPos); // no shape section is present, try to return to initial point
}
-
-//=======================================================================
-//function : ReadShapeSection
-//purpose :
-//=======================================================================
-
-void BinMNaming_NamedShapeDriver::ReadShapeSection (const Handle(Storage_IODevice)& theDevice)
-{
- if (!theDevice->CanRead())
- {
- return;
- }
-
- Handle(Storage_IStream) aStream = Handle(Storage_IStream)::DownCast(theDevice);
- if (!aStream.IsNull())
- {
- ReadShapeSection (*aStream->Stream());
- }
-}