X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=blobdiff_plain;f=src%2FBinLDrivers%2FBinLDrivers_DocumentStorageDriver.cxx;h=0e5b7db18b9ca4f5b99f52a60077bcd131126126;hb=7e785937b3e65df86f35364e1036e446d6339cec;hpb=99289bed0a3c89d0fe9d2025d3452c0f66c7c9e1 diff --git a/src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx b/src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx index 0cf08781ba..0e5b7db18b 100644 --- a/src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx +++ b/src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx @@ -42,7 +42,7 @@ #include #include #include -#include +#include IMPLEMENT_STANDARD_RTTIEXT(BinLDrivers_DocumentStorageDriver,PCDM_StorageDriver) @@ -65,7 +65,7 @@ BinLDrivers_DocumentStorageDriver::BinLDrivers_DocumentStorageDriver () void BinLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDocument, const TCollection_ExtendedString& theFileName, - const Handle(Message_ProgressIndicator)& theProgress) + const Message_ProgressRange& theRange) { SetIsError(Standard_False); SetStoreStatus(PCDM_SS_OK); @@ -77,7 +77,7 @@ void BinLDrivers_DocumentStorageDriver::Write if (aFileStream.is_open() && aFileStream.good()) { - Write(theDocument, aFileStream, theProgress); + Write(theDocument, aFileStream, theRange); } else { @@ -91,9 +91,9 @@ void BinLDrivers_DocumentStorageDriver::Write //purpose : //======================================================================= -void BinLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDoc, - Standard_OStream& theOStream, - const Handle(Message_ProgressIndicator)& theProgress) +void BinLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDoc, + Standard_OStream& theOStream, + const Message_ProgressRange& theRange) { myMsgDriver = theDoc->Application()->MessageDriver(); myMapUnsupported.Clear(); @@ -140,26 +140,26 @@ void BinLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDo myRelocTable.Clear(); myPAtt.Init(); - Message_ProgressSentry aPS(theProgress, "Writing document", 0, 3, 1); + Message_ProgressScope aPS(theRange, "Writing document", 3); // Write Doc structure - WriteSubTree (aData->Root(), theOStream, theProgress); // Doc is written + WriteSubTree (aData->Root(), theOStream, aPS.Next()); // Doc is written if (!aPS.More()) { SetIsError(Standard_True); SetStoreStatus(PCDM_SS_UserBreak); return; } - aPS.Next(); + // 4. Write Shapes section - WriteShapeSection (aShapesSection, theOStream, theProgress); + WriteShapeSection (aShapesSection, theOStream, aPS.Next()); if (!aPS.More()) { SetIsError(Standard_True); SetStoreStatus(PCDM_SS_UserBreak); return; } - aPS.Next(); + // Write application-defined sections for (anIterS.Init (mySections); anIterS.More(); anIterS.Next()) { BinLDrivers_DocumentSection& aSection = anIterS.ChangeValue(); @@ -228,16 +228,16 @@ void BinLDrivers_DocumentStorageDriver::UnsupportedAttrMsg //======================================================================= void BinLDrivers_DocumentStorageDriver::WriteSubTree - (const TDF_Label& theLabel, - Standard_OStream& theOS, - const Handle(Message_ProgressIndicator)& theProgress) + (const TDF_Label& theLabel, + Standard_OStream& theOS, + const Message_ProgressRange& theRange) { // Skip empty labels if (!myEmptyLabels.IsEmpty() && myEmptyLabels.First() == theLabel) { myEmptyLabels.RemoveFirst(); return; } - Message_ProgressSentry aPS(theProgress, "Writing sub tree", 0, 2, 1, 1); + Message_ProgressScope aPS(theRange, "Writing sub tree", 2, true); // Write label header: tag Standard_Integer aTag = theLabel.Tag(); #if DO_INVERSE @@ -298,8 +298,7 @@ void BinLDrivers_DocumentStorageDriver::WriteSubTree SetStoreStatus(PCDM_SS_UserBreak); return; } - aPS.Next(); - WriteSubTree (aChildLab, theOS, theProgress); + WriteSubTree (aChildLab, theOS, aPS.Next()); } // Write the end label marker @@ -547,7 +546,7 @@ void BinLDrivers_DocumentStorageDriver::WriteSection void BinLDrivers_DocumentStorageDriver::WriteShapeSection (BinLDrivers_DocumentSection& theSection, Standard_OStream& theOS, - const Handle(Message_ProgressIndicator)& /*theProgress*/) + const Message_ProgressRange& /*theRange*/) { const Standard_Size aShapesSectionOffset = (Standard_Size) theOS.tellp(); theSection.Write (theOS, aShapesSectionOffset);