0028417: Using PRECOMPILED HEADER to speed up compilation time
[occt.git] / src / XmlDrivers / XmlDrivers.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 680628f..4c62729
@@ -1,43 +1,36 @@
 // Created on: 2001-07-09
 // Created by: Julia DOROVSKIKH
-// Copyright (c) 2001-2012 OPEN CASCADE SAS
+// Copyright (c) 2001-2014 OPEN CASCADE SAS
 //
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
 //
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
 //
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
 
 
-#include <XmlDrivers.ixx>
-
-#include <XmlDrivers_DocumentStorageDriver.hxx>
+#include <CDM_MessageDriver.hxx>
+#include <Plugin_Macro.hxx>
+#include <Standard_GUID.hxx>
+#include <TDocStd_Application.hxx>
+#include <XmlDrivers.hxx>
 #include <XmlDrivers_DocumentRetrievalDriver.hxx>
-#include <XmlMDF_ADriverTable.hxx>
-#include <XmlMDF.hxx>
+#include <XmlDrivers_DocumentStorageDriver.hxx>
 #include <XmlMDataStd.hxx>
 #include <XmlMDataXtd.hxx>
+#include <XmlMDF.hxx>
+#include <XmlMDF_ADriverTable.hxx>
 #include <XmlMDocStd.hxx>
-#include <XmlMNaming.hxx>
-#include <XmlMPrsStd.hxx>
 #include <XmlMFunction.hxx>
-
-#include <Standard_GUID.hxx>
+#include <XmlMNaming.hxx>
 
 #include <locale.h>
 #include <time.h>
-
-#include <Plugin_Macro.hxx>
-
 static Standard_GUID XmlStorageDriver  ("03a56820-8269-11d5-aab2-0050044b1af1");
 static Standard_GUID XmlRetrievalDriver("03a56822-8269-11d5-aab2-0050044b1af1");
 
@@ -45,12 +38,14 @@ static Standard_GUID XmlRetrievalDriver("03a56822-8269-11d5-aab2-0050044b1af1");
 //function : Factory
 //purpose  : PLUGIN FACTORY
 //=======================================================================
-Handle(Standard_Transient) XmlDrivers::Factory(const Standard_GUID& theGUID)
+const Handle(Standard_Transient)& XmlDrivers::Factory(const Standard_GUID& theGUID)
 {
   if (theGUID == XmlStorageDriver)
   {
+#ifdef OCCT_DEBUG
     cout << "XmlDrivers : Storage Plugin" << endl;
-    static Handle(XmlDrivers_DocumentStorageDriver) model_sd =
+#endif
+    static Handle(Standard_Transient) model_sd =
       new XmlDrivers_DocumentStorageDriver
         ("Copyright: Open Cascade, 2001-2002"); // default copyright
     return model_sd;
@@ -58,14 +53,26 @@ Handle(Standard_Transient) XmlDrivers::Factory(const Standard_GUID& theGUID)
 
   if (theGUID == XmlRetrievalDriver)
   {
+#ifdef OCCT_DEBUG
     cout << "XmlDrivers : Retrieval Plugin" << endl;
-    static Handle (XmlDrivers_DocumentRetrievalDriver) model_rd =
+#endif
+    static Handle (Standard_Transient) model_rd =
       new XmlDrivers_DocumentRetrievalDriver ();
     return model_rd;
   }
  
-  Standard_Failure::Raise ("XmlDrivers : unknown GUID");
-  return NULL;
+  throw Standard_Failure("XmlDrivers : unknown GUID");
+}
+
+//=======================================================================
+//function : DefineFormat
+//purpose  : 
+//=======================================================================
+void XmlDrivers::DefineFormat (const Handle(TDocStd_Application)& theApp)
+{
+  theApp->DefineFormat ("XmlOcaf", "Xml OCAF Document", "xml",
+                        new XmlDrivers_DocumentRetrievalDriver, 
+                        new XmlDrivers_DocumentStorageDriver ("Copyright: Open Cascade, 2001-2002"));
 }
 
 //=======================================================================
@@ -73,7 +80,7 @@ Handle(Standard_Transient) XmlDrivers::Factory(const Standard_GUID& theGUID)
 //purpose  : 
 //=======================================================================
 Handle(XmlMDF_ADriverTable) XmlDrivers::AttributeDrivers
-                (const Handle_CDM_MessageDriver& theMessageDriver)
+                (const Handle(CDM_MessageDriver)& theMessageDriver)
 {
   Handle(XmlMDF_ADriverTable) aTable = new XmlMDF_ADriverTable();
   //
@@ -83,14 +90,9 @@ Handle(XmlMDF_ADriverTable) XmlDrivers::AttributeDrivers
   XmlMNaming    ::AddDrivers (aTable, theMessageDriver);
   XmlMFunction  ::AddDrivers (aTable, theMessageDriver); 
   XmlMDocStd    ::AddDrivers (aTable, theMessageDriver); 
-  XmlMPrsStd    ::AddDrivers (aTable, theMessageDriver); 
   //
   return aTable;
 }
 
-#ifdef _MSC_VER
-#pragma warning(disable:4190) /* disable warning on C++ type returned by C function; should be OK for C++ usage */
-#endif
-
 // Declare entry point PLUGINFACTORY
 PLUGIN(XmlDrivers)