mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
118 lines
3.9 KiB
C++
118 lines
3.9 KiB
C++
// Created on: 2001-07-09
|
|
// Created by: Julia DOROVSKIKH
|
|
// Copyright (c) 2001-2014 OPEN CASCADE SAS
|
|
//
|
|
// This file is part of Open CASCADE Technology software library.
|
|
//
|
|
// 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.
|
|
//
|
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
// commercial license or contractual agreement.
|
|
|
|
#include <XmlLDrivers.ixx>
|
|
|
|
#include <XmlLDrivers_DocumentStorageDriver.hxx>
|
|
#include <XmlLDrivers_DocumentRetrievalDriver.hxx>
|
|
#include <XmlMDF_ADriverTable.hxx>
|
|
#include <XmlMDF.hxx>
|
|
#include <XmlMDataStd.hxx>
|
|
#include <XmlMDocStd.hxx>
|
|
#include <XmlMFunction.hxx>
|
|
#include <Standard_GUID.hxx>
|
|
|
|
#include <locale.h>
|
|
#include <time.h>
|
|
#include <Plugin_Macro.hxx>
|
|
|
|
static Standard_GUID XmlLStorageDriver ("13a56820-8269-11d5-aab2-0050044b1af1");
|
|
static Standard_GUID XmlLRetrievalDriver("13a56822-8269-11d5-aab2-0050044b1af1");
|
|
#define CURRENT_DOCUMENT_VERSION 7
|
|
|
|
//=======================================================================
|
|
//function : Factory
|
|
//purpose : PLUGIN FACTORY
|
|
//=======================================================================
|
|
Handle(Standard_Transient) XmlLDrivers::Factory(const Standard_GUID& theGUID)
|
|
{
|
|
if (theGUID == XmlLStorageDriver)
|
|
{
|
|
cout << "XmlLDrivers : Storage Plugin" << endl;
|
|
static Handle(XmlLDrivers_DocumentStorageDriver) model_sd =
|
|
new XmlLDrivers_DocumentStorageDriver
|
|
("Copyright: Open Cascade, 2001-2002"); // default copyright
|
|
return model_sd;
|
|
}
|
|
|
|
if (theGUID == XmlLRetrievalDriver)
|
|
{
|
|
cout << "XmlLDrivers : Retrieval Plugin" << endl;
|
|
static Handle (XmlLDrivers_DocumentRetrievalDriver) model_rd =
|
|
new XmlLDrivers_DocumentRetrievalDriver ();
|
|
return model_rd;
|
|
}
|
|
|
|
Standard_Failure::Raise ("XmlLDrivers : unknown GUID");
|
|
return NULL;
|
|
}
|
|
|
|
#define SLENGTH 80
|
|
//=======================================================================
|
|
//function : CreationDate
|
|
//purpose : mm/dd/yy
|
|
//=======================================================================
|
|
TCollection_AsciiString XmlLDrivers::CreationDate ()
|
|
{
|
|
Standard_Character nowstr[SLENGTH];
|
|
time_t nowbin;
|
|
struct tm *nowstruct;
|
|
|
|
if (time(&nowbin) == (time_t) - 1)
|
|
cerr << "Storage ERROR : Could not get time of day from time()" << endl;
|
|
|
|
nowstruct = localtime(&nowbin);
|
|
|
|
if (strftime(nowstr, SLENGTH, "%Y-%m-%d", nowstruct) == (size_t) 0)
|
|
cerr << "Storage ERROR : Could not get string from strftime()" << endl;
|
|
|
|
return nowstr;
|
|
}
|
|
|
|
//=======================================================================
|
|
//function : AttributeDrivers
|
|
//purpose :
|
|
//=======================================================================
|
|
Handle(XmlMDF_ADriverTable) XmlLDrivers::AttributeDrivers
|
|
(const Handle(CDM_MessageDriver)& theMessageDriver)
|
|
{
|
|
Handle(XmlMDF_ADriverTable) aTable = new XmlMDF_ADriverTable();
|
|
//
|
|
XmlMDF ::AddDrivers (aTable, theMessageDriver);
|
|
XmlMDataStd ::AddDrivers (aTable, theMessageDriver);
|
|
XmlMFunction ::AddDrivers (aTable, theMessageDriver);
|
|
XmlMDocStd ::AddDrivers (aTable, theMessageDriver);
|
|
//
|
|
return aTable;
|
|
}
|
|
|
|
//=======================================================================
|
|
//function : StorageVersion
|
|
//purpose : Document storage version
|
|
//=======================================================================
|
|
|
|
TCollection_AsciiString XmlLDrivers::StorageVersion()
|
|
{
|
|
TCollection_AsciiString aVersionStr (CURRENT_DOCUMENT_VERSION);
|
|
return aVersionStr;
|
|
}
|
|
|
|
#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(XmlLDrivers)
|