Integration of OCCT 6.5.0 from SVN
[occt.git] / src / XmlDrivers / XmlDrivers.cxx
1 // File:      XmlDrivers.cxx
2 // Created:   Mon Jul  9 12:29:49 MSK DST 2001
3 // Author:    Julia DOROVSKIKH
4 // Copyright: Matra Datavision 2001
5
6 #include <XmlDrivers.ixx>
7
8 #include <XmlDrivers_DocumentStorageDriver.hxx>
9 #include <XmlDrivers_DocumentRetrievalDriver.hxx>
10 #include <XmlMDF_ADriverTable.hxx>
11 #include <XmlMDF.hxx>
12 #include <XmlMDataStd.hxx>
13 #include <XmlMDataXtd.hxx>
14 #include <XmlMDocStd.hxx>
15 #include <XmlMNaming.hxx>
16 #include <XmlMPrsStd.hxx>
17 #include <XmlMFunction.hxx>
18
19 #include <Standard_GUID.hxx>
20
21 #include <locale.h>
22 #include <time.h>
23
24 #include <Plugin_Macro.hxx>
25
26 // avoid warnings on 'extern "C"' functions returning C++ classes
27 #ifdef WNT
28 #pragma warning(4:4190)
29 #endif
30
31 static Standard_GUID XmlStorageDriver  ("03a56820-8269-11d5-aab2-0050044b1af1");
32 static Standard_GUID XmlRetrievalDriver("03a56822-8269-11d5-aab2-0050044b1af1");
33
34 //=======================================================================
35 //function : Factory
36 //purpose  : PLUGIN FACTORY
37 //=======================================================================
38 Handle(Standard_Transient) XmlDrivers::Factory(const Standard_GUID& theGUID)
39 {
40   if (theGUID == XmlStorageDriver)
41   {
42     cout << "XmlDrivers : Storage Plugin" << endl;
43     static Handle(XmlDrivers_DocumentStorageDriver) model_sd =
44       new XmlDrivers_DocumentStorageDriver
45         ("Copyright: Open Cascade, 2001-2002"); // default copyright
46     return model_sd;
47   }
48
49   if (theGUID == XmlRetrievalDriver)
50   {
51     cout << "XmlDrivers : Retrieval Plugin" << endl;
52     static Handle (XmlDrivers_DocumentRetrievalDriver) model_rd =
53       new XmlDrivers_DocumentRetrievalDriver ();
54     return model_rd;
55   }
56  
57   Standard_Failure::Raise ("XmlDrivers : unknown GUID");
58   return NULL;
59 }
60
61 //=======================================================================
62 //function : AttributeDrivers
63 //purpose  : 
64 //=======================================================================
65 Handle(XmlMDF_ADriverTable) XmlDrivers::AttributeDrivers
66                 (const Handle_CDM_MessageDriver& theMessageDriver)
67 {
68   Handle(XmlMDF_ADriverTable) aTable = new XmlMDF_ADriverTable();
69   //
70   XmlMDF        ::AddDrivers (aTable, theMessageDriver);
71   XmlMDataStd   ::AddDrivers (aTable, theMessageDriver);
72   XmlMDataXtd   ::AddDrivers (aTable, theMessageDriver);  
73   XmlMNaming    ::AddDrivers (aTable, theMessageDriver);
74   XmlMFunction  ::AddDrivers (aTable, theMessageDriver); 
75   XmlMDocStd    ::AddDrivers (aTable, theMessageDriver); 
76   XmlMPrsStd    ::AddDrivers (aTable, theMessageDriver); 
77   //
78   return aTable;
79 }
80
81 // Declare entry point PLUGINFACTORY
82 PLUGIN(XmlDrivers)