1 // Created on: 2001-07-09
2 // Created by: Julia DOROVSKIKH
3 // Copyright (c) 2001-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 <CDM_MessageDriver.hxx>
18 #include <Plugin_Macro.hxx>
19 #include <Standard_GUID.hxx>
20 #include <TDocStd_Application.hxx>
21 #include <TCollection_AsciiString.hxx>
22 #include <XmlLDrivers.hxx>
23 #include <XmlLDrivers_DocumentRetrievalDriver.hxx>
24 #include <XmlLDrivers_DocumentStorageDriver.hxx>
25 #include <XmlMDataStd.hxx>
27 #include <XmlMDF_ADriverTable.hxx>
28 #include <XmlMDocStd.hxx>
29 #include <XmlMFunction.hxx>
33 static Standard_GUID XmlLStorageDriver ("13a56820-8269-11d5-aab2-0050044b1af1");
34 static Standard_GUID XmlLRetrievalDriver("13a56822-8269-11d5-aab2-0050044b1af1");
35 #define CURRENT_DOCUMENT_VERSION 8
37 //=======================================================================
39 //purpose : PLUGIN FACTORY
40 //=======================================================================
41 const Handle(Standard_Transient)& XmlLDrivers::Factory(const Standard_GUID& theGUID)
43 if (theGUID == XmlLStorageDriver)
46 cout << "XmlLDrivers : Storage Plugin" << endl;
48 static Handle(Standard_Transient) model_sd =
49 new XmlLDrivers_DocumentStorageDriver
50 ("Copyright: Open Cascade, 2001-2002"); // default copyright
54 if (theGUID == XmlLRetrievalDriver)
57 cout << "XmlLDrivers : Retrieval Plugin" << endl;
59 static Handle (Standard_Transient) model_rd =
60 new XmlLDrivers_DocumentRetrievalDriver ();
64 Standard_Failure::Raise ("XmlLDrivers : unknown GUID");
65 static Handle(Standard_Transient) aNullHandle;
70 //=======================================================================
71 //function : CreationDate
73 //=======================================================================
74 TCollection_AsciiString XmlLDrivers::CreationDate ()
76 Standard_Character nowstr[SLENGTH];
80 if (time(&nowbin) == (time_t) - 1)
83 cerr << "Storage ERROR : Could not get time of day from time()" << endl;
87 nowstruct = localtime(&nowbin);
89 if (strftime(nowstr, SLENGTH, "%Y-%m-%d", nowstruct) == (size_t) 0)
92 cerr << "Storage ERROR : Could not get string from strftime()" << endl;
99 //=======================================================================
100 //function : DefineFormat
102 //=======================================================================
103 void XmlLDrivers::DefineFormat (const Handle(TDocStd_Application)& theApp)
105 theApp->DefineFormat ("XmlLOcaf", "Xml Lite OCAF Document", "xmll",
106 new XmlLDrivers_DocumentRetrievalDriver,
107 new XmlLDrivers_DocumentStorageDriver ("Copyright: Open Cascade, 2001-2002"));
110 //=======================================================================
111 //function : AttributeDrivers
113 //=======================================================================
114 Handle(XmlMDF_ADriverTable) XmlLDrivers::AttributeDrivers
115 (const Handle(CDM_MessageDriver)& theMessageDriver)
117 Handle(XmlMDF_ADriverTable) aTable = new XmlMDF_ADriverTable();
119 XmlMDF ::AddDrivers (aTable, theMessageDriver);
120 XmlMDataStd ::AddDrivers (aTable, theMessageDriver);
121 XmlMFunction ::AddDrivers (aTable, theMessageDriver);
122 XmlMDocStd ::AddDrivers (aTable, theMessageDriver);
127 //=======================================================================
128 //function : StorageVersion
129 //purpose : Document storage version
130 //=======================================================================
132 TCollection_AsciiString XmlLDrivers::StorageVersion()
134 TCollection_AsciiString aVersionStr (CURRENT_DOCUMENT_VERSION);
138 // Declare entry point PLUGINFACTORY