mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Coding - Apply .clang-format formatting #286
Update empty method guards to new style with regex (see PR). Used clang-format 18.1.8. New actions to validate code formatting is added. Update .clang-format with disabling of include sorting. It is temporary changes, then include will be sorted. Apply formatting for /src and /tools folder. The files with .hxx,.cxx,.lxx,.h,.pxx,.hpp,*.cpp extensions.
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Plugin_Macro.hxx>
|
||||
#include <Standard_GUID.hxx>
|
||||
@@ -29,12 +28,12 @@
|
||||
#include <XmlMFunction.hxx>
|
||||
|
||||
#include <time.h>
|
||||
static Standard_GUID XmlLStorageDriver ("13a56820-8269-11d5-aab2-0050044b1af1");
|
||||
static Standard_GUID XmlLStorageDriver("13a56820-8269-11d5-aab2-0050044b1af1");
|
||||
static Standard_GUID XmlLRetrievalDriver("13a56822-8269-11d5-aab2-0050044b1af1");
|
||||
|
||||
//=======================================================================
|
||||
//function : Factory
|
||||
//purpose : PLUGIN FACTORY
|
||||
// function : Factory
|
||||
// purpose : PLUGIN FACTORY
|
||||
//=======================================================================
|
||||
const Handle(Standard_Transient)& XmlLDrivers::Factory(const Standard_GUID& theGUID)
|
||||
{
|
||||
@@ -43,9 +42,8 @@ const Handle(Standard_Transient)& XmlLDrivers::Factory(const Standard_GUID& theG
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout << "XmlLDrivers : Storage Plugin" << std::endl;
|
||||
#endif
|
||||
static Handle(Standard_Transient) model_sd =
|
||||
new XmlLDrivers_DocumentStorageDriver
|
||||
("Copyright: Open Cascade, 2001-2002"); // default copyright
|
||||
static Handle(Standard_Transient) model_sd = new XmlLDrivers_DocumentStorageDriver(
|
||||
"Copyright: Open Cascade, 2001-2002"); // default copyright
|
||||
return model_sd;
|
||||
}
|
||||
|
||||
@@ -54,35 +52,35 @@ const Handle(Standard_Transient)& XmlLDrivers::Factory(const Standard_GUID& theG
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout << "XmlLDrivers : Retrieval Plugin" << std::endl;
|
||||
#endif
|
||||
static Handle (Standard_Transient) model_rd =
|
||||
new XmlLDrivers_DocumentRetrievalDriver ();
|
||||
static Handle(Standard_Transient) model_rd = new XmlLDrivers_DocumentRetrievalDriver();
|
||||
return model_rd;
|
||||
}
|
||||
|
||||
|
||||
throw Standard_Failure("XmlLDrivers : unknown GUID");
|
||||
}
|
||||
|
||||
#define SLENGTH 80
|
||||
|
||||
//=======================================================================
|
||||
//function : CreationDate
|
||||
//purpose : mm/dd/yy
|
||||
// function : CreationDate
|
||||
// purpose : mm/dd/yy
|
||||
//=======================================================================
|
||||
TCollection_AsciiString XmlLDrivers::CreationDate ()
|
||||
TCollection_AsciiString XmlLDrivers::CreationDate()
|
||||
{
|
||||
Standard_Character nowstr[SLENGTH];
|
||||
time_t nowbin;
|
||||
struct tm *nowstruct;
|
||||
time_t nowbin;
|
||||
struct tm* nowstruct;
|
||||
|
||||
if (time(&nowbin) == (time_t) - 1)
|
||||
if (time(&nowbin) == (time_t)-1)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cerr << "Storage ERROR : Could not get time of day from time()" << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
nowstruct = localtime(&nowbin);
|
||||
|
||||
if (strftime(nowstr, SLENGTH, "%Y-%m-%d", nowstruct) == (size_t) 0)
|
||||
|
||||
if (strftime(nowstr, SLENGTH, "%Y-%m-%d", nowstruct) == (size_t)0)
|
||||
{
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cerr << "Storage ERROR : Could not get string from strftime()" << std::endl;
|
||||
@@ -92,30 +90,28 @@ TCollection_AsciiString XmlLDrivers::CreationDate ()
|
||||
return nowstr;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DefineFormat
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void XmlLDrivers::DefineFormat (const Handle(TDocStd_Application)& theApp)
|
||||
//=================================================================================================
|
||||
|
||||
void XmlLDrivers::DefineFormat(const Handle(TDocStd_Application)& theApp)
|
||||
{
|
||||
theApp->DefineFormat ("XmlLOcaf", "Xml Lite OCAF Document", "xmll",
|
||||
new XmlLDrivers_DocumentRetrievalDriver,
|
||||
new XmlLDrivers_DocumentStorageDriver ("Copyright: Open Cascade, 2001-2002"));
|
||||
theApp->DefineFormat("XmlLOcaf",
|
||||
"Xml Lite OCAF Document",
|
||||
"xmll",
|
||||
new XmlLDrivers_DocumentRetrievalDriver,
|
||||
new XmlLDrivers_DocumentStorageDriver("Copyright: Open Cascade, 2001-2002"));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AttributeDrivers
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(XmlMDF_ADriverTable) XmlLDrivers::AttributeDrivers
|
||||
(const Handle(Message_Messenger)& theMessageDriver)
|
||||
//=================================================================================================
|
||||
|
||||
Handle(XmlMDF_ADriverTable) XmlLDrivers::AttributeDrivers(
|
||||
const Handle(Message_Messenger)& theMessageDriver)
|
||||
{
|
||||
Handle(XmlMDF_ADriverTable) aTable = new XmlMDF_ADriverTable();
|
||||
//
|
||||
XmlMDF ::AddDrivers (aTable, theMessageDriver);
|
||||
XmlMDataStd ::AddDrivers (aTable, theMessageDriver);
|
||||
XmlMFunction ::AddDrivers (aTable, theMessageDriver);
|
||||
XmlMDocStd ::AddDrivers (aTable, theMessageDriver);
|
||||
XmlMDF ::AddDrivers(aTable, theMessageDriver);
|
||||
XmlMDataStd ::AddDrivers(aTable, theMessageDriver);
|
||||
XmlMFunction ::AddDrivers(aTable, theMessageDriver);
|
||||
XmlMDocStd ::AddDrivers(aTable, theMessageDriver);
|
||||
//
|
||||
return aTable;
|
||||
}
|
||||
|
@@ -25,19 +25,19 @@ class XmlMDF_ADriverTable;
|
||||
class Message_Messenger;
|
||||
class TDocStd_Application;
|
||||
|
||||
class XmlLDrivers
|
||||
class XmlLDrivers
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT static const Handle(Standard_Transient)& Factory (const Standard_GUID& theGUID);
|
||||
|
||||
Standard_EXPORT static const Handle(Standard_Transient)& Factory(const Standard_GUID& theGUID);
|
||||
|
||||
Standard_EXPORT static TCollection_AsciiString CreationDate();
|
||||
|
||||
|
||||
//! Defines format "XmlLOcaf" and registers its read and write drivers
|
||||
//! in the specified application
|
||||
Standard_EXPORT static void DefineFormat (const Handle(TDocStd_Application)& theApp);
|
||||
Standard_EXPORT static void DefineFormat(const Handle(TDocStd_Application)& theApp);
|
||||
|
||||
Standard_EXPORT static Handle(XmlMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver);
|
||||
Standard_EXPORT static Handle(XmlMDF_ADriverTable) AttributeDrivers(
|
||||
const Handle(Message_Messenger)& theMsgDriver);
|
||||
};
|
||||
|
||||
#endif // _XmlLDrivers_HeaderFile
|
||||
|
@@ -13,7 +13,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <CDM_Application.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Message_ProgressScope.hxx>
|
||||
@@ -36,175 +35,175 @@
|
||||
#include <XmlObjMgt.hxx>
|
||||
#include <XmlObjMgt_RRelocationTable.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlLDrivers_DocumentRetrievalDriver,PCDM_RetrievalDriver)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlLDrivers_DocumentRetrievalDriver, PCDM_RetrievalDriver)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <tchar.h>
|
||||
#endif // _MSC_VER
|
||||
#include <tchar.h>
|
||||
#endif // _MSC_VER
|
||||
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
|
||||
#define START_REF "START_REF"
|
||||
#define END_REF "END_REF"
|
||||
#define START_REF "START_REF"
|
||||
#define END_REF "END_REF"
|
||||
|
||||
#define MODIFICATION_COUNTER "MODIFICATION_COUNTER: "
|
||||
#define REFERENCE_COUNTER "REFERENCE_COUNTER: "
|
||||
#define REFERENCE_COUNTER "REFERENCE_COUNTER: "
|
||||
|
||||
//#define TAKE_TIMES
|
||||
static void take_time (const Standard_Integer, const char *,
|
||||
const Handle(Message_Messenger)&)
|
||||
// #define TAKE_TIMES
|
||||
static void take_time(const Standard_Integer, const char*, const Handle(Message_Messenger)&)
|
||||
#ifdef TAKE_TIMES
|
||||
;
|
||||
;
|
||||
#else
|
||||
{}
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
static Standard_Integer RemoveExtraSeparator(TCollection_AsciiString& aString) {
|
||||
static Standard_Integer RemoveExtraSeparator(TCollection_AsciiString& aString)
|
||||
{
|
||||
|
||||
Standard_Integer i, j, len ;
|
||||
Standard_Integer i, j, len;
|
||||
|
||||
len = aString.Length() ;
|
||||
len = aString.Length();
|
||||
#ifdef _WIN32
|
||||
// Case of network path, such as \\MACHINE\dir
|
||||
for (i = j = 2 ; j <= len ; i++,j++) {
|
||||
for (i = j = 2; j <= len; i++, j++)
|
||||
{
|
||||
#else
|
||||
for (i = j = 1 ; j <= len ; i++,j++) {
|
||||
for (i = j = 1; j <= len; i++, j++)
|
||||
{
|
||||
#endif
|
||||
Standard_Character c = aString.Value(j) ;
|
||||
aString.SetValue(i,c) ;
|
||||
if (c == '/')
|
||||
while(j < len && aString.Value(j+1) == '/') j++ ;
|
||||
Standard_Character c = aString.Value(j);
|
||||
aString.SetValue(i, c);
|
||||
if (c == '/')
|
||||
while (j < len && aString.Value(j + 1) == '/')
|
||||
j++;
|
||||
}
|
||||
len = i-1 ;
|
||||
if (aString.Value(len) == '/') len-- ;
|
||||
aString.Trunc(len) ;
|
||||
return len ;
|
||||
len = i - 1;
|
||||
if (aString.Value(len) == '/')
|
||||
len--;
|
||||
aString.Trunc(len);
|
||||
return len;
|
||||
}
|
||||
static TCollection_AsciiString GetDirFromFile(const TCollection_ExtendedString& aFileName) {
|
||||
TCollection_AsciiString theCFile=UTL::CString(aFileName);
|
||||
|
||||
static TCollection_AsciiString GetDirFromFile(const TCollection_ExtendedString& aFileName)
|
||||
{
|
||||
TCollection_AsciiString theCFile = UTL::CString(aFileName);
|
||||
TCollection_AsciiString theDirectory;
|
||||
Standard_Integer i=theCFile.SearchFromEnd("/");
|
||||
#ifdef _WIN32
|
||||
// if(i==-1) i=theCFile.SearchFromEnd("\\");
|
||||
if(theCFile.SearchFromEnd("\\") > i)
|
||||
i=theCFile.SearchFromEnd("\\");
|
||||
Standard_Integer i = theCFile.SearchFromEnd("/");
|
||||
#ifdef _WIN32
|
||||
// if(i==-1) i=theCFile.SearchFromEnd("\\");
|
||||
if (theCFile.SearchFromEnd("\\") > i)
|
||||
i = theCFile.SearchFromEnd("\\");
|
||||
#endif
|
||||
if(i!=-1) theDirectory=theCFile.SubString(1,i);
|
||||
if (i != -1)
|
||||
theDirectory = theCFile.SubString(1, i);
|
||||
return theDirectory;
|
||||
}
|
||||
|
||||
static TCollection_AsciiString AbsolutePath(
|
||||
const TCollection_AsciiString& aDirPath,
|
||||
const TCollection_AsciiString& aRelFilePath)
|
||||
static TCollection_AsciiString AbsolutePath(const TCollection_AsciiString& aDirPath,
|
||||
const TCollection_AsciiString& aRelFilePath)
|
||||
{
|
||||
TCollection_AsciiString EmptyString = "" ;
|
||||
TCollection_AsciiString EmptyString = "";
|
||||
#ifdef _WIN32
|
||||
if (aRelFilePath.Search(":") == 2 ||
|
||||
(aRelFilePath.Search("\\") == 1 && aRelFilePath.Value(2) == '\\'))
|
||||
if (aRelFilePath.Search(":") == 2
|
||||
|| (aRelFilePath.Search("\\") == 1 && aRelFilePath.Value(2) == '\\'))
|
||||
#else
|
||||
if(aRelFilePath.Search("/") == 1)
|
||||
if (aRelFilePath.Search("/") == 1)
|
||||
#endif
|
||||
return aRelFilePath ;
|
||||
|
||||
TCollection_AsciiString DirPath = aDirPath, RelFilePath = aRelFilePath ;
|
||||
Standard_Integer i,len ;
|
||||
|
||||
#ifdef _WIN32
|
||||
if(DirPath.Search(":") != 2 &&
|
||||
(DirPath.Search("\\") != 1 || DirPath.Value(2) != '\\'))
|
||||
#else
|
||||
if (DirPath.Search("/") != 1 )
|
||||
#endif
|
||||
return EmptyString ;
|
||||
return aRelFilePath;
|
||||
|
||||
TCollection_AsciiString DirPath = aDirPath, RelFilePath = aRelFilePath;
|
||||
Standard_Integer i, len;
|
||||
|
||||
#ifdef _WIN32
|
||||
DirPath.ChangeAll('\\','/') ;
|
||||
RelFilePath.ChangeAll('\\','/') ;
|
||||
if (DirPath.Search(":") != 2 && (DirPath.Search("\\") != 1 || DirPath.Value(2) != '\\'))
|
||||
#else
|
||||
if (DirPath.Search("/") != 1)
|
||||
#endif
|
||||
|
||||
RemoveExtraSeparator(DirPath) ;
|
||||
len = RemoveExtraSeparator(RelFilePath) ;
|
||||
|
||||
while (RelFilePath.Search("../") == 1) {
|
||||
if (len == 3)
|
||||
return EmptyString ;
|
||||
RelFilePath = RelFilePath.SubString(4,len) ;
|
||||
len -= 3 ;
|
||||
if (DirPath.IsEmpty())
|
||||
return EmptyString ;
|
||||
i = DirPath.SearchFromEnd("/") ;
|
||||
if (i < 0)
|
||||
return EmptyString ;
|
||||
DirPath.Trunc(i-1) ;
|
||||
}
|
||||
return EmptyString;
|
||||
|
||||
#ifdef _WIN32
|
||||
DirPath.ChangeAll('\\', '/');
|
||||
RelFilePath.ChangeAll('\\', '/');
|
||||
#endif
|
||||
|
||||
RemoveExtraSeparator(DirPath);
|
||||
len = RemoveExtraSeparator(RelFilePath);
|
||||
|
||||
while (RelFilePath.Search("../") == 1)
|
||||
{
|
||||
if (len == 3)
|
||||
return EmptyString;
|
||||
RelFilePath = RelFilePath.SubString(4, len);
|
||||
len -= 3;
|
||||
if (DirPath.IsEmpty())
|
||||
return EmptyString;
|
||||
i = DirPath.SearchFromEnd("/");
|
||||
if (i < 0)
|
||||
return EmptyString;
|
||||
DirPath.Trunc(i - 1);
|
||||
}
|
||||
TCollection_AsciiString retx;
|
||||
retx= DirPath;
|
||||
retx+= "/";
|
||||
retx+=RelFilePath ;
|
||||
retx = DirPath;
|
||||
retx += "/";
|
||||
retx += RelFilePath;
|
||||
return retx;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : XmlLDrivers_DocumentRetrievalDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
XmlLDrivers_DocumentRetrievalDriver::XmlLDrivers_DocumentRetrievalDriver()
|
||||
{
|
||||
myReaderStatus = PCDM_RS_OK;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Read
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void XmlLDrivers_DocumentRetrievalDriver::Read
|
||||
(const TCollection_ExtendedString& theFileName,
|
||||
const Handle(CDM_Document)& theNewDocument,
|
||||
const Handle(CDM_Application)& theApplication,
|
||||
const Handle(PCDM_ReaderFilter)& theFilter,
|
||||
const Message_ProgressRange& theRange)
|
||||
//=================================================================================================
|
||||
|
||||
void XmlLDrivers_DocumentRetrievalDriver::Read(const TCollection_ExtendedString& theFileName,
|
||||
const Handle(CDM_Document)& theNewDocument,
|
||||
const Handle(CDM_Application)& theApplication,
|
||||
const Handle(PCDM_ReaderFilter)& theFilter,
|
||||
const Message_ProgressRange& theRange)
|
||||
{
|
||||
myReaderStatus = PCDM_RS_DriverFailure;
|
||||
myFileName = theFileName;
|
||||
myFileName = theFileName;
|
||||
|
||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::istream> aFileStream = aFileSystem->OpenIStream (myFileName, std::ios::in);
|
||||
std::shared_ptr<std::istream> aFileStream = aFileSystem->OpenIStream(myFileName, std::ios::in);
|
||||
|
||||
if (aFileStream.get() != NULL && aFileStream->good())
|
||||
{
|
||||
Read (*aFileStream, NULL, theNewDocument, theApplication, theFilter, theRange);
|
||||
Read(*aFileStream, NULL, theNewDocument, theApplication, theFilter, theRange);
|
||||
}
|
||||
else
|
||||
{
|
||||
myReaderStatus = PCDM_RS_OpenError;
|
||||
|
||||
TCollection_ExtendedString aMsg = TCollection_ExtendedString("Error: the file ") +
|
||||
theFileName + " cannot be opened for reading";
|
||||
|
||||
theApplication->MessageDriver()->Send (aMsg.ToExtString(), Message_Fail);
|
||||
TCollection_ExtendedString aMsg = TCollection_ExtendedString("Error: the file ") + theFileName
|
||||
+ " cannot be opened for reading";
|
||||
|
||||
theApplication->MessageDriver()->Send(aMsg.ToExtString(), Message_Fail);
|
||||
throw Standard_Failure("File cannot be opened for reading");
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Read
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void XmlLDrivers_DocumentRetrievalDriver::Read (Standard_IStream& theIStream,
|
||||
const Handle(Storage_Data)& /*theStorageData*/,
|
||||
const Handle(CDM_Document)& theNewDocument,
|
||||
const Handle(CDM_Application)& theApplication,
|
||||
const Handle(PCDM_ReaderFilter)& /*theFilter*/,
|
||||
const Message_ProgressRange& theRange)
|
||||
//=================================================================================================
|
||||
|
||||
void XmlLDrivers_DocumentRetrievalDriver::Read(Standard_IStream& theIStream,
|
||||
const Handle(Storage_Data)& /*theStorageData*/,
|
||||
const Handle(CDM_Document)& theNewDocument,
|
||||
const Handle(CDM_Application)& theApplication,
|
||||
const Handle(PCDM_ReaderFilter)& /*theFilter*/,
|
||||
const Message_ProgressRange& theRange)
|
||||
{
|
||||
Handle(Message_Messenger) aMessageDriver = theApplication -> MessageDriver();
|
||||
::take_time (~0, " +++++ Start RETRIEVE procedures ++++++", aMessageDriver);
|
||||
Handle(Message_Messenger) aMessageDriver = theApplication->MessageDriver();
|
||||
::take_time(~0, " +++++ Start RETRIEVE procedures ++++++", aMessageDriver);
|
||||
|
||||
// 1. Read DOM_Document from file
|
||||
LDOMParser aParser;
|
||||
|
||||
// if myFileName is not empty, "document" tag is required to be read
|
||||
// if myFileName is not empty, "document" tag is required to be read
|
||||
// from the received document
|
||||
Standard_Boolean aWithoutRoot = myFileName.IsEmpty();
|
||||
|
||||
@@ -215,47 +214,47 @@ void XmlLDrivers_DocumentRetrievalDriver::Read (Standard_IStream& t
|
||||
myReaderStatus = PCDM_RS_FormatFailure;
|
||||
return;
|
||||
}
|
||||
const XmlObjMgt_Element anElement= aParser.getDocument().getDocumentElement();
|
||||
::take_time (0, " +++++ Fin parsing XML : ", aMessageDriver);
|
||||
const XmlObjMgt_Element anElement = aParser.getDocument().getDocumentElement();
|
||||
::take_time(0, " +++++ Fin parsing XML : ", aMessageDriver);
|
||||
|
||||
ReadFromDomDocument (anElement, theNewDocument, theApplication, theRange);
|
||||
ReadFromDomDocument(anElement, theNewDocument, theApplication, theRange);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadFromDomDocument
|
||||
//purpose : management of the macro-structure of XML document data
|
||||
//remark : If the application needs to use myRelocTable to retrieve additional
|
||||
// function : ReadFromDomDocument
|
||||
// purpose : management of the macro-structure of XML document data
|
||||
// remark : If the application needs to use myRelocTable to retrieve additional
|
||||
// data from LDOM, this method should be reimplemented
|
||||
//=======================================================================
|
||||
|
||||
void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
|
||||
(const XmlObjMgt_Element& theElement,
|
||||
const Handle(CDM_Document)& theNewDocument,
|
||||
const Handle(CDM_Application)& theApplication,
|
||||
const Message_ProgressRange& theRange)
|
||||
void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument(
|
||||
const XmlObjMgt_Element& theElement,
|
||||
const Handle(CDM_Document)& theNewDocument,
|
||||
const Handle(CDM_Application)& theApplication,
|
||||
const Message_ProgressRange& theRange)
|
||||
{
|
||||
const Handle(Message_Messenger) aMsgDriver =
|
||||
theApplication -> MessageDriver();
|
||||
const Handle(Message_Messenger) aMsgDriver = theApplication->MessageDriver();
|
||||
// 1. Read info // to be done
|
||||
TCollection_AsciiString anAbsoluteDirectory = GetDirFromFile(myFileName);
|
||||
Standard_Integer aCurDocVersion = TDocStd_FormatVersion_VERSION_2; // minimum supported version
|
||||
TCollection_ExtendedString anInfo;
|
||||
const XmlObjMgt_Element anInfoElem =
|
||||
theElement.GetChildByTagName ("info");
|
||||
if (anInfoElem != NULL) {
|
||||
const XmlObjMgt_Element anInfoElem = theElement.GetChildByTagName("info");
|
||||
if (anInfoElem != NULL)
|
||||
{
|
||||
XmlObjMgt_DOMString aDocVerStr = anInfoElem.getAttribute("DocVersion");
|
||||
if (aDocVerStr != NULL)
|
||||
{
|
||||
Standard_Integer anIntegerVersion = 0;
|
||||
if (aDocVerStr.GetInteger (anIntegerVersion))
|
||||
if (aDocVerStr.GetInteger(anIntegerVersion))
|
||||
{
|
||||
aCurDocVersion = anIntegerVersion;
|
||||
}
|
||||
else
|
||||
{
|
||||
TCollection_ExtendedString aMsg =
|
||||
TCollection_ExtendedString ("Cannot retrieve the current Document version"
|
||||
" attribute as \"") + aDocVerStr + "\"";
|
||||
TCollection_ExtendedString("Cannot retrieve the current Document version"
|
||||
" attribute as \"")
|
||||
+ aDocVerStr + "\"";
|
||||
if (!aMsgDriver.IsNull())
|
||||
{
|
||||
aMsgDriver->Send(aMsg.ToExtString(), Message_Fail);
|
||||
@@ -265,144 +264,171 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
|
||||
|
||||
// oan: OCC22305 - check a document version and if it's greater than
|
||||
// current version of storage driver set an error status and return
|
||||
if( aCurDocVersion > TDocStd_Document::CurrentStorageFormatVersion() )
|
||||
if (aCurDocVersion > TDocStd_Document::CurrentStorageFormatVersion())
|
||||
{
|
||||
TCollection_ExtendedString aMsg =
|
||||
TCollection_ExtendedString ("error: wrong file version: ") +
|
||||
aDocVerStr + " while current is " +
|
||||
TDocStd_Document::CurrentStorageFormatVersion();
|
||||
TCollection_ExtendedString aMsg = TCollection_ExtendedString("error: wrong file version: ")
|
||||
+ aDocVerStr + " while current is "
|
||||
+ TDocStd_Document::CurrentStorageFormatVersion();
|
||||
myReaderStatus = PCDM_RS_NoVersion;
|
||||
if(!aMsgDriver.IsNull())
|
||||
if (!aMsgDriver.IsNull())
|
||||
aMsgDriver->Send(aMsg.ToExtString(), Message_Fail);
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Boolean isRef = Standard_False;
|
||||
for (LDOM_Node aNode = anInfoElem.getFirstChild();
|
||||
aNode != NULL; aNode = aNode.getNextSibling()) {
|
||||
if (aNode.getNodeType() == LDOM_Node::ELEMENT_NODE) {
|
||||
if (XmlObjMgt::GetExtendedString ((LDOM_Element&)aNode, anInfo)) {
|
||||
for (LDOM_Node aNode = anInfoElem.getFirstChild(); aNode != NULL;
|
||||
aNode = aNode.getNextSibling())
|
||||
{
|
||||
if (aNode.getNodeType() == LDOM_Node::ELEMENT_NODE)
|
||||
{
|
||||
if (XmlObjMgt::GetExtendedString((LDOM_Element&)aNode, anInfo))
|
||||
{
|
||||
|
||||
// Read ref counter
|
||||
if(anInfo.Search(REFERENCE_COUNTER) != -1) {
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
TCollection_AsciiString anInf(anInfo,'?');
|
||||
Standard_Integer aRefCounter = anInf.Token(" ",2).IntegerValue();
|
||||
theNewDocument->SetReferenceCounter(aRefCounter);
|
||||
}
|
||||
catch (Standard_Failure const&) {
|
||||
// std::cout << "warning: could not read the reference counter in " << aFileName << std::endl;
|
||||
TCollection_ExtendedString aMsg("Warning: ");
|
||||
aMsg = aMsg.Cat("could not read the reference counter").Cat("\0");
|
||||
if(!aMsgDriver.IsNull())
|
||||
aMsgDriver->Send(aMsg.ToExtString(), Message_Warning);
|
||||
}
|
||||
}
|
||||
else if (anInfo.Search(MODIFICATION_COUNTER) != -1) {
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
TCollection_AsciiString anInf(anInfo,'?');
|
||||
Standard_Integer aModCounter = anInf.Token(" ",2).IntegerValue();
|
||||
theNewDocument->SetModifications (aModCounter);
|
||||
}
|
||||
catch (Standard_Failure const&) {
|
||||
TCollection_ExtendedString aMsg("Warning: could not read the modification counter\0");
|
||||
if(!aMsgDriver.IsNull())
|
||||
aMsgDriver->Send(aMsg.ToExtString(), Message_Warning);
|
||||
}
|
||||
}
|
||||
|
||||
if(anInfo == END_REF)
|
||||
isRef = Standard_False;
|
||||
if(isRef) { // Process References
|
||||
|
||||
Standard_Integer pos=anInfo.Search(" ");
|
||||
if(pos != -1) {
|
||||
// Parce RefId, DocumentVersion and FileName
|
||||
Standard_Integer aRefId;
|
||||
TCollection_ExtendedString aFileName;
|
||||
Standard_Integer aDocumentVersion;
|
||||
// Read ref counter
|
||||
if (anInfo.Search(REFERENCE_COUNTER) != -1)
|
||||
{
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
TCollection_AsciiString anInf(anInfo, '?');
|
||||
Standard_Integer aRefCounter = anInf.Token(" ", 2).IntegerValue();
|
||||
theNewDocument->SetReferenceCounter(aRefCounter);
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
{
|
||||
// std::cout << "warning: could not read the reference counter in " << aFileName <<
|
||||
// std::endl;
|
||||
TCollection_ExtendedString aMsg("Warning: ");
|
||||
aMsg = aMsg.Cat("could not read the reference counter").Cat("\0");
|
||||
if (!aMsgDriver.IsNull())
|
||||
aMsgDriver->Send(aMsg.ToExtString(), Message_Warning);
|
||||
}
|
||||
}
|
||||
else if (anInfo.Search(MODIFICATION_COUNTER) != -1)
|
||||
{
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
|
||||
TCollection_AsciiString anInf(anInfo, '?');
|
||||
Standard_Integer aModCounter = anInf.Token(" ", 2).IntegerValue();
|
||||
theNewDocument->SetModifications(aModCounter);
|
||||
}
|
||||
catch (Standard_Failure const&)
|
||||
{
|
||||
TCollection_ExtendedString aMsg("Warning: could not read the modification counter\0");
|
||||
if (!aMsgDriver.IsNull())
|
||||
aMsgDriver->Send(aMsg.ToExtString(), Message_Warning);
|
||||
}
|
||||
}
|
||||
|
||||
TCollection_ExtendedString aRest=anInfo.Split(pos);
|
||||
aRefId = UTL::IntegerValue(anInfo);
|
||||
|
||||
Standard_Integer pos2 = aRest.Search(" ");
|
||||
|
||||
aFileName = aRest.Split(pos2);
|
||||
aDocumentVersion = UTL::IntegerValue(aRest);
|
||||
|
||||
TCollection_AsciiString aPath = UTL::CString(aFileName);
|
||||
TCollection_AsciiString anAbsolutePath;
|
||||
if(!anAbsoluteDirectory.IsEmpty()) {
|
||||
anAbsolutePath = AbsolutePath(anAbsoluteDirectory,aPath);
|
||||
if(!anAbsolutePath.IsEmpty()) aPath=anAbsolutePath;
|
||||
}
|
||||
if(!aMsgDriver.IsNull()) {
|
||||
// std::cout << "reference found; ReferenceIdentifier: " << theReferenceIdentifier << "; File:" << thePath << ", version:" << theDocumentVersion;
|
||||
TCollection_ExtendedString aMsg("Warning: ");
|
||||
aMsg = aMsg.Cat("reference found; ReferenceIdentifier: ").Cat(aRefId).Cat("; File:").Cat(aPath).Cat(", version:").Cat(aDocumentVersion).Cat("\0");
|
||||
aMsgDriver->Send(aMsg.ToExtString(), Message_Warning);
|
||||
}
|
||||
// Add new ref!
|
||||
/////////////
|
||||
TCollection_ExtendedString theFolder,theName;
|
||||
//TCollection_ExtendedString theFile=myReferences(myIterator).FileName();
|
||||
TCollection_ExtendedString f(aPath);
|
||||
if (anInfo == END_REF)
|
||||
isRef = Standard_False;
|
||||
if (isRef)
|
||||
{ // Process References
|
||||
|
||||
Standard_Integer pos = anInfo.Search(" ");
|
||||
if (pos != -1)
|
||||
{
|
||||
// Parce RefId, DocumentVersion and FileName
|
||||
Standard_Integer aRefId;
|
||||
TCollection_ExtendedString aFileName;
|
||||
Standard_Integer aDocumentVersion;
|
||||
|
||||
TCollection_ExtendedString aRest = anInfo.Split(pos);
|
||||
aRefId = UTL::IntegerValue(anInfo);
|
||||
|
||||
Standard_Integer pos2 = aRest.Search(" ");
|
||||
|
||||
aFileName = aRest.Split(pos2);
|
||||
aDocumentVersion = UTL::IntegerValue(aRest);
|
||||
|
||||
TCollection_AsciiString aPath = UTL::CString(aFileName);
|
||||
TCollection_AsciiString anAbsolutePath;
|
||||
if (!anAbsoluteDirectory.IsEmpty())
|
||||
{
|
||||
anAbsolutePath = AbsolutePath(anAbsoluteDirectory, aPath);
|
||||
if (!anAbsolutePath.IsEmpty())
|
||||
aPath = anAbsolutePath;
|
||||
}
|
||||
if (!aMsgDriver.IsNull())
|
||||
{
|
||||
// std::cout << "reference found; ReferenceIdentifier: " <<
|
||||
// theReferenceIdentifier << "; File:" << thePath << ", version:" <<
|
||||
// theDocumentVersion;
|
||||
TCollection_ExtendedString aMsg("Warning: ");
|
||||
aMsg = aMsg.Cat("reference found; ReferenceIdentifier: ")
|
||||
.Cat(aRefId)
|
||||
.Cat("; File:")
|
||||
.Cat(aPath)
|
||||
.Cat(", version:")
|
||||
.Cat(aDocumentVersion)
|
||||
.Cat("\0");
|
||||
aMsgDriver->Send(aMsg.ToExtString(), Message_Warning);
|
||||
}
|
||||
// Add new ref!
|
||||
/////////////
|
||||
TCollection_ExtendedString theFolder, theName;
|
||||
// TCollection_ExtendedString theFile=myReferences(myIterator).FileName();
|
||||
TCollection_ExtendedString f(aPath);
|
||||
#ifndef _WIN32
|
||||
|
||||
Standard_Integer i= f.SearchFromEnd("/");
|
||||
TCollection_ExtendedString n = f.Split(i);
|
||||
f.Trunc(f.Length()-1);
|
||||
theFolder = f;
|
||||
theName = n;
|
||||
|
||||
Standard_Integer i = f.SearchFromEnd("/");
|
||||
TCollection_ExtendedString n = f.Split(i);
|
||||
f.Trunc(f.Length() - 1);
|
||||
theFolder = f;
|
||||
theName = n;
|
||||
#else
|
||||
OSD_Path p = UTL::Path(f);
|
||||
Standard_ExtCharacter chr;
|
||||
TCollection_ExtendedString dir, dirRet, name;
|
||||
|
||||
dir = UTL::Disk(p);
|
||||
dir += UTL::Trek(p);
|
||||
|
||||
for ( int i = 1; i <= dir.Length (); ++i ) {
|
||||
|
||||
chr = dir.Value ( i );
|
||||
|
||||
switch ( chr ) {
|
||||
OSD_Path p = UTL::Path(f);
|
||||
Standard_ExtCharacter chr;
|
||||
TCollection_ExtendedString dir, dirRet, name;
|
||||
|
||||
case '|':
|
||||
dirRet += "/";
|
||||
break;
|
||||
dir = UTL::Disk(p);
|
||||
dir += UTL::Trek(p);
|
||||
|
||||
case '^':
|
||||
for (int i = 1; i <= dir.Length(); ++i)
|
||||
{
|
||||
|
||||
dirRet += "..";
|
||||
break;
|
||||
|
||||
default:
|
||||
dirRet += chr;
|
||||
|
||||
}
|
||||
}
|
||||
theFolder = dirRet;
|
||||
theName = UTL::Name(p); theName+= UTL::Extension(p);
|
||||
#endif // _WIN32
|
||||
|
||||
Handle(CDM_MetaData) aMetaData =
|
||||
CDM_MetaData::LookUp(theApplication->MetaDataLookUpTable(), theFolder, theName, aPath, aPath, UTL::IsReadOnly(aFileName));
|
||||
////////////
|
||||
theNewDocument->CreateReference(aMetaData,aRefId,
|
||||
theApplication,aDocumentVersion,Standard_False);
|
||||
chr = dir.Value(i);
|
||||
|
||||
|
||||
}
|
||||
switch (chr)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
if(anInfo == START_REF)
|
||||
isRef = Standard_True;
|
||||
case '|':
|
||||
dirRet += "/";
|
||||
break;
|
||||
|
||||
case '^':
|
||||
|
||||
dirRet += "..";
|
||||
break;
|
||||
|
||||
default:
|
||||
dirRet += chr;
|
||||
}
|
||||
}
|
||||
theFolder = dirRet;
|
||||
theName = UTL::Name(p);
|
||||
theName += UTL::Extension(p);
|
||||
#endif // _WIN32
|
||||
|
||||
Handle(CDM_MetaData) aMetaData =
|
||||
CDM_MetaData::LookUp(theApplication->MetaDataLookUpTable(),
|
||||
theFolder,
|
||||
theName,
|
||||
aPath,
|
||||
aPath,
|
||||
UTL::IsReadOnly(aFileName));
|
||||
////////////
|
||||
theNewDocument->CreateReference(aMetaData,
|
||||
aRefId,
|
||||
theApplication,
|
||||
aDocumentVersion,
|
||||
Standard_False);
|
||||
}
|
||||
}
|
||||
if (anInfo == START_REF)
|
||||
isRef = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -410,16 +436,15 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
|
||||
|
||||
// 2. Read comments
|
||||
TCollection_ExtendedString aComment;
|
||||
const XmlObjMgt_Element aCommentsElem =
|
||||
theElement.GetChildByTagName ("comments");
|
||||
const XmlObjMgt_Element aCommentsElem = theElement.GetChildByTagName("comments");
|
||||
if (aCommentsElem != NULL)
|
||||
{
|
||||
for (LDOM_Node aNode = aCommentsElem.getFirstChild();
|
||||
aNode != NULL; aNode = aNode.getNextSibling())
|
||||
for (LDOM_Node aNode = aCommentsElem.getFirstChild(); aNode != NULL;
|
||||
aNode = aNode.getNextSibling())
|
||||
{
|
||||
if (aNode.getNodeType() == LDOM_Node::ELEMENT_NODE)
|
||||
{
|
||||
if (XmlObjMgt::GetExtendedString ((LDOM_Element&)aNode, aComment))
|
||||
if (XmlObjMgt::GetExtendedString((LDOM_Element&)aNode, aComment))
|
||||
{
|
||||
theNewDocument->AddComment(aComment);
|
||||
}
|
||||
@@ -428,10 +453,11 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
|
||||
}
|
||||
Message_ProgressScope aPS(theRange, "Reading document", 2);
|
||||
// 2. Read Shapes section
|
||||
if (myDrivers.IsNull()) myDrivers = AttributeDrivers (aMsgDriver);
|
||||
if (myDrivers.IsNull())
|
||||
myDrivers = AttributeDrivers(aMsgDriver);
|
||||
const Handle(XmlMDF_ADriver) aNSDriver = ReadShapeSection(theElement, aMsgDriver, aPS.Next());
|
||||
if(!aNSDriver.IsNull())
|
||||
::take_time (0, " +++++ Fin reading Shapes : ", aMsgDriver);
|
||||
if (!aNSDriver.IsNull())
|
||||
::take_time(0, " +++++ Fin reading Shapes : ", aMsgDriver);
|
||||
|
||||
if (!aPS.More())
|
||||
{
|
||||
@@ -450,8 +476,8 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
#ifdef OCCT_DEBUG
|
||||
TCollection_ExtendedString aMessage ("PasteDocument");
|
||||
aMsgDriver ->Send (aMessage.ToExtString(), Message_Trace);
|
||||
TCollection_ExtendedString aMessage("PasteDocument");
|
||||
aMsgDriver->Send(aMessage.ToExtString(), Message_Trace);
|
||||
#endif
|
||||
if (!MakeDocument(theElement, theNewDocument, aPS.Next()))
|
||||
myReaderStatus = PCDM_RS_MakeFailure;
|
||||
@@ -460,8 +486,8 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
|
||||
}
|
||||
catch (Standard_Failure const& anException)
|
||||
{
|
||||
TCollection_ExtendedString anErrorString (anException.GetMessageString());
|
||||
aMsgDriver ->Send (anErrorString.ToExtString(), Message_Fail);
|
||||
TCollection_ExtendedString anErrorString(anException.GetMessageString());
|
||||
aMsgDriver->Send(anErrorString.ToExtString(), Message_Fail);
|
||||
}
|
||||
if (!aPS.More())
|
||||
{
|
||||
@@ -476,93 +502,94 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
|
||||
// If the application needs to use myRelocTable to retrieve additional
|
||||
// data from LDOM, this method should be reimplemented avoiding this step
|
||||
myRelocTable.Clear();
|
||||
::take_time (0, " +++++ Fin reading data OCAF : ", aMsgDriver);
|
||||
::take_time(0, " +++++ Fin reading data OCAF : ", aMsgDriver);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeDocument
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean XmlLDrivers_DocumentRetrievalDriver::MakeDocument
|
||||
(const XmlObjMgt_Element& theElement,
|
||||
const Handle(CDM_Document)& theTDoc,
|
||||
const Message_ProgressRange& theRange)
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean XmlLDrivers_DocumentRetrievalDriver::MakeDocument(
|
||||
const XmlObjMgt_Element& theElement,
|
||||
const Handle(CDM_Document)& theTDoc,
|
||||
const Message_ProgressRange& theRange)
|
||||
{
|
||||
Standard_Boolean aResult = Standard_False;
|
||||
Handle(TDocStd_Document) TDOC = Handle(TDocStd_Document)::DownCast(theTDoc);
|
||||
if (!TDOC.IsNull())
|
||||
Standard_Boolean aResult = Standard_False;
|
||||
Handle(TDocStd_Document) TDOC = Handle(TDocStd_Document)::DownCast(theTDoc);
|
||||
if (!TDOC.IsNull())
|
||||
{
|
||||
Handle(TDF_Data) aTDF = new TDF_Data();
|
||||
aResult = XmlMDF::FromTo (theElement, aTDF, myRelocTable, myDrivers, theRange);
|
||||
if (aResult) {
|
||||
TDOC->SetData (aTDF);
|
||||
TDocStd_Owner::SetDocument (aTDF, TDOC);
|
||||
aResult = XmlMDF::FromTo(theElement, aTDF, myRelocTable, myDrivers, theRange);
|
||||
if (aResult)
|
||||
{
|
||||
TDOC->SetData(aTDF);
|
||||
TDocStd_Owner::SetDocument(aTDF, TDOC);
|
||||
}
|
||||
}
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AttributeDrivers
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(XmlMDF_ADriverTable) XmlLDrivers_DocumentRetrievalDriver::AttributeDrivers
|
||||
(const Handle(Message_Messenger)& theMessageDriver)
|
||||
//=================================================================================================
|
||||
|
||||
Handle(XmlMDF_ADriverTable) XmlLDrivers_DocumentRetrievalDriver::AttributeDrivers(
|
||||
const Handle(Message_Messenger)& theMessageDriver)
|
||||
{
|
||||
return XmlLDrivers::AttributeDrivers (theMessageDriver);
|
||||
return XmlLDrivers::AttributeDrivers(theMessageDriver);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : take_time
|
||||
//class : static
|
||||
//purpose : output astronomical time elapsed
|
||||
// function : take_time
|
||||
// class : static
|
||||
// purpose : output astronomical time elapsed
|
||||
//=======================================================================
|
||||
#ifdef TAKE_TIMES
|
||||
#include <time.h>
|
||||
#include <sys/timeb.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#ifndef _WIN32
|
||||
extern "C" int ftime (struct timeb *tp);
|
||||
#endif
|
||||
extern struct timeb tmbuf0;
|
||||
#include <time.h>
|
||||
#include <sys/timeb.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#ifndef _WIN32
|
||||
extern "C" int ftime(struct timeb* tp);
|
||||
#endif
|
||||
extern struct timeb tmbuf0;
|
||||
|
||||
static void take_time (const Standard_Integer isReset, const char * aHeader,
|
||||
const Handle(Message_Messenger)& aMessageDriver)
|
||||
static void take_time(const Standard_Integer isReset,
|
||||
const char* aHeader,
|
||||
const Handle(Message_Messenger)& aMessageDriver)
|
||||
{
|
||||
struct timeb tmbuf;
|
||||
ftime (&tmbuf);
|
||||
TCollection_ExtendedString aMessage ((Standard_CString)aHeader);
|
||||
if (isReset) tmbuf0 = tmbuf;
|
||||
else {
|
||||
char take_tm_buf [64];
|
||||
Sprintf (take_tm_buf, "%9.2f s ++++",
|
||||
double(tmbuf.time - tmbuf0.time) +
|
||||
double(tmbuf.millitm - tmbuf0.millitm)/1000.);
|
||||
struct timeb tmbuf;
|
||||
ftime(&tmbuf);
|
||||
TCollection_ExtendedString aMessage((Standard_CString)aHeader);
|
||||
if (isReset)
|
||||
tmbuf0 = tmbuf;
|
||||
else
|
||||
{
|
||||
char take_tm_buf[64];
|
||||
Sprintf(take_tm_buf,
|
||||
"%9.2f s ++++",
|
||||
double(tmbuf.time - tmbuf0.time) + double(tmbuf.millitm - tmbuf0.millitm) / 1000.);
|
||||
aMessage += take_tm_buf;
|
||||
}
|
||||
aMessageDriver -> Write (aMessage.ToExtString());
|
||||
aMessageDriver->Write(aMessage.ToExtString());
|
||||
}
|
||||
#endif
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadShapeSection
|
||||
//purpose : definition of ReadShapeSection
|
||||
// function : ReadShapeSection
|
||||
// purpose : definition of ReadShapeSection
|
||||
//=======================================================================
|
||||
Handle(XmlMDF_ADriver) XmlLDrivers_DocumentRetrievalDriver::ReadShapeSection(
|
||||
const XmlObjMgt_Element& /*theElement*/,
|
||||
const Handle(Message_Messenger)& /*aMsgDriver*/,
|
||||
const Message_ProgressRange& /*theRange*/)
|
||||
const XmlObjMgt_Element& /*theElement*/,
|
||||
const Handle(Message_Messenger)& /*aMsgDriver*/,
|
||||
const Message_ProgressRange& /*theRange*/)
|
||||
{
|
||||
Handle(XmlMDF_ADriver) aDriver;
|
||||
//empty; to be redefined
|
||||
// empty; to be redefined
|
||||
return aDriver;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ShapeSetCleaning
|
||||
//purpose : definition of ShapeSetCleaning
|
||||
// function : ShapeSetCleaning
|
||||
// purpose : definition of ShapeSetCleaning
|
||||
//=======================================================================
|
||||
void XmlLDrivers_DocumentRetrievalDriver::ShapeSetCleaning(
|
||||
const Handle(XmlMDF_ADriver)& /*theDriver*/)
|
||||
{}
|
||||
const Handle(XmlMDF_ADriver)& /*theDriver*/)
|
||||
{
|
||||
}
|
||||
|
@@ -31,74 +31,59 @@ class CDM_Application;
|
||||
class Message_Messenger;
|
||||
class XmlMDF_ADriver;
|
||||
|
||||
|
||||
class XmlLDrivers_DocumentRetrievalDriver;
|
||||
DEFINE_STANDARD_HANDLE(XmlLDrivers_DocumentRetrievalDriver, PCDM_RetrievalDriver)
|
||||
|
||||
|
||||
class XmlLDrivers_DocumentRetrievalDriver : public PCDM_RetrievalDriver
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT XmlLDrivers_DocumentRetrievalDriver();
|
||||
|
||||
Standard_EXPORT virtual void Read (const TCollection_ExtendedString& theFileName,
|
||||
const Handle(CDM_Document)& theNewDocument,
|
||||
const Handle(CDM_Application)& theApplication,
|
||||
const Handle(PCDM_ReaderFilter)& theFilter = Handle(PCDM_ReaderFilter)(),
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Read (Standard_IStream& theIStream,
|
||||
const Handle(Storage_Data)& theStorageData,
|
||||
const Handle(CDM_Document)& theDoc,
|
||||
const Handle(CDM_Application)& theApplication,
|
||||
const Handle(PCDM_ReaderFilter)& theFilter = Handle(PCDM_ReaderFilter)(),
|
||||
const Message_ProgressRange& theRange= Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Handle(XmlMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver);
|
||||
Standard_EXPORT virtual void Read(
|
||||
const TCollection_ExtendedString& theFileName,
|
||||
const Handle(CDM_Document)& theNewDocument,
|
||||
const Handle(CDM_Application)& theApplication,
|
||||
const Handle(PCDM_ReaderFilter)& theFilter = Handle(PCDM_ReaderFilter)(),
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Read(
|
||||
Standard_IStream& theIStream,
|
||||
const Handle(Storage_Data)& theStorageData,
|
||||
const Handle(CDM_Document)& theDoc,
|
||||
const Handle(CDM_Application)& theApplication,
|
||||
const Handle(PCDM_ReaderFilter)& theFilter = Handle(PCDM_ReaderFilter)(),
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Handle(XmlMDF_ADriverTable) AttributeDrivers(
|
||||
const Handle(Message_Messenger)& theMsgDriver);
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XmlLDrivers_DocumentRetrievalDriver,PCDM_RetrievalDriver)
|
||||
DEFINE_STANDARD_RTTIEXT(XmlLDrivers_DocumentRetrievalDriver, PCDM_RetrievalDriver)
|
||||
|
||||
protected:
|
||||
Standard_EXPORT virtual void ReadFromDomDocument(
|
||||
const XmlObjMgt_Element& theDomElement,
|
||||
const Handle(CDM_Document)& theNewDocument,
|
||||
const Handle(CDM_Application)& theApplication,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange());
|
||||
|
||||
|
||||
Standard_EXPORT virtual void ReadFromDomDocument (const XmlObjMgt_Element& theDomElement,
|
||||
const Handle(CDM_Document)& theNewDocument,
|
||||
const Handle(CDM_Application)& theApplication,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange());
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean MakeDocument (const XmlObjMgt_Element& thePDoc,
|
||||
const Handle(CDM_Document)& theTDoc,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange());
|
||||
|
||||
Standard_EXPORT virtual Handle(XmlMDF_ADriver) ReadShapeSection
|
||||
(const XmlObjMgt_Element& thePDoc,
|
||||
const Handle(Message_Messenger)& theMsgDriver,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange());
|
||||
|
||||
Standard_EXPORT virtual void ShapeSetCleaning (const Handle(XmlMDF_ADriver)& theDriver);
|
||||
Standard_EXPORT virtual Standard_Boolean MakeDocument(
|
||||
const XmlObjMgt_Element& thePDoc,
|
||||
const Handle(CDM_Document)& theTDoc,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange());
|
||||
|
||||
Standard_EXPORT virtual Handle(XmlMDF_ADriver) ReadShapeSection(
|
||||
const XmlObjMgt_Element& thePDoc,
|
||||
const Handle(Message_Messenger)& theMsgDriver,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange());
|
||||
|
||||
Standard_EXPORT virtual void ShapeSetCleaning(const Handle(XmlMDF_ADriver)& theDriver);
|
||||
|
||||
Handle(XmlMDF_ADriverTable) myDrivers;
|
||||
XmlObjMgt_RRelocationTable myRelocTable;
|
||||
TCollection_ExtendedString myFileName;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _XmlLDrivers_DocumentRetrievalDriver_HeaderFile
|
||||
|
@@ -13,7 +13,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <CDM_Application.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
@@ -40,216 +39,211 @@
|
||||
#include <XmlObjMgt_Document.hxx>
|
||||
#include <XmlObjMgt_SRelocationTable.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlLDrivers_DocumentStorageDriver,PCDM_StorageDriver)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlLDrivers_DocumentStorageDriver, PCDM_StorageDriver)
|
||||
|
||||
#define STORAGE_VERSION "STORAGE_VERSION: "
|
||||
#define REFERENCE_COUNTER "REFERENCE_COUNTER: "
|
||||
#define STORAGE_VERSION "STORAGE_VERSION: "
|
||||
#define REFERENCE_COUNTER "REFERENCE_COUNTER: "
|
||||
#define MODIFICATION_COUNTER "MODIFICATION_COUNTER: "
|
||||
#define START_REF "START_REF"
|
||||
#define END_REF "END_REF"
|
||||
#define START_REF "START_REF"
|
||||
#define END_REF "END_REF"
|
||||
|
||||
#define FAILSTR "Failed to write xsi:schemaLocation : "
|
||||
|
||||
//#define TAKE_TIMES
|
||||
static void take_time (const Standard_Integer, const char *,
|
||||
const Handle(Message_Messenger)&)
|
||||
// #define TAKE_TIMES
|
||||
static void take_time(const Standard_Integer, const char*, const Handle(Message_Messenger)&)
|
||||
#ifdef TAKE_TIMES
|
||||
;
|
||||
;
|
||||
#else
|
||||
{}
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
//=======================================================================
|
||||
//function : XmlLDrivers_DocumentStorageDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
XmlLDrivers_DocumentStorageDriver::XmlLDrivers_DocumentStorageDriver
|
||||
(const TCollection_ExtendedString& theCopyright)
|
||||
: myCopyright (theCopyright)
|
||||
{
|
||||
//=================================================================================================
|
||||
|
||||
XmlLDrivers_DocumentStorageDriver::XmlLDrivers_DocumentStorageDriver(
|
||||
const TCollection_ExtendedString& theCopyright)
|
||||
: myCopyright(theCopyright)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddNamespace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void XmlLDrivers_DocumentStorageDriver::AddNamespace
|
||||
(const TCollection_AsciiString& thePrefix,
|
||||
const TCollection_AsciiString& theURI)
|
||||
void XmlLDrivers_DocumentStorageDriver::AddNamespace(const TCollection_AsciiString& thePrefix,
|
||||
const TCollection_AsciiString& theURI)
|
||||
{
|
||||
for (Standard_Integer i = 1; i <= mySeqOfNS.Length(); i++)
|
||||
if (thePrefix == mySeqOfNS(i).Prefix()) return;
|
||||
mySeqOfNS.Append (XmlLDrivers_NamespaceDef(thePrefix, theURI));
|
||||
if (thePrefix == mySeqOfNS(i).Prefix())
|
||||
return;
|
||||
mySeqOfNS.Append(XmlLDrivers_NamespaceDef(thePrefix, theURI));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Write
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void XmlLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDocument,
|
||||
const TCollection_ExtendedString& theFileName,
|
||||
const Message_ProgressRange& theRange)
|
||||
//=================================================================================================
|
||||
|
||||
void XmlLDrivers_DocumentStorageDriver::Write(const Handle(CDM_Document)& theDocument,
|
||||
const TCollection_ExtendedString& theFileName,
|
||||
const Message_ProgressRange& theRange)
|
||||
{
|
||||
myFileName = theFileName;
|
||||
|
||||
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
|
||||
std::shared_ptr<std::ostream> aFileStream = aFileSystem->OpenOStream (theFileName, std::ios::out | std::ios::binary);
|
||||
std::shared_ptr<std::ostream> aFileStream =
|
||||
aFileSystem->OpenOStream(theFileName, std::ios::out | std::ios::binary);
|
||||
if (aFileStream.get() != NULL && aFileStream->good())
|
||||
{
|
||||
Write (theDocument, *aFileStream, theRange);
|
||||
Write(theDocument, *aFileStream, theRange);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetIsError (Standard_True);
|
||||
SetIsError(Standard_True);
|
||||
SetStoreStatus(PCDM_SS_WriteFailure);
|
||||
|
||||
TCollection_ExtendedString aMsg = TCollection_ExtendedString("Error: the file ") +
|
||||
theFileName + " cannot be opened for writing";
|
||||
|
||||
theDocument->Application()->MessageDriver()->Send (aMsg.ToExtString(), Message_Fail);
|
||||
TCollection_ExtendedString aMsg = TCollection_ExtendedString("Error: the file ") + theFileName
|
||||
+ " cannot be opened for writing";
|
||||
|
||||
theDocument->Application()->MessageDriver()->Send(aMsg.ToExtString(), Message_Fail);
|
||||
throw Standard_Failure("File cannot be opened for writing");
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Write
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void XmlLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDocument,
|
||||
Standard_OStream& theOStream,
|
||||
const Message_ProgressRange& theRange)
|
||||
//=================================================================================================
|
||||
|
||||
void XmlLDrivers_DocumentStorageDriver::Write(const Handle(CDM_Document)& theDocument,
|
||||
Standard_OStream& theOStream,
|
||||
const Message_ProgressRange& theRange)
|
||||
{
|
||||
Handle(Message_Messenger) aMessageDriver = theDocument->Application()->MessageDriver();
|
||||
::take_time (~0, " +++++ Start STORAGE procedures ++++++", aMessageDriver);
|
||||
::take_time(~0, " +++++ Start STORAGE procedures ++++++", aMessageDriver);
|
||||
|
||||
// Create new DOM_Document
|
||||
XmlObjMgt_Document aDOMDoc = XmlObjMgt_Document::createDocument ("document");
|
||||
XmlObjMgt_Document aDOMDoc = XmlObjMgt_Document::createDocument("document");
|
||||
|
||||
// Fill the document with data
|
||||
XmlObjMgt_Element anElement = aDOMDoc.getDocumentElement();
|
||||
|
||||
if (WriteToDomDocument (theDocument, anElement, theRange) == Standard_False) {
|
||||
if (WriteToDomDocument(theDocument, anElement, theRange) == Standard_False)
|
||||
{
|
||||
|
||||
LDOM_XmlWriter aWriter;
|
||||
aWriter.SetIndentation(1);
|
||||
|
||||
|
||||
if (theOStream.good())
|
||||
{
|
||||
aWriter.Write (theOStream, aDOMDoc);
|
||||
aWriter.Write(theOStream, aDOMDoc);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetIsError (Standard_True);
|
||||
SetIsError(Standard_True);
|
||||
SetStoreStatus(PCDM_SS_WriteFailure);
|
||||
|
||||
TCollection_ExtendedString aMsg = TCollection_ExtendedString("Error: the stream is bad and") +
|
||||
" cannot be used for writing";
|
||||
theDocument->Application()->MessageDriver()->Send (aMsg.ToExtString(), Message_Fail);
|
||||
|
||||
TCollection_ExtendedString aMsg =
|
||||
TCollection_ExtendedString("Error: the stream is bad and") + " cannot be used for writing";
|
||||
theDocument->Application()->MessageDriver()->Send(aMsg.ToExtString(), Message_Fail);
|
||||
|
||||
throw Standard_Failure("File cannot be opened for writing");
|
||||
}
|
||||
|
||||
::take_time (0, " +++++ Fin formatting to XML : ", aMessageDriver);
|
||||
::take_time(0, " +++++ Fin formatting to XML : ", aMessageDriver);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteToDomDocument
|
||||
//purpose : management of the macro-structure of XML document data
|
||||
//remark : If the application needs to use myRelocTable to store additional
|
||||
// function : WriteToDomDocument
|
||||
// purpose : management of the macro-structure of XML document data
|
||||
// remark : If the application needs to use myRelocTable to store additional
|
||||
// data to XML, this method should be reimplemented avoiding step 3
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
|
||||
(const Handle(CDM_Document)& theDocument,
|
||||
XmlObjMgt_Element& theElement,
|
||||
const Message_ProgressRange& theRange)
|
||||
Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument(
|
||||
const Handle(CDM_Document)& theDocument,
|
||||
XmlObjMgt_Element& theElement,
|
||||
const Message_ProgressRange& theRange)
|
||||
{
|
||||
SetIsError(Standard_False);
|
||||
Handle(Message_Messenger) aMessageDriver =
|
||||
theDocument -> Application() -> MessageDriver();
|
||||
Handle(Message_Messenger) aMessageDriver = theDocument->Application()->MessageDriver();
|
||||
// 1. Write header information
|
||||
Standard_Integer i;
|
||||
Standard_Integer i;
|
||||
XmlObjMgt_Document aDOMDoc = theElement.getOwnerDocument();
|
||||
|
||||
// 1.a File Format
|
||||
TCollection_AsciiString aStorageFormat (theDocument->StorageFormat(), '?');
|
||||
theElement.setAttribute ("format", aStorageFormat.ToCString());
|
||||
// theElement.setAttribute ("schema", "XSD");
|
||||
TCollection_AsciiString aStorageFormat(theDocument->StorageFormat(), '?');
|
||||
theElement.setAttribute("format", aStorageFormat.ToCString());
|
||||
// theElement.setAttribute ("schema", "XSD");
|
||||
|
||||
theElement.setAttribute ("xmlns" , "http://www.opencascade.org/OCAF/XML");
|
||||
for (i = 1; i <= mySeqOfNS.Length(); i++) {
|
||||
theElement.setAttribute("xmlns", "http://www.opencascade.org/OCAF/XML");
|
||||
for (i = 1; i <= mySeqOfNS.Length(); i++)
|
||||
{
|
||||
TCollection_AsciiString aPrefix =
|
||||
TCollection_AsciiString("xmlns:") + mySeqOfNS(i).Prefix().ToCString();
|
||||
theElement.setAttribute (aPrefix.ToCString(),
|
||||
mySeqOfNS(i).URI().ToCString());
|
||||
theElement.setAttribute(aPrefix.ToCString(), mySeqOfNS(i).URI().ToCString());
|
||||
}
|
||||
theElement.setAttribute ("xmlns:xsi",
|
||||
"http://www.w3.org/2001/XMLSchema-instance");
|
||||
//mkv 15.09.05 OCC10001
|
||||
//theElement.setAttribute ("xsi:schemaLocation",
|
||||
// "http://www.opencascade.org/OCAF/XML"
|
||||
// " http://www.nnov.matra-dtv.fr/~agv/XmlOcaf.xsd");
|
||||
theElement.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
|
||||
// mkv 15.09.05 OCC10001
|
||||
// theElement.setAttribute ("xsi:schemaLocation",
|
||||
// "http://www.opencascade.org/OCAF/XML"
|
||||
// " http://www.nnov.matra-dtv.fr/~agv/XmlOcaf.xsd");
|
||||
//
|
||||
// the order of search : by CSF_XmlOcafResource and then by CASROOT
|
||||
TCollection_AsciiString anHTTP = "http://www.opencascade.org/OCAF/XML";
|
||||
Standard_Boolean aToSetCSFVariable = Standard_False;
|
||||
const char * aCSFVariable [2] = {
|
||||
"CSF_XmlOcafResource",
|
||||
"CASROOT"
|
||||
};
|
||||
OSD_Environment anEnv (aCSFVariable[0]);
|
||||
// the order of search : by CSF_XmlOcafResource and then by CASROOT
|
||||
TCollection_AsciiString anHTTP = "http://www.opencascade.org/OCAF/XML";
|
||||
Standard_Boolean aToSetCSFVariable = Standard_False;
|
||||
const char* aCSFVariable[2] = {"CSF_XmlOcafResource", "CASROOT"};
|
||||
OSD_Environment anEnv(aCSFVariable[0]);
|
||||
TCollection_AsciiString aResourceDir = anEnv.Value();
|
||||
if (aResourceDir.IsEmpty()) {
|
||||
if (aResourceDir.IsEmpty())
|
||||
{
|
||||
// now try by CASROOT
|
||||
OSD_Environment anEnv2(aCSFVariable[1]);
|
||||
aResourceDir = anEnv2.Value();
|
||||
if ( !aResourceDir.IsEmpty() ) {
|
||||
aResourceDir += "/src/XmlOcafResource" ;
|
||||
aToSetCSFVariable = Standard_True; //CSF variable to be set later
|
||||
if (!aResourceDir.IsEmpty())
|
||||
{
|
||||
aResourceDir += "/src/XmlOcafResource";
|
||||
aToSetCSFVariable = Standard_True; // CSF variable to be set later
|
||||
}
|
||||
#ifdef OCCT_DEBUGXML
|
||||
else {
|
||||
else
|
||||
{
|
||||
TCollection_ExtendedString aWarn = FAILSTR "Neither ";
|
||||
aWarn = (aWarn + aCSFVariable[0] + ", nor " + aCSFVariable[1]
|
||||
+ " variables have been set");
|
||||
aMessageDriver->Send (aWarn.ToExtString(), Message_Warning);
|
||||
aWarn = (aWarn + aCSFVariable[0] + ", nor " + aCSFVariable[1] + " variables have been set");
|
||||
aMessageDriver->Send(aWarn.ToExtString(), Message_Warning);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (!aResourceDir.IsEmpty()) {
|
||||
TCollection_AsciiString aResourceFileName = aResourceDir + "/XmlOcaf.xsd";
|
||||
if (!aResourceDir.IsEmpty())
|
||||
{
|
||||
TCollection_AsciiString aResourceFileName = aResourceDir + "/XmlOcaf.xsd";
|
||||
// search directory name that has been constructed, now check whether
|
||||
// it and the file exist
|
||||
OSD_File aResourceFile ( aResourceFileName );
|
||||
if ( aResourceFile.Exists() ) {
|
||||
if (aToSetCSFVariable) {
|
||||
OSD_Environment aCSFVarEnv ( aCSFVariable[0], aResourceDir );
|
||||
OSD_File aResourceFile(aResourceFileName);
|
||||
if (aResourceFile.Exists())
|
||||
{
|
||||
if (aToSetCSFVariable)
|
||||
{
|
||||
OSD_Environment aCSFVarEnv(aCSFVariable[0], aResourceDir);
|
||||
aCSFVarEnv.Build();
|
||||
#ifdef OCCT_DEBUGXML
|
||||
TCollection_ExtendedString aWarn1 = "Variable ";
|
||||
aWarn1 = (aWarn1 + aCSFVariable[0]
|
||||
+ " has not been explicitly defined. Set to " + aResourceDir);
|
||||
aMessageDriver->Send (aWarn1.ToExtString(), Message_Warning);
|
||||
aWarn1 =
|
||||
(aWarn1 + aCSFVariable[0] + " has not been explicitly defined. Set to " + aResourceDir);
|
||||
aMessageDriver->Send(aWarn1.ToExtString(), Message_Warning);
|
||||
#endif
|
||||
if ( aCSFVarEnv.Failed() ) {
|
||||
if (aCSFVarEnv.Failed())
|
||||
{
|
||||
TCollection_ExtendedString aWarn = FAILSTR "Failed to initialize ";
|
||||
aWarn = aWarn + aCSFVariable[0] + " with " + aResourceDir;
|
||||
aMessageDriver->Send (aWarn.ToExtString(), Message_Fail);
|
||||
aWarn = aWarn + aCSFVariable[0] + " with " + aResourceDir;
|
||||
aMessageDriver->Send(aWarn.ToExtString(), Message_Fail);
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef OCCT_DEBUGXML
|
||||
else {
|
||||
else
|
||||
{
|
||||
TCollection_ExtendedString aWarn = FAILSTR "Schema definition file ";
|
||||
aWarn += (aResourceFileName + " was not found");
|
||||
aMessageDriver->Send (aWarn.ToExtString(), Message_Warning);
|
||||
aMessageDriver->Send(aWarn.ToExtString(), Message_Warning);
|
||||
}
|
||||
#endif
|
||||
anHTTP = anHTTP + ' ' + aResourceFileName;
|
||||
}
|
||||
theElement.setAttribute ("xsi:schemaLocation", anHTTP.ToCString() );
|
||||
theElement.setAttribute("xsi:schemaLocation", anHTTP.ToCString());
|
||||
|
||||
// 1.b Info section
|
||||
XmlObjMgt_Element anInfoElem = aDOMDoc.createElement("info");
|
||||
@@ -257,42 +251,43 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
|
||||
|
||||
TCollection_AsciiString aCreationDate = XmlLDrivers::CreationDate();
|
||||
|
||||
// anInfoElem.setAttribute("dbv", 0);
|
||||
// anInfoElem.setAttribute("dbv", 0);
|
||||
anInfoElem.setAttribute("date", aCreationDate.ToCString());
|
||||
anInfoElem.setAttribute("schemav", 0);
|
||||
// anInfoElem.setAttribute("appv", anAppVersion.ToCString());
|
||||
// anInfoElem.setAttribute("appv", anAppVersion.ToCString());
|
||||
|
||||
// Document version
|
||||
Handle(TDocStd_Document) aDoc = Handle(TDocStd_Document)::DownCast (theDocument);
|
||||
// clang-format off
|
||||
Handle(TDocStd_Document) aDoc = Handle(TDocStd_Document)::DownCast(theDocument);
|
||||
// clang-format off
|
||||
TDocStd_FormatVersion aFormatVersion = TDocStd_Document::CurrentStorageFormatVersion(); // the last version of the format
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
if (TDocStd_Document::CurrentStorageFormatVersion() < aDoc->StorageFormatVersion())
|
||||
{
|
||||
TCollection_ExtendedString anErrorString("Unacceptable storage format version, the last version is used");
|
||||
aMessageDriver->Send (anErrorString.ToExtString(), Message_Warning);
|
||||
TCollection_ExtendedString anErrorString(
|
||||
"Unacceptable storage format version, the last version is used");
|
||||
aMessageDriver->Send(anErrorString.ToExtString(), Message_Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
aFormatVersion = aDoc->StorageFormatVersion();
|
||||
}
|
||||
const TCollection_AsciiString aStringFormatVersion (aFormatVersion);
|
||||
anInfoElem.setAttribute ("DocVersion", aStringFormatVersion.ToCString());
|
||||
|
||||
const TCollection_AsciiString aStringFormatVersion(aFormatVersion);
|
||||
anInfoElem.setAttribute("DocVersion", aStringFormatVersion.ToCString());
|
||||
|
||||
// User info with Copyright
|
||||
TColStd_SequenceOfAsciiString aUserInfo;
|
||||
if (myCopyright.Length() > 0)
|
||||
aUserInfo.Append (TCollection_AsciiString(myCopyright,'?'));
|
||||
aUserInfo.Append(TCollection_AsciiString(myCopyright, '?'));
|
||||
|
||||
Handle(Storage_Data) theData = new Storage_Data;
|
||||
//PCDM_ReadWriter::WriteFileFormat( theData, theDocument );
|
||||
PCDM_ReadWriter::Writer()->WriteReferenceCounter(theData,theDocument);
|
||||
PCDM_ReadWriter::Writer()->WriteReferences(theData,theDocument, myFileName);
|
||||
PCDM_ReadWriter::Writer()->WriteExtensions(theData,theDocument);
|
||||
PCDM_ReadWriter::Writer()->WriteVersion(theData,theDocument);
|
||||
// PCDM_ReadWriter::WriteFileFormat( theData, theDocument );
|
||||
PCDM_ReadWriter::Writer()->WriteReferenceCounter(theData, theDocument);
|
||||
PCDM_ReadWriter::Writer()->WriteReferences(theData, theDocument, myFileName);
|
||||
PCDM_ReadWriter::Writer()->WriteExtensions(theData, theDocument);
|
||||
PCDM_ReadWriter::Writer()->WriteVersion(theData, theDocument);
|
||||
|
||||
const TColStd_SequenceOfAsciiString& aRefs = theData->UserInfo();
|
||||
for(i = 1; i <= aRefs.Length(); i++)
|
||||
for (i = 1; i <= aRefs.Length(); i++)
|
||||
aUserInfo.Append(aRefs.Value(i));
|
||||
|
||||
// Keep format version in Reloc. table
|
||||
@@ -303,24 +298,24 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
|
||||
|
||||
for (i = 1; i <= aUserInfo.Length(); i++)
|
||||
{
|
||||
XmlObjMgt_Element aUIItem = aDOMDoc.createElement ("iitem");
|
||||
anInfoElem.appendChild (aUIItem);
|
||||
LDOM_Text aUIText = aDOMDoc.createTextNode (aUserInfo(i).ToCString());
|
||||
aUIItem.appendChild (aUIText);
|
||||
XmlObjMgt_Element aUIItem = aDOMDoc.createElement("iitem");
|
||||
anInfoElem.appendChild(aUIItem);
|
||||
LDOM_Text aUIText = aDOMDoc.createTextNode(aUserInfo(i).ToCString());
|
||||
aUIItem.appendChild(aUIText);
|
||||
}
|
||||
|
||||
// 1.c Comments section
|
||||
TColStd_SequenceOfExtendedString aComments;
|
||||
theDocument->Comments(aComments);
|
||||
|
||||
XmlObjMgt_Element aCommentsElem = aDOMDoc.createElement ("comments");
|
||||
theElement.appendChild (aCommentsElem);
|
||||
XmlObjMgt_Element aCommentsElem = aDOMDoc.createElement("comments");
|
||||
theElement.appendChild(aCommentsElem);
|
||||
|
||||
for (i = 1; i <= aComments.Length(); i++)
|
||||
{
|
||||
XmlObjMgt_Element aCItem = aDOMDoc.createElement ("citem");
|
||||
aCommentsElem.appendChild (aCItem);
|
||||
XmlObjMgt::SetExtendedString (aCItem, aComments(i));
|
||||
XmlObjMgt_Element aCItem = aDOMDoc.createElement("citem");
|
||||
aCommentsElem.appendChild(aCItem);
|
||||
XmlObjMgt::SetExtendedString(aCItem, aComments(i));
|
||||
}
|
||||
Message_ProgressScope aPS(theRange, "Writing", 2);
|
||||
// 2a. Write document contents
|
||||
@@ -339,21 +334,22 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
|
||||
}
|
||||
catch (Standard_Failure const& anException)
|
||||
{
|
||||
SetIsError (Standard_True);
|
||||
SetIsError(Standard_True);
|
||||
SetStoreStatus(PCDM_SS_Failure);
|
||||
TCollection_ExtendedString anErrorString (anException.GetMessageString());
|
||||
aMessageDriver ->Send (anErrorString.ToExtString(), Message_Fail);
|
||||
TCollection_ExtendedString anErrorString(anException.GetMessageString());
|
||||
aMessageDriver->Send(anErrorString.ToExtString(), Message_Fail);
|
||||
}
|
||||
}
|
||||
if (anObjNb <= 0 && IsError() == Standard_False) {
|
||||
SetIsError (Standard_True);
|
||||
if (anObjNb <= 0 && IsError() == Standard_False)
|
||||
{
|
||||
SetIsError(Standard_True);
|
||||
SetStoreStatus(PCDM_SS_No_Obj);
|
||||
TCollection_ExtendedString anErrorString ("error occurred");
|
||||
aMessageDriver ->Send (anErrorString.ToExtString(), Message_Fail);
|
||||
TCollection_ExtendedString anErrorString("error occurred");
|
||||
aMessageDriver->Send(anErrorString.ToExtString(), Message_Fail);
|
||||
}
|
||||
// 2b. Write number of objects into the info section
|
||||
anInfoElem.setAttribute("objnb", anObjNb);
|
||||
::take_time (0, " +++++ Fin DOM data for OCAF : ", aMessageDriver);
|
||||
::take_time(0, " +++++ Fin DOM data for OCAF : ", aMessageDriver);
|
||||
|
||||
// 3. Clear relocation table
|
||||
// If the application needs to use myRelocTable to store additional
|
||||
@@ -362,7 +358,7 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
|
||||
|
||||
// 4. Write Shapes section
|
||||
if (WriteShapeSection(theElement, aFormatVersion, aPS.Next()))
|
||||
::take_time (0, " +++ Fin DOM data for Shapes : ", aMessageDriver);
|
||||
::take_time(0, " +++ Fin DOM data for Shapes : ", aMessageDriver);
|
||||
if (!aPS.More())
|
||||
{
|
||||
SetIsError(Standard_True);
|
||||
@@ -372,100 +368,100 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
|
||||
return IsError();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeDocument
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer XmlLDrivers_DocumentStorageDriver::MakeDocument
|
||||
(const Handle(CDM_Document)& theTDoc,
|
||||
XmlObjMgt_Element& theElement,
|
||||
const Message_ProgressRange& theRange)
|
||||
{
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Integer XmlLDrivers_DocumentStorageDriver::MakeDocument(
|
||||
const Handle(CDM_Document)& theTDoc,
|
||||
XmlObjMgt_Element& theElement,
|
||||
const Message_ProgressRange& theRange)
|
||||
{
|
||||
TCollection_ExtendedString aMessage;
|
||||
Handle(TDocStd_Document) TDOC = Handle(TDocStd_Document)::DownCast(theTDoc);
|
||||
if (!TDOC.IsNull())
|
||||
Handle(TDocStd_Document) TDOC = Handle(TDocStd_Document)::DownCast(theTDoc);
|
||||
if (!TDOC.IsNull())
|
||||
{
|
||||
// myRelocTable.SetDocument (theElement.getOwnerDocument());
|
||||
// myRelocTable.SetDocument (theElement.getOwnerDocument());
|
||||
Handle(TDF_Data) aTDF = TDOC->GetData();
|
||||
|
||||
// Find MessageDriver and pass it to AttributeDrivers()
|
||||
Handle(CDM_Application) anApplication= theTDoc -> Application();
|
||||
// Find MessageDriver and pass it to AttributeDrivers()
|
||||
Handle(CDM_Application) anApplication = theTDoc->Application();
|
||||
Handle(Message_Messenger) aMessageDriver;
|
||||
if (anApplication.IsNull()) {
|
||||
if (anApplication.IsNull())
|
||||
{
|
||||
aMessageDriver = Message::DefaultMessenger();
|
||||
aMessageDriver->ChangePrinters().Clear();
|
||||
}
|
||||
else
|
||||
aMessageDriver = anApplication -> MessageDriver();
|
||||
if (myDrivers.IsNull()) myDrivers = AttributeDrivers (aMessageDriver);
|
||||
aMessageDriver = anApplication->MessageDriver();
|
||||
if (myDrivers.IsNull())
|
||||
myDrivers = AttributeDrivers(aMessageDriver);
|
||||
|
||||
// Retrieve from DOM_Document
|
||||
XmlMDF::FromTo (aTDF, theElement, myRelocTable, myDrivers, theRange);
|
||||
// Retrieve from DOM_Document
|
||||
XmlMDF::FromTo(aTDF, theElement, myRelocTable, myDrivers, theRange);
|
||||
#ifdef OCCT_DEBUGXML
|
||||
aMessage = "First step successful";
|
||||
aMessageDriver -> Send (aMessage.ToExtString(), Message_Warning);
|
||||
aMessageDriver->Send(aMessage.ToExtString(), Message_Warning);
|
||||
#endif
|
||||
return myRelocTable.Extent();
|
||||
}
|
||||
#ifdef OCCT_DEBUG
|
||||
std::cout << "First step failed" << std::endl; // No MessageDriver available
|
||||
std::cout << "First step failed" << std::endl; // No MessageDriver available
|
||||
#endif
|
||||
return -1; // error
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AttributeDrivers
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(XmlMDF_ADriverTable) XmlLDrivers_DocumentStorageDriver::AttributeDrivers
|
||||
(const Handle(Message_Messenger)& theMessageDriver)
|
||||
//=================================================================================================
|
||||
|
||||
Handle(XmlMDF_ADriverTable) XmlLDrivers_DocumentStorageDriver::AttributeDrivers(
|
||||
const Handle(Message_Messenger)& theMessageDriver)
|
||||
{
|
||||
return XmlLDrivers::AttributeDrivers (theMessageDriver);
|
||||
return XmlLDrivers::AttributeDrivers(theMessageDriver);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : take_time
|
||||
//class : static
|
||||
//purpose : output astronomical time elapsed
|
||||
// function : take_time
|
||||
// class : static
|
||||
// purpose : output astronomical time elapsed
|
||||
//=======================================================================
|
||||
#ifdef TAKE_TIMES
|
||||
#include <time.h>
|
||||
#include <sys/timeb.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#ifndef _WIN32
|
||||
extern "C" int ftime (struct timeb *tp);
|
||||
#endif
|
||||
struct timeb tmbuf0;
|
||||
#include <time.h>
|
||||
#include <sys/timeb.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#ifndef _WIN32
|
||||
extern "C" int ftime(struct timeb* tp);
|
||||
#endif
|
||||
struct timeb tmbuf0;
|
||||
|
||||
static void take_time (const Standard_Integer isReset, const char * aHeader,
|
||||
const Handle(Message_Messenger)& aMessageDriver)
|
||||
static void take_time(const Standard_Integer isReset,
|
||||
const char* aHeader,
|
||||
const Handle(Message_Messenger)& aMessageDriver)
|
||||
{
|
||||
struct timeb tmbuf;
|
||||
ftime (&tmbuf);
|
||||
TCollection_ExtendedString aMessage ((Standard_CString)aHeader);
|
||||
if (isReset) tmbuf0 = tmbuf;
|
||||
else {
|
||||
char take_tm_buf [64];
|
||||
Sprintf (take_tm_buf, "%9.2f s ++++",
|
||||
double(tmbuf.time - tmbuf0.time) +
|
||||
double(tmbuf.millitm - tmbuf0.millitm)/1000.);
|
||||
struct timeb tmbuf;
|
||||
ftime(&tmbuf);
|
||||
TCollection_ExtendedString aMessage((Standard_CString)aHeader);
|
||||
if (isReset)
|
||||
tmbuf0 = tmbuf;
|
||||
else
|
||||
{
|
||||
char take_tm_buf[64];
|
||||
Sprintf(take_tm_buf,
|
||||
"%9.2f s ++++",
|
||||
double(tmbuf.time - tmbuf0.time) + double(tmbuf.millitm - tmbuf0.millitm) / 1000.);
|
||||
aMessage += take_tm_buf;
|
||||
}
|
||||
aMessageDriver ->Send (aMessage.ToExtString(), Message_Trace);
|
||||
aMessageDriver->Send(aMessage.ToExtString(), Message_Trace);
|
||||
}
|
||||
#endif
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteShapeSection
|
||||
//purpose : defines WriteShapeSection
|
||||
// function : WriteShapeSection
|
||||
// purpose : defines WriteShapeSection
|
||||
//=======================================================================
|
||||
Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteShapeSection
|
||||
(XmlObjMgt_Element& /*theElement*/,
|
||||
const TDocStd_FormatVersion /*theStorageFormatVersion*/,
|
||||
const Message_ProgressRange& /*theRange*/)
|
||||
Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteShapeSection(
|
||||
XmlObjMgt_Element& /*theElement*/,
|
||||
const TDocStd_FormatVersion /*theStorageFormatVersion*/,
|
||||
const Message_ProgressRange& /*theRange*/)
|
||||
{
|
||||
// empty; should be redefined in subclasses
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
@@ -32,72 +32,56 @@ class CDM_Document;
|
||||
class TCollection_AsciiString;
|
||||
class Message_Messenger;
|
||||
|
||||
|
||||
class XmlLDrivers_DocumentStorageDriver;
|
||||
DEFINE_STANDARD_HANDLE(XmlLDrivers_DocumentStorageDriver, PCDM_StorageDriver)
|
||||
|
||||
|
||||
class XmlLDrivers_DocumentStorageDriver : public PCDM_StorageDriver
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT XmlLDrivers_DocumentStorageDriver(const TCollection_ExtendedString& theCopyright);
|
||||
|
||||
Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument,
|
||||
const TCollection_ExtendedString& theFileName,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument,
|
||||
Standard_OStream& theOStream,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Handle(XmlMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver);
|
||||
Standard_EXPORT virtual void Write(
|
||||
const Handle(CDM_Document)& theDocument,
|
||||
const TCollection_ExtendedString& theFileName,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Write(
|
||||
const Handle(CDM_Document)& theDocument,
|
||||
Standard_OStream& theOStream,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Handle(XmlMDF_ADriverTable) AttributeDrivers(
|
||||
const Handle(Message_Messenger)& theMsgDriver);
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XmlLDrivers_DocumentStorageDriver,PCDM_StorageDriver)
|
||||
DEFINE_STANDARD_RTTIEXT(XmlLDrivers_DocumentStorageDriver, PCDM_StorageDriver)
|
||||
|
||||
protected:
|
||||
Standard_EXPORT virtual Standard_Boolean WriteToDomDocument(
|
||||
const Handle(CDM_Document)& theDocument,
|
||||
XmlObjMgt_Element& thePDoc,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange());
|
||||
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean WriteToDomDocument
|
||||
(const Handle(CDM_Document)& theDocument,
|
||||
XmlObjMgt_Element& thePDoc,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange());
|
||||
|
||||
Standard_EXPORT virtual Standard_Integer MakeDocument
|
||||
(const Handle(CDM_Document)& theDocument,
|
||||
XmlObjMgt_Element& thePDoc,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange());
|
||||
|
||||
Standard_EXPORT void AddNamespace (const TCollection_AsciiString& thePrefix,
|
||||
const TCollection_AsciiString& theURI);
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean WriteShapeSection
|
||||
(XmlObjMgt_Element& thePDoc,
|
||||
const TDocStd_FormatVersion theStorageFormatVersion,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange());
|
||||
Standard_EXPORT virtual Standard_Integer MakeDocument(
|
||||
const Handle(CDM_Document)& theDocument,
|
||||
XmlObjMgt_Element& thePDoc,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange());
|
||||
|
||||
Standard_EXPORT void AddNamespace(const TCollection_AsciiString& thePrefix,
|
||||
const TCollection_AsciiString& theURI);
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean WriteShapeSection(
|
||||
XmlObjMgt_Element& thePDoc,
|
||||
const TDocStd_FormatVersion theStorageFormatVersion,
|
||||
const Message_ProgressRange& theRange = Message_ProgressRange());
|
||||
|
||||
Handle(XmlMDF_ADriverTable) myDrivers;
|
||||
XmlObjMgt_SRelocationTable myRelocTable;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
XmlLDrivers_SequenceOfNamespaceDef mySeqOfNS;
|
||||
TCollection_ExtendedString myCopyright;
|
||||
TCollection_ExtendedString myFileName;
|
||||
|
||||
|
||||
TCollection_ExtendedString myCopyright;
|
||||
TCollection_ExtendedString myFileName;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _XmlLDrivers_DocumentStorageDriver_HeaderFile
|
||||
|
@@ -13,43 +13,33 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <XmlLDrivers_NamespaceDef.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : XmlLDrivers_NamespaceDef
|
||||
//purpose : Empty constructor
|
||||
// function : XmlLDrivers_NamespaceDef
|
||||
// purpose : Empty constructor
|
||||
//=======================================================================
|
||||
XmlLDrivers_NamespaceDef::XmlLDrivers_NamespaceDef ()
|
||||
{}
|
||||
XmlLDrivers_NamespaceDef::XmlLDrivers_NamespaceDef() {}
|
||||
|
||||
//=======================================================================
|
||||
//function : XmlLDrivers_NamespaceDef
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
XmlLDrivers_NamespaceDef::XmlLDrivers_NamespaceDef
|
||||
(const TCollection_AsciiString& thePrefix,
|
||||
const TCollection_AsciiString& theURI)
|
||||
: myPrefix (thePrefix), myURI (theURI)
|
||||
{}
|
||||
XmlLDrivers_NamespaceDef::XmlLDrivers_NamespaceDef(const TCollection_AsciiString& thePrefix,
|
||||
const TCollection_AsciiString& theURI)
|
||||
: myPrefix(thePrefix),
|
||||
myURI(theURI)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Prefix
|
||||
//purpose : Query
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
const TCollection_AsciiString& XmlLDrivers_NamespaceDef::Prefix () const
|
||||
const TCollection_AsciiString& XmlLDrivers_NamespaceDef::Prefix() const
|
||||
{
|
||||
return myPrefix;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : URI
|
||||
//purpose : Query
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
const TCollection_AsciiString& XmlLDrivers_NamespaceDef::URI () const
|
||||
const TCollection_AsciiString& XmlLDrivers_NamespaceDef::URI() const
|
||||
{
|
||||
return myURI;
|
||||
}
|
||||
|
@@ -22,46 +22,24 @@
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
|
||||
|
||||
class XmlLDrivers_NamespaceDef
|
||||
class XmlLDrivers_NamespaceDef
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT XmlLDrivers_NamespaceDef();
|
||||
|
||||
Standard_EXPORT XmlLDrivers_NamespaceDef(const TCollection_AsciiString& thePrefix, const TCollection_AsciiString& theURI);
|
||||
|
||||
|
||||
Standard_EXPORT XmlLDrivers_NamespaceDef(const TCollection_AsciiString& thePrefix,
|
||||
const TCollection_AsciiString& theURI);
|
||||
|
||||
Standard_EXPORT const TCollection_AsciiString& Prefix() const;
|
||||
|
||||
|
||||
Standard_EXPORT const TCollection_AsciiString& URI() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
TCollection_AsciiString myPrefix;
|
||||
TCollection_AsciiString myURI;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _XmlLDrivers_NamespaceDef_HeaderFile
|
||||
|
@@ -21,5 +21,4 @@
|
||||
|
||||
typedef NCollection_Sequence<XmlLDrivers_NamespaceDef> XmlLDrivers_SequenceOfNamespaceDef;
|
||||
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user