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.
16 #include <XmlLDrivers.ixx>
18 #include <XmlLDrivers_DocumentStorageDriver.hxx>
19 #include <XmlLDrivers_DocumentRetrievalDriver.hxx>
20 #include <XmlMDF_ADriverTable.hxx>
22 #include <XmlMDataStd.hxx>
23 #include <XmlMDocStd.hxx>
24 #include <XmlMFunction.hxx>
25 #include <Standard_GUID.hxx>
29 #include <Plugin_Macro.hxx>
31 static Standard_GUID XmlLStorageDriver ("13a56820-8269-11d5-aab2-0050044b1af1");
32 static Standard_GUID XmlLRetrievalDriver("13a56822-8269-11d5-aab2-0050044b1af1");
33 #define CURRENT_DOCUMENT_VERSION 7
35 //=======================================================================
37 //purpose : PLUGIN FACTORY
38 //=======================================================================
39 Handle(Standard_Transient) XmlLDrivers::Factory(const Standard_GUID& theGUID)
41 if (theGUID == XmlLStorageDriver)
44 cout << "XmlLDrivers : Storage Plugin" << endl;
46 static Handle(XmlLDrivers_DocumentStorageDriver) model_sd =
47 new XmlLDrivers_DocumentStorageDriver
48 ("Copyright: Open Cascade, 2001-2002"); // default copyright
52 if (theGUID == XmlLRetrievalDriver)
55 cout << "XmlLDrivers : Retrieval Plugin" << endl;
57 static Handle (XmlLDrivers_DocumentRetrievalDriver) model_rd =
58 new XmlLDrivers_DocumentRetrievalDriver ();
62 Standard_Failure::Raise ("XmlLDrivers : unknown GUID");
67 //=======================================================================
68 //function : CreationDate
70 //=======================================================================
71 TCollection_AsciiString XmlLDrivers::CreationDate ()
73 Standard_Character nowstr[SLENGTH];
77 if (time(&nowbin) == (time_t) - 1)
80 cerr << "Storage ERROR : Could not get time of day from time()" << endl;
84 nowstruct = localtime(&nowbin);
86 if (strftime(nowstr, SLENGTH, "%Y-%m-%d", nowstruct) == (size_t) 0)
89 cerr << "Storage ERROR : Could not get string from strftime()" << endl;
96 //=======================================================================
97 //function : AttributeDrivers
99 //=======================================================================
100 Handle(XmlMDF_ADriverTable) XmlLDrivers::AttributeDrivers
101 (const Handle(CDM_MessageDriver)& theMessageDriver)
103 Handle(XmlMDF_ADriverTable) aTable = new XmlMDF_ADriverTable();
105 XmlMDF ::AddDrivers (aTable, theMessageDriver);
106 XmlMDataStd ::AddDrivers (aTable, theMessageDriver);
107 XmlMFunction ::AddDrivers (aTable, theMessageDriver);
108 XmlMDocStd ::AddDrivers (aTable, theMessageDriver);
113 //=======================================================================
114 //function : StorageVersion
115 //purpose : Document storage version
116 //=======================================================================
118 TCollection_AsciiString XmlLDrivers::StorageVersion()
120 TCollection_AsciiString aVersionStr (CURRENT_DOCUMENT_VERSION);
125 #pragma warning(disable:4190) /* disable warning on C++ type returned by C function; should be OK for C++ usage */
128 // Declare entry point PLUGINFACTORY