0022898: IGES import fails in german environment
[occt.git] / src / XmlLDrivers / XmlLDrivers.cxx
CommitLineData
b311480e 1// Created on: 2001-07-09
2// Created by: Julia DOROVSKIKH
3// Copyright (c) 2001-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
7fd59977 20
21#include <XmlLDrivers.ixx>
22
23#include <XmlLDrivers_DocumentStorageDriver.hxx>
24#include <XmlLDrivers_DocumentRetrievalDriver.hxx>
25#include <XmlMDF_ADriverTable.hxx>
26#include <XmlMDF.hxx>
27#include <XmlMDataStd.hxx>
28#include <XmlMDocStd.hxx>
29#include <XmlMFunction.hxx>
30#include <Standard_GUID.hxx>
31
32#include <locale.h>
33#include <time.h>
34#include <Plugin_Macro.hxx>
35
36// avoid warnings on 'extern "C"' functions returning C++ classes
37#ifdef WNT
38#pragma warning(4:4190)
39#endif
40
41static Standard_GUID XmlLStorageDriver ("13a56820-8269-11d5-aab2-0050044b1af1");
42static Standard_GUID XmlLRetrievalDriver("13a56822-8269-11d5-aab2-0050044b1af1");
43#define CURRENT_DOCUMENT_VERSION 6
44
45//=======================================================================
46//function : Factory
47//purpose : PLUGIN FACTORY
48//=======================================================================
49Handle(Standard_Transient) XmlLDrivers::Factory(const Standard_GUID& theGUID)
50{
51 if (theGUID == XmlLStorageDriver)
52 {
53 cout << "XmlLDrivers : Storage Plugin" << endl;
54 static Handle(XmlLDrivers_DocumentStorageDriver) model_sd =
55 new XmlLDrivers_DocumentStorageDriver
56 ("Copyright: Open Cascade, 2001-2002"); // default copyright
57 return model_sd;
58 }
59
60 if (theGUID == XmlLRetrievalDriver)
61 {
62 cout << "XmlLDrivers : Retrieval Plugin" << endl;
63 static Handle (XmlLDrivers_DocumentRetrievalDriver) model_rd =
64 new XmlLDrivers_DocumentRetrievalDriver ();
65 return model_rd;
66 }
67
68 Standard_Failure::Raise ("XmlLDrivers : unknown GUID");
69 return NULL;
70}
71
72#define SLENGTH 80
73//=======================================================================
74//function : CreationDate
75//purpose : mm/dd/yy
76//=======================================================================
77TCollection_AsciiString XmlLDrivers::CreationDate ()
78{
7fd59977 79 Standard_Character nowstr[SLENGTH];
80 time_t nowbin;
81 struct tm *nowstruct;
82
83 if (time(&nowbin) == (time_t) - 1)
84 cerr << "Storage ERROR : Could not get time of day from time()" << endl;
85
86 nowstruct = localtime(&nowbin);
87
88 if (strftime(nowstr, SLENGTH, "%Y-%m-%d", nowstruct) == (size_t) 0)
89 cerr << "Storage ERROR : Could not get string from strftime()" << endl;
90
7fd59977 91 return nowstr;
92}
93
94//=======================================================================
95//function : AttributeDrivers
96//purpose :
97//=======================================================================
98Handle(XmlMDF_ADriverTable) XmlLDrivers::AttributeDrivers
99 (const Handle_CDM_MessageDriver& theMessageDriver)
100{
101 Handle(XmlMDF_ADriverTable) aTable = new XmlMDF_ADriverTable();
102 //
103 XmlMDF ::AddDrivers (aTable, theMessageDriver);
104 XmlMDataStd ::AddDrivers (aTable, theMessageDriver);
105 XmlMFunction ::AddDrivers (aTable, theMessageDriver);
106 XmlMDocStd ::AddDrivers (aTable, theMessageDriver);
107 //
108 return aTable;
109}
110
111//=======================================================================
112//function : StorageVersion
113//purpose : Document storage version
114//=======================================================================
115
116TCollection_AsciiString XmlLDrivers::StorageVersion()
117{
118 TCollection_AsciiString aVersionStr (CURRENT_DOCUMENT_VERSION);
119 return aVersionStr;
120}
121
122// Declare entry point PLUGINFACTORY
123PLUGIN(XmlLDrivers)