1 // Created on: 2002-10-29
2 // Created by: Michael SAZONOV
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
17 #include <BinDrivers.hxx>
18 #include <BinDrivers_DocumentStorageDriver.hxx>
19 #include <BinLDrivers_DocumentSection.hxx>
20 #include <BinMDF_ADriver.hxx>
21 #include <BinMDF_ADriverTable.hxx>
22 #include <BinMNaming_NamedShapeDriver.hxx>
23 #include <CDM_MessageDriver.hxx>
24 #include <Standard_ErrorHandler.hxx>
25 #include <Standard_Type.hxx>
26 #include <TCollection_AsciiString.hxx>
27 #include <TNaming_NamedShape.hxx>
29 IMPLEMENT_STANDARD_RTTIEXT(BinDrivers_DocumentStorageDriver,BinLDrivers_DocumentStorageDriver)
31 //=======================================================================
32 //function : BinDrivers_DocumentStorageDriver
33 //purpose : Constructor
34 //=======================================================================
35 BinDrivers_DocumentStorageDriver::BinDrivers_DocumentStorageDriver ()
39 //=======================================================================
40 //function : AttributeDrivers
42 //=======================================================================
44 Handle(BinMDF_ADriverTable) BinDrivers_DocumentStorageDriver::AttributeDrivers
45 (const Handle(CDM_MessageDriver)& theMessageDriver)
47 return BinDrivers::AttributeDrivers (theMessageDriver);
50 //=======================================================================
51 //function : WriteShapeSection
52 //purpose : Implements WriteShapeSection
53 //=======================================================================
54 void BinDrivers_DocumentStorageDriver::WriteShapeSection
55 (BinLDrivers_DocumentSection& theSection,
56 Standard_OStream& theOS)
58 const Standard_Size aShapesSectionOffset = (Standard_Size) theOS.tellp();
60 Handle(BinMNaming_NamedShapeDriver) aNamedShapeDriver;
61 if (myDrivers->GetDriver(STANDARD_TYPE(TNaming_NamedShape), aNamedShapeDriver)) {
63 OCC_CATCH_SIGNALS aNamedShapeDriver->WriteShapeSection (theOS);
65 catch(Standard_Failure) {
66 TCollection_ExtendedString anErrorStr ("Error: ");
67 Handle(Standard_Failure) aFailure = Standard_Failure::Caught();
68 TCollection_ExtendedString aStr =
69 anErrorStr + "BinDrivers_DocumentStorageDriver, Shape Section :";
70 WriteMessage (aStr + aFailure->GetMessageString());
74 // Write the section info in the TOC.
75 theSection.Write (theOS, aShapesSectionOffset);