| 1 | // Copyright (c) 2015 OPEN CASCADE SAS |
| 2 | // |
| 3 | // This file is part of Open CASCADE Technology software library. |
| 4 | // |
| 5 | // This library is free software; you can redistribute it and/or modify it under |
| 6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
| 7 | // by the Free Software Foundation, with special exception defined in the file |
| 8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
| 9 | // distribution for complete text of the license and disclaimer of any warranty. |
| 10 | // |
| 11 | // Alternatively, this file may be used under the terms of Open CASCADE |
| 12 | // commercial license or contractual agreement. |
| 13 | |
| 14 | #ifndef _StdLDrivers_DocumentRetrievalDriver_HeaderFile |
| 15 | #define _StdLDrivers_DocumentRetrievalDriver_HeaderFile |
| 16 | |
| 17 | #include <PCDM_RetrievalDriver.hxx> |
| 18 | #include <Storage_Error.hxx> |
| 19 | |
| 20 | class StdObjMgt_MapOfInstantiators; |
| 21 | class StdObjMgt_Persistent; |
| 22 | |
| 23 | //! retrieval driver of a Part document |
| 24 | class StdLDrivers_DocumentRetrievalDriver : public PCDM_RetrievalDriver |
| 25 | { |
| 26 | public: |
| 27 | //! Create an empty TDocStd_Document. |
| 28 | Standard_EXPORT virtual Handle(CDM_Document) CreateDocument() Standard_OVERRIDE; |
| 29 | |
| 30 | //! Retrieve the content of a file into a new document. |
| 31 | Standard_EXPORT virtual void Read (const TCollection_ExtendedString& theFileName, |
| 32 | const Handle(CDM_Document)& theNewDocument, |
| 33 | const Handle(CDM_Application)& theApplication, |
| 34 | const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE; |
| 35 | |
| 36 | //! Override pure virtual method (raises exception Standard_NotImplemented) |
| 37 | Standard_EXPORT virtual void Read (Standard_IStream& theIStream, |
| 38 | const Handle(Storage_Data)& theStorageData, |
| 39 | const Handle(CDM_Document)& theDoc, |
| 40 | const Handle(CDM_Application)& theApplication, |
| 41 | const Handle(Message_ProgressIndicator)& theProgress = NULL) Standard_OVERRIDE; |
| 42 | |
| 43 | DEFINE_STANDARD_RTTIEXT (StdLDrivers_DocumentRetrievalDriver, PCDM_RetrievalDriver) |
| 44 | |
| 45 | protected: |
| 46 | //! Register types. |
| 47 | Standard_EXPORT virtual void bindTypes (StdObjMgt_MapOfInstantiators& theMap); |
| 48 | |
| 49 | private: |
| 50 | //! Read persistent document from a file. |
| 51 | Handle(StdObjMgt_Persistent) read ( |
| 52 | const TCollection_ExtendedString& theFileName, |
| 53 | Storage_HeaderData& theHeaderData); |
| 54 | |
| 55 | //! Update the reader status and raise an exception appropriate for the given storage error. |
| 56 | Standard_EXPORT void raiseOnStorageError (Storage_Error theError); |
| 57 | }; |
| 58 | |
| 59 | #endif // _StdLDrivers_DocumentRetrievalDriver_HeaderFile |