0028417: Using PRECOMPILED HEADER to speed up compilation time
[occt.git] / src / XmlDrivers / XmlDrivers.cxx
CommitLineData
b311480e 1// Created on: 2001-07-09
2// Created by: Julia DOROVSKIKH
973c2be1 3// Copyright (c) 2001-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
7fd59977 16
42cf5bc1 17#include <CDM_MessageDriver.hxx>
18#include <Plugin_Macro.hxx>
19#include <Standard_GUID.hxx>
6fe96f84 20#include <TDocStd_Application.hxx>
42cf5bc1 21#include <XmlDrivers.hxx>
7fd59977 22#include <XmlDrivers_DocumentRetrievalDriver.hxx>
42cf5bc1 23#include <XmlDrivers_DocumentStorageDriver.hxx>
7fd59977 24#include <XmlMDataStd.hxx>
25#include <XmlMDataXtd.hxx>
42cf5bc1 26#include <XmlMDF.hxx>
27#include <XmlMDF_ADriverTable.hxx>
7fd59977 28#include <XmlMDocStd.hxx>
42cf5bc1 29#include <XmlMFunction.hxx>
7fd59977 30#include <XmlMNaming.hxx>
7fd59977 31
32#include <locale.h>
33#include <time.h>
7fd59977 34static Standard_GUID XmlStorageDriver ("03a56820-8269-11d5-aab2-0050044b1af1");
35static Standard_GUID XmlRetrievalDriver("03a56822-8269-11d5-aab2-0050044b1af1");
36
37//=======================================================================
38//function : Factory
39//purpose : PLUGIN FACTORY
40//=======================================================================
ce8b059a 41const Handle(Standard_Transient)& XmlDrivers::Factory(const Standard_GUID& theGUID)
7fd59977 42{
43 if (theGUID == XmlStorageDriver)
44 {
0797d9d3 45#ifdef OCCT_DEBUG
7fd59977 46 cout << "XmlDrivers : Storage Plugin" << endl;
63c629aa 47#endif
4796758e 48 static Handle(Standard_Transient) model_sd =
7fd59977 49 new XmlDrivers_DocumentStorageDriver
50 ("Copyright: Open Cascade, 2001-2002"); // default copyright
51 return model_sd;
52 }
53
54 if (theGUID == XmlRetrievalDriver)
55 {
0797d9d3 56#ifdef OCCT_DEBUG
7fd59977 57 cout << "XmlDrivers : Retrieval Plugin" << endl;
63c629aa 58#endif
4796758e 59 static Handle (Standard_Transient) model_rd =
7fd59977 60 new XmlDrivers_DocumentRetrievalDriver ();
61 return model_rd;
62 }
63
9775fa61 64 throw Standard_Failure("XmlDrivers : unknown GUID");
7fd59977 65}
66
67//=======================================================================
6fe96f84 68//function : DefineFormat
69//purpose :
70//=======================================================================
71void XmlDrivers::DefineFormat (const Handle(TDocStd_Application)& theApp)
72{
73 theApp->DefineFormat ("XmlOcaf", "Xml OCAF Document", "xml",
74 new XmlDrivers_DocumentRetrievalDriver,
75 new XmlDrivers_DocumentStorageDriver ("Copyright: Open Cascade, 2001-2002"));
76}
77
78//=======================================================================
7fd59977 79//function : AttributeDrivers
80//purpose :
81//=======================================================================
82Handle(XmlMDF_ADriverTable) XmlDrivers::AttributeDrivers
857ffd5e 83 (const Handle(CDM_MessageDriver)& theMessageDriver)
7fd59977 84{
85 Handle(XmlMDF_ADriverTable) aTable = new XmlMDF_ADriverTable();
86 //
87 XmlMDF ::AddDrivers (aTable, theMessageDriver);
88 XmlMDataStd ::AddDrivers (aTable, theMessageDriver);
89 XmlMDataXtd ::AddDrivers (aTable, theMessageDriver);
90 XmlMNaming ::AddDrivers (aTable, theMessageDriver);
91 XmlMFunction ::AddDrivers (aTable, theMessageDriver);
92 XmlMDocStd ::AddDrivers (aTable, theMessageDriver);
7fd59977 93 //
94 return aTable;
95}
96
97// Declare entry point PLUGINFACTORY
98PLUGIN(XmlDrivers)