mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0030773: Application Framework - To allow to inherit existing attributes to reuse persistence mechanisms
Added possibility to inherit existing attributes if the same persistent fields are used. All methods that allow controlling the data model changes or getting some callbacks may be overridden in successor. They may have same GUIDs as a base class or new ones. Special macros IMPLEMENT_DERIVED_ATTRIBUTE and IMPLEMENT_DERIVED_ATTRIBUTE_WITH_TYPE must be used instead of standard Handle macro definition IMPLEMENT_STANDARD_RTTIEXT to register new derived attributes. Using this improvement several existing attributes from TDataStd, TDataXtd and XCAFDoc packages become inherited from other base attribute-classes. XML and Bin drivers of these attributes are removed. New base attribute classes are added: TDataStd_GenericEmpty and TDataStd_GenericExtString. This improvement does not change both present formats Bin and XML documents. The obsolete Standard scheme is not changed at all.
This commit is contained in:
@@ -8,10 +8,6 @@ XmlMDataStd_BooleanListDriver.cxx
|
||||
XmlMDataStd_BooleanListDriver.hxx
|
||||
XmlMDataStd_ByteArrayDriver.cxx
|
||||
XmlMDataStd_ByteArrayDriver.hxx
|
||||
XmlMDataStd_CommentDriver.cxx
|
||||
XmlMDataStd_CommentDriver.hxx
|
||||
XmlMDataStd_DirectoryDriver.cxx
|
||||
XmlMDataStd_DirectoryDriver.hxx
|
||||
XmlMDataStd_ExpressionDriver.cxx
|
||||
XmlMDataStd_ExpressionDriver.hxx
|
||||
XmlMDataStd_ExtStringArrayDriver.cxx
|
||||
@@ -28,10 +24,8 @@ XmlMDataStd_IntPackedMapDriver.cxx
|
||||
XmlMDataStd_IntPackedMapDriver.hxx
|
||||
XmlMDataStd_NamedDataDriver.cxx
|
||||
XmlMDataStd_NamedDataDriver.hxx
|
||||
XmlMDataStd_NameDriver.cxx
|
||||
XmlMDataStd_NameDriver.hxx
|
||||
XmlMDataStd_NoteBookDriver.cxx
|
||||
XmlMDataStd_NoteBookDriver.hxx
|
||||
XmlMDataStd_GenericExtStringDriver.cxx
|
||||
XmlMDataStd_GenericExtStringDriver.hxx
|
||||
XmlMDataStd_RealArrayDriver.cxx
|
||||
XmlMDataStd_RealArrayDriver.hxx
|
||||
XmlMDataStd_RealDriver.cxx
|
||||
@@ -42,10 +36,8 @@ XmlMDataStd_ReferenceArrayDriver.cxx
|
||||
XmlMDataStd_ReferenceArrayDriver.hxx
|
||||
XmlMDataStd_ReferenceListDriver.cxx
|
||||
XmlMDataStd_ReferenceListDriver.hxx
|
||||
XmlMDataStd_RelationDriver.cxx
|
||||
XmlMDataStd_RelationDriver.hxx
|
||||
XmlMDataStd_TickDriver.cxx
|
||||
XmlMDataStd_TickDriver.hxx
|
||||
XmlMDataStd_GenericEmptyDriver.cxx
|
||||
XmlMDataStd_GenericEmptyDriver.hxx
|
||||
XmlMDataStd_TreeNodeDriver.cxx
|
||||
XmlMDataStd_TreeNodeDriver.hxx
|
||||
XmlMDataStd_UAttributeDriver.cxx
|
||||
|
@@ -21,8 +21,6 @@
|
||||
#include <XmlMDataStd_BooleanArrayDriver.hxx>
|
||||
#include <XmlMDataStd_BooleanListDriver.hxx>
|
||||
#include <XmlMDataStd_ByteArrayDriver.hxx>
|
||||
#include <XmlMDataStd_CommentDriver.hxx>
|
||||
#include <XmlMDataStd_DirectoryDriver.hxx>
|
||||
#include <XmlMDataStd_ExpressionDriver.hxx>
|
||||
#include <XmlMDataStd_ExtStringArrayDriver.hxx>
|
||||
#include <XmlMDataStd_ExtStringListDriver.hxx>
|
||||
@@ -31,15 +29,13 @@
|
||||
#include <XmlMDataStd_IntegerListDriver.hxx>
|
||||
#include <XmlMDataStd_IntPackedMapDriver.hxx>
|
||||
#include <XmlMDataStd_NamedDataDriver.hxx>
|
||||
#include <XmlMDataStd_NameDriver.hxx>
|
||||
#include <XmlMDataStd_NoteBookDriver.hxx>
|
||||
#include <XmlMDataStd_GenericExtStringDriver.hxx>
|
||||
#include <XmlMDataStd_RealArrayDriver.hxx>
|
||||
#include <XmlMDataStd_RealDriver.hxx>
|
||||
#include <XmlMDataStd_RealListDriver.hxx>
|
||||
#include <XmlMDataStd_ReferenceArrayDriver.hxx>
|
||||
#include <XmlMDataStd_ReferenceListDriver.hxx>
|
||||
#include <XmlMDataStd_RelationDriver.hxx>
|
||||
#include <XmlMDataStd_TickDriver.hxx>
|
||||
#include <XmlMDataStd_GenericEmptyDriver.hxx>
|
||||
#include <XmlMDataStd_TreeNodeDriver.hxx>
|
||||
#include <XmlMDataStd_UAttributeDriver.hxx>
|
||||
#include <XmlMDataStd_VariableDriver.hxx>
|
||||
@@ -52,31 +48,26 @@
|
||||
void XmlMDataStd::AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable,
|
||||
const Handle(Message_Messenger)& anMsgDrv)
|
||||
{
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_DirectoryDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_IntegerArrayDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_RealArrayDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_UAttributeDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_NameDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_CommentDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_IntegerDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_RealDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_VariableDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_ExpressionDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_RelationDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_NoteBookDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_TreeNodeDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_ExtStringArrayDriver(anMsgDrv));
|
||||
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_TickDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_IntegerListDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_RealListDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_ExtStringListDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_BooleanListDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_ReferenceListDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_BooleanArrayDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_ReferenceArrayDriver(anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_ByteArrayDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_NamedDataDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_AsciiStringDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_IntPackedMapDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_IntegerArrayDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_RealArrayDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_UAttributeDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_GenericExtStringDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_IntegerDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_RealDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_VariableDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_ExpressionDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_TreeNodeDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_ExtStringArrayDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_GenericEmptyDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_IntegerListDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_RealListDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_ExtStringListDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_BooleanListDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_ReferenceListDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_BooleanArrayDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_ReferenceArrayDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_ByteArrayDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_NamedDataDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_AsciiStringDriver (anMsgDrv));
|
||||
aDriverTable-> AddDriver (new XmlMDataStd_IntPackedMapDriver (anMsgDrv));
|
||||
}
|
||||
|
@@ -21,21 +21,18 @@
|
||||
#include <Standard_Integer.hxx>
|
||||
class XmlMDF_ADriverTable;
|
||||
class Message_Messenger;
|
||||
class XmlMDataStd_NameDriver;
|
||||
class XmlMDataStd_GenericExtStringDriver;
|
||||
class XmlMDataStd_IntegerDriver;
|
||||
class XmlMDataStd_RealDriver;
|
||||
class XmlMDataStd_IntegerArrayDriver;
|
||||
class XmlMDataStd_RealArrayDriver;
|
||||
class XmlMDataStd_ExtStringArrayDriver;
|
||||
class XmlMDataStd_UAttributeDriver;
|
||||
class XmlMDataStd_DirectoryDriver;
|
||||
class XmlMDataStd_CommentDriver;
|
||||
class XmlMDataStd_VariableDriver;
|
||||
class XmlMDataStd_ExpressionDriver;
|
||||
class XmlMDataStd_RelationDriver;
|
||||
class XmlMDataStd_NoteBookDriver;
|
||||
class XmlMDataStd_TreeNodeDriver;
|
||||
class XmlMDataStd_TickDriver;
|
||||
class XmlMDataStd_GenericEmptyDriver;
|
||||
class XmlMDataStd_IntegerListDriver;
|
||||
class XmlMDataStd_RealListDriver;
|
||||
class XmlMDataStd_ExtStringListDriver;
|
||||
@@ -73,21 +70,18 @@ private:
|
||||
|
||||
|
||||
|
||||
friend class XmlMDataStd_NameDriver;
|
||||
friend class XmlMDataStd_GenericExtStringDriver;
|
||||
friend class XmlMDataStd_IntegerDriver;
|
||||
friend class XmlMDataStd_RealDriver;
|
||||
friend class XmlMDataStd_IntegerArrayDriver;
|
||||
friend class XmlMDataStd_RealArrayDriver;
|
||||
friend class XmlMDataStd_ExtStringArrayDriver;
|
||||
friend class XmlMDataStd_UAttributeDriver;
|
||||
friend class XmlMDataStd_DirectoryDriver;
|
||||
friend class XmlMDataStd_CommentDriver;
|
||||
friend class XmlMDataStd_VariableDriver;
|
||||
friend class XmlMDataStd_ExpressionDriver;
|
||||
friend class XmlMDataStd_RelationDriver;
|
||||
friend class XmlMDataStd_NoteBookDriver;
|
||||
friend class XmlMDataStd_TreeNodeDriver;
|
||||
friend class XmlMDataStd_TickDriver;
|
||||
friend class XmlMDataStd_GenericEmptyDriver;
|
||||
friend class XmlMDataStd_IntegerListDriver;
|
||||
friend class XmlMDataStd_RealListDriver;
|
||||
friend class XmlMDataStd_ExtStringListDriver;
|
||||
|
@@ -1,74 +0,0 @@
|
||||
// Created on: 2001-08-24
|
||||
// Created by: Alexnder GRIGORIEV
|
||||
// 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 <Message_Messenger.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDataStd_Comment.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XmlMDataStd_CommentDriver.hxx>
|
||||
#include <XmlObjMgt.hxx>
|
||||
#include <XmlObjMgt_Persistent.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_CommentDriver,XmlMDF_ADriver)
|
||||
|
||||
//=======================================================================
|
||||
//function : XmlMDataStd_CommentDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
XmlMDataStd_CommentDriver::XmlMDataStd_CommentDriver
|
||||
(const Handle(Message_Messenger)& theMsgDriver)
|
||||
: XmlMDF_ADriver (theMsgDriver, NULL)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) XmlMDataStd_CommentDriver::NewEmpty() const
|
||||
{
|
||||
return (new TDataStd_Comment());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean XmlMDataStd_CommentDriver::Paste
|
||||
(const XmlObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
XmlObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
TCollection_ExtendedString aString;
|
||||
if (XmlObjMgt::GetExtendedString (theSource, aString))
|
||||
{
|
||||
Handle(TDataStd_Comment)::DownCast(theTarget) -> Set (aString);
|
||||
return Standard_True;
|
||||
}
|
||||
myMessageDriver->Send("error retrieving ExtendedString for type TDataStd_Comment", Message_Fail);
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void XmlMDataStd_CommentDriver::Paste (const Handle(TDF_Attribute)& theSource,
|
||||
XmlObjMgt_Persistent& theTarget,
|
||||
XmlObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_Comment) aName= Handle(TDataStd_Comment)::DownCast(theSource);
|
||||
XmlObjMgt::SetExtendedString (theTarget, aName -> Get());
|
||||
}
|
@@ -1,72 +0,0 @@
|
||||
// Created on: 2001-08-24
|
||||
// Created by: Alexander GRIGORIEV
|
||||
// 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.
|
||||
|
||||
#ifndef _XmlMDataStd_CommentDriver_HeaderFile
|
||||
#define _XmlMDataStd_CommentDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <XmlMDF_ADriver.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <XmlObjMgt_RRelocationTable.hxx>
|
||||
#include <XmlObjMgt_SRelocationTable.hxx>
|
||||
class Message_Messenger;
|
||||
class TDF_Attribute;
|
||||
class XmlObjMgt_Persistent;
|
||||
|
||||
|
||||
class XmlMDataStd_CommentDriver;
|
||||
DEFINE_STANDARD_HANDLE(XmlMDataStd_CommentDriver, XmlMDF_ADriver)
|
||||
|
||||
//! Attribute Driver.
|
||||
class XmlMDataStd_CommentDriver : public XmlMDF_ADriver
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT XmlMDataStd_CommentDriver(const Handle(Message_Messenger)& theMessageDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste (const XmlObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, XmlObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Source, XmlObjMgt_Persistent& Target, XmlObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XmlMDataStd_CommentDriver,XmlMDF_ADriver)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _XmlMDataStd_CommentDriver_HeaderFile
|
@@ -1,67 +0,0 @@
|
||||
// Created on: 2001-08-24
|
||||
// Created by: Alexnder GRIGORIEV
|
||||
// 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 <Message_Messenger.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDataStd_Directory.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XmlMDataStd_DirectoryDriver.hxx>
|
||||
#include <XmlObjMgt_Persistent.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_DirectoryDriver,XmlMDF_ADriver)
|
||||
|
||||
//=======================================================================
|
||||
//function : XmlMDataStd_DirectoryDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
XmlMDataStd_DirectoryDriver::XmlMDataStd_DirectoryDriver
|
||||
(const Handle(Message_Messenger)& theMsgDriver)
|
||||
: XmlMDF_ADriver (theMsgDriver, NULL)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) XmlMDataStd_DirectoryDriver::NewEmpty() const
|
||||
{
|
||||
return (new TDataStd_Directory());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean XmlMDataStd_DirectoryDriver::Paste
|
||||
(const XmlObjMgt_Persistent&,
|
||||
const Handle(TDF_Attribute)&,
|
||||
XmlObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void XmlMDataStd_DirectoryDriver::Paste (const Handle(TDF_Attribute)&,
|
||||
XmlObjMgt_Persistent&,
|
||||
XmlObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
}
|
@@ -1,72 +0,0 @@
|
||||
// Created on: 2001-08-24
|
||||
// Created by: Alexander GRIGORIEV
|
||||
// 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.
|
||||
|
||||
#ifndef _XmlMDataStd_DirectoryDriver_HeaderFile
|
||||
#define _XmlMDataStd_DirectoryDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <XmlMDF_ADriver.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <XmlObjMgt_RRelocationTable.hxx>
|
||||
#include <XmlObjMgt_SRelocationTable.hxx>
|
||||
class Message_Messenger;
|
||||
class TDF_Attribute;
|
||||
class XmlObjMgt_Persistent;
|
||||
|
||||
|
||||
class XmlMDataStd_DirectoryDriver;
|
||||
DEFINE_STANDARD_HANDLE(XmlMDataStd_DirectoryDriver, XmlMDF_ADriver)
|
||||
|
||||
//! Attribute Driver.
|
||||
class XmlMDataStd_DirectoryDriver : public XmlMDF_ADriver
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT XmlMDataStd_DirectoryDriver(const Handle(Message_Messenger)& theMessageDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste (const XmlObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, XmlObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Source, XmlObjMgt_Persistent& Target, XmlObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XmlMDataStd_DirectoryDriver,XmlMDF_ADriver)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _XmlMDataStd_DirectoryDriver_HeaderFile
|
@@ -1,6 +1,4 @@
|
||||
// Created on: 2007-05-29
|
||||
// Created by: Vlad Romashko
|
||||
// Copyright (c) 2007-2014 OPEN CASCADE SAS
|
||||
// Copyright (c) 2020 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
@@ -16,18 +14,18 @@
|
||||
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDataStd_Tick.hxx>
|
||||
#include <TDataStd_GenericEmpty.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XmlMDataStd_TickDriver.hxx>
|
||||
#include <XmlMDataStd_GenericEmptyDriver.hxx>
|
||||
#include <XmlObjMgt_Persistent.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_TickDriver,XmlMDF_ADriver)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_GenericEmptyDriver,XmlMDF_ADriver)
|
||||
|
||||
//=======================================================================
|
||||
//function : XmlMDataStd_TickDriver
|
||||
//function : XmlMDataStd_GenericEmptyDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
XmlMDataStd_TickDriver::XmlMDataStd_TickDriver(const Handle(Message_Messenger)& theMsgDriver)
|
||||
XmlMDataStd_GenericEmptyDriver::XmlMDataStd_GenericEmptyDriver(const Handle(Message_Messenger)& theMsgDriver)
|
||||
: XmlMDF_ADriver (theMsgDriver, NULL)
|
||||
{
|
||||
|
||||
@@ -37,16 +35,25 @@ XmlMDataStd_TickDriver::XmlMDataStd_TickDriver(const Handle(Message_Messenger)&
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) XmlMDataStd_TickDriver::NewEmpty() const
|
||||
Handle(TDF_Attribute) XmlMDataStd_GenericEmptyDriver::NewEmpty() const
|
||||
{
|
||||
return (new TDataStd_Tick());
|
||||
return Handle(TDF_Attribute)(); // this attribute can not be created
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SourceType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Standard_Type) XmlMDataStd_GenericEmptyDriver::SourceType() const
|
||||
{
|
||||
return Standard_Type::Instance<TDataStd_GenericEmpty>();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean XmlMDataStd_TickDriver::Paste(const XmlObjMgt_Persistent&,
|
||||
Standard_Boolean XmlMDataStd_GenericEmptyDriver::Paste(const XmlObjMgt_Persistent&,
|
||||
const Handle(TDF_Attribute)&,
|
||||
XmlObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
@@ -57,7 +64,7 @@ Standard_Boolean XmlMDataStd_TickDriver::Paste(const XmlObjMgt_Persistent&,
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void XmlMDataStd_TickDriver::Paste(const Handle(TDF_Attribute)&,
|
||||
void XmlMDataStd_GenericEmptyDriver::Paste(const Handle(TDF_Attribute)&,
|
||||
XmlObjMgt_Persistent&,
|
||||
XmlObjMgt_SRelocationTable& ) const
|
||||
{
|
@@ -1,6 +1,4 @@
|
||||
// Created on: 2007-05-29
|
||||
// Created by: Vlad Romashko
|
||||
// Copyright (c) 2007-2014 OPEN CASCADE SAS
|
||||
// Copyright (c) 2020 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
@@ -13,8 +11,8 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _XmlMDataStd_TickDriver_HeaderFile
|
||||
#define _XmlMDataStd_TickDriver_HeaderFile
|
||||
#ifndef _XmlMDataStd_GenericEmptyDriver_HeaderFile
|
||||
#define _XmlMDataStd_GenericEmptyDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
@@ -28,19 +26,21 @@ class TDF_Attribute;
|
||||
class XmlObjMgt_Persistent;
|
||||
|
||||
|
||||
class XmlMDataStd_TickDriver;
|
||||
DEFINE_STANDARD_HANDLE(XmlMDataStd_TickDriver, XmlMDF_ADriver)
|
||||
class XmlMDataStd_GenericEmptyDriver;
|
||||
DEFINE_STANDARD_HANDLE(XmlMDataStd_GenericEmptyDriver, XmlMDF_ADriver)
|
||||
|
||||
|
||||
class XmlMDataStd_TickDriver : public XmlMDF_ADriver
|
||||
class XmlMDataStd_GenericEmptyDriver : public XmlMDF_ADriver
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT XmlMDataStd_TickDriver(const Handle(Message_Messenger)& theMessageDriver);
|
||||
Standard_EXPORT XmlMDataStd_GenericEmptyDriver(const Handle(Message_Messenger)& theMessageDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Handle(Standard_Type) SourceType() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste (const XmlObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, XmlObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XmlMDataStd_TickDriver,XmlMDF_ADriver)
|
||||
DEFINE_STANDARD_RTTIEXT(XmlMDataStd_GenericEmptyDriver,XmlMDF_ADriver)
|
||||
|
||||
protected:
|
||||
|
||||
@@ -69,4 +69,4 @@ private:
|
||||
|
||||
|
||||
|
||||
#endif // _XmlMDataStd_TickDriver_HeaderFile
|
||||
#endif // _XmlMDataStd_GenericEmptyDriver_HeaderFile
|
@@ -1,6 +1,4 @@
|
||||
// Created on: 2001-08-01
|
||||
// Created by: Alexander GRIGORIEV
|
||||
// Copyright (c) 2001-2014 OPEN CASCADE SAS
|
||||
// Copyright (c) 2020 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
@@ -16,21 +14,21 @@
|
||||
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDataStd_Name.hxx>
|
||||
#include <TDataStd_GenericExtString.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XmlMDataStd_NameDriver.hxx>
|
||||
#include <XmlMDataStd_GenericExtStringDriver.hxx>
|
||||
#include <XmlObjMgt.hxx>
|
||||
#include <XmlObjMgt_Persistent.hxx>
|
||||
#include <XmlObjMgt_RRelocationTable.hxx>
|
||||
#include <XmlObjMgt_SRelocationTable.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_NameDriver,XmlMDF_ADriver)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_GenericExtStringDriver,XmlMDF_ADriver)
|
||||
IMPLEMENT_DOMSTRING (AttributeIDString, "nameguid")
|
||||
//=======================================================================
|
||||
//function : XmlMDataStd_NameDriver
|
||||
//function : XmlMDataStd_GenericExtStringDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
XmlMDataStd_NameDriver::XmlMDataStd_NameDriver
|
||||
XmlMDataStd_GenericExtStringDriver::XmlMDataStd_GenericExtStringDriver
|
||||
(const Handle(Message_Messenger)& theMsgDriver)
|
||||
: XmlMDF_ADriver (theMsgDriver, NULL)
|
||||
{}
|
||||
@@ -39,16 +37,25 @@ XmlMDataStd_NameDriver::XmlMDataStd_NameDriver
|
||||
//function : NewEmpty()
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) XmlMDataStd_NameDriver::NewEmpty () const
|
||||
Handle(TDF_Attribute) XmlMDataStd_GenericExtStringDriver::NewEmpty () const
|
||||
{
|
||||
return (new TDataStd_Name());
|
||||
return Handle(TDF_Attribute)(); // this attribute can not be created
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SourceType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Standard_Type) XmlMDataStd_GenericExtStringDriver::SourceType() const
|
||||
{
|
||||
return Standard_Type::Instance<TDataStd_GenericExtString>();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste()
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean XmlMDataStd_NameDriver::Paste
|
||||
Standard_Boolean XmlMDataStd_GenericExtStringDriver::Paste
|
||||
(const XmlObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
XmlObjMgt_RRelocationTable& ) const
|
||||
@@ -57,21 +64,17 @@ Standard_Boolean XmlMDataStd_NameDriver::Paste
|
||||
TCollection_ExtendedString aString;
|
||||
if (XmlObjMgt::GetExtendedString (theSource, aString))
|
||||
{
|
||||
Handle(TDataStd_Name)::DownCast(theTarget) -> Set (aString);
|
||||
// attribute id
|
||||
Standard_GUID aGUID;
|
||||
Handle(TDataStd_GenericExtString)::DownCast(theTarget)->Set (aString);
|
||||
const XmlObjMgt_Element& anElement = theSource;
|
||||
XmlObjMgt_DOMString aGUIDStr = anElement.getAttribute(::AttributeIDString());
|
||||
if (aGUIDStr.Type() == XmlObjMgt_DOMString::LDOM_NULL)
|
||||
aGUID = TDataStd_Name::GetID(); //default case
|
||||
else
|
||||
aGUID = Standard_GUID(Standard_CString(aGUIDStr.GetString())); // user defined case
|
||||
|
||||
Handle(TDataStd_Name)::DownCast(theTarget)->SetID(aGUID);
|
||||
if (aGUIDStr.Type() != XmlObjMgt_DOMString::LDOM_NULL) { // user defined GUID case
|
||||
Standard_GUID aGUID = Standard_GUID(Standard_CString(aGUIDStr.GetString()));
|
||||
Handle(TDataStd_GenericExtString)::DownCast(theTarget)->SetID(aGUID);
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
myMessageDriver->Send("error retrieving ExtendedString for type TDataStd_Name", Message_Fail);
|
||||
myMessageDriver->Send("error retrieving ExtendedString for type TDataStd_GenericExtString", Message_Fail);
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
@@ -79,18 +82,16 @@ Standard_Boolean XmlMDataStd_NameDriver::Paste
|
||||
//function : Paste()
|
||||
//purpose : store
|
||||
//=======================================================================
|
||||
void XmlMDataStd_NameDriver::Paste (const Handle(TDF_Attribute)& theSource,
|
||||
void XmlMDataStd_GenericExtStringDriver::Paste (const Handle(TDF_Attribute)& theSource,
|
||||
XmlObjMgt_Persistent& theTarget,
|
||||
XmlObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_Name) aName = Handle(TDataStd_Name)::DownCast(theSource);
|
||||
if (aName.IsNull()) return;
|
||||
XmlObjMgt::SetExtendedString (theTarget, aName -> Get());
|
||||
if(aName->ID() != TDataStd_Name::GetID()) {
|
||||
//convert GUID
|
||||
Standard_Character aGuidStr [Standard_GUID_SIZE_ALLOC];
|
||||
Standard_PCharacter pGuidStr = aGuidStr;
|
||||
aName->ID().ToCString (pGuidStr);
|
||||
theTarget.Element().setAttribute (::AttributeIDString(), aGuidStr);
|
||||
}
|
||||
Handle(TDataStd_GenericExtString) aStr = Handle(TDataStd_GenericExtString)::DownCast(theSource);
|
||||
if (aStr.IsNull()) return;
|
||||
XmlObjMgt::SetExtendedString (theTarget, aStr->Get());
|
||||
//convert GUID
|
||||
Standard_Character aGuidStr [Standard_GUID_SIZE_ALLOC];
|
||||
Standard_PCharacter pGuidStr = aGuidStr;
|
||||
aStr->ID().ToCString (pGuidStr);
|
||||
theTarget.Element().setAttribute (::AttributeIDString(), aGuidStr);
|
||||
}
|
@@ -1,6 +1,4 @@
|
||||
// Created on: 2001-07-09
|
||||
// Created by: Julia DOROVSKIKH
|
||||
// Copyright (c) 2001-2014 OPEN CASCADE SAS
|
||||
// Copyright (c) 2020 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
@@ -13,8 +11,8 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _XmlMDataStd_NameDriver_HeaderFile
|
||||
#define _XmlMDataStd_NameDriver_HeaderFile
|
||||
#ifndef _XmlMDataStd_GenericExtStringDriver_HeaderFile
|
||||
#define _XmlMDataStd_GenericExtStringDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
@@ -29,19 +27,21 @@ class XmlObjMgt_Persistent;
|
||||
|
||||
|
||||
class XmlMDataStd_NameDriver;
|
||||
DEFINE_STANDARD_HANDLE(XmlMDataStd_NameDriver, XmlMDF_ADriver)
|
||||
DEFINE_STANDARD_HANDLE(XmlMDataStd_GenericExtStringDriver, XmlMDF_ADriver)
|
||||
|
||||
//! Attribute Driver.
|
||||
class XmlMDataStd_NameDriver : public XmlMDF_ADriver
|
||||
class XmlMDataStd_GenericExtStringDriver : public XmlMDF_ADriver
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT XmlMDataStd_NameDriver(const Handle(Message_Messenger)& theMessageDriver);
|
||||
|
||||
|
||||
Standard_EXPORT XmlMDataStd_GenericExtStringDriver(const Handle(Message_Messenger)& theMessageDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
|
||||
Standard_EXPORT virtual Handle(Standard_Type) SourceType() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste (const XmlObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, XmlObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Source, XmlObjMgt_Persistent& Target, XmlObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE;
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XmlMDataStd_NameDriver,XmlMDF_ADriver)
|
||||
DEFINE_STANDARD_RTTIEXT(XmlMDataStd_GenericExtStringDriver,XmlMDF_ADriver)
|
||||
|
||||
protected:
|
||||
|
||||
@@ -69,4 +69,4 @@ private:
|
||||
|
||||
|
||||
|
||||
#endif // _XmlMDataStd_NameDriver_HeaderFile
|
||||
#endif // _XmlMDataStd_GenericExtStringDriver_HeaderFile
|
@@ -66,15 +66,13 @@ Standard_Boolean XmlMDataStd_IntegerDriver::Paste
|
||||
anInt->Set(aValue);
|
||||
|
||||
// attribute id
|
||||
Standard_GUID aGUID;
|
||||
const XmlObjMgt_Element& anElement = theSource;
|
||||
XmlObjMgt_DOMString aGUIDStr = anElement.getAttribute(::AttributeIDString());
|
||||
if (aGUIDStr.Type() == XmlObjMgt_DOMString::LDOM_NULL)
|
||||
aGUID = TDataStd_Integer::GetID(); //default case
|
||||
else
|
||||
aGUID = Standard_GUID(Standard_CString(aGUIDStr.GetString())); // user defined case
|
||||
|
||||
Handle(TDataStd_Integer)::DownCast(theTarget)->SetID(aGUID);
|
||||
if (aGUIDStr.Type() != XmlObjMgt_DOMString::LDOM_NULL)
|
||||
{
|
||||
const Standard_GUID aGUID (aGUIDStr.GetString()); // user defined case
|
||||
Handle(TDataStd_Integer)::DownCast(theTarget)->SetID(aGUID);
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -1,67 +0,0 @@
|
||||
// Created on: 2001-08-24
|
||||
// Created by: Alexnder GRIGORIEV
|
||||
// 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 <Message_Messenger.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDataStd_NoteBook.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XmlMDataStd_NoteBookDriver.hxx>
|
||||
#include <XmlObjMgt_Persistent.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_NoteBookDriver,XmlMDF_ADriver)
|
||||
|
||||
//=======================================================================
|
||||
//function : XmlMDataStd_NoteBookDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
XmlMDataStd_NoteBookDriver::XmlMDataStd_NoteBookDriver
|
||||
(const Handle(Message_Messenger)& theMsgDriver)
|
||||
: XmlMDF_ADriver (theMsgDriver, NULL)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) XmlMDataStd_NoteBookDriver::NewEmpty() const
|
||||
{
|
||||
return (new TDataStd_NoteBook());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean XmlMDataStd_NoteBookDriver::Paste
|
||||
(const XmlObjMgt_Persistent&,
|
||||
const Handle(TDF_Attribute)&,
|
||||
XmlObjMgt_RRelocationTable& ) const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void XmlMDataStd_NoteBookDriver::Paste (const Handle(TDF_Attribute)&,
|
||||
XmlObjMgt_Persistent&,
|
||||
XmlObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
}
|
@@ -1,72 +0,0 @@
|
||||
// Created on: 2001-08-24
|
||||
// Created by: Alexander GRIGORIEV
|
||||
// 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.
|
||||
|
||||
#ifndef _XmlMDataStd_NoteBookDriver_HeaderFile
|
||||
#define _XmlMDataStd_NoteBookDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <XmlMDF_ADriver.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <XmlObjMgt_RRelocationTable.hxx>
|
||||
#include <XmlObjMgt_SRelocationTable.hxx>
|
||||
class Message_Messenger;
|
||||
class TDF_Attribute;
|
||||
class XmlObjMgt_Persistent;
|
||||
|
||||
|
||||
class XmlMDataStd_NoteBookDriver;
|
||||
DEFINE_STANDARD_HANDLE(XmlMDataStd_NoteBookDriver, XmlMDF_ADriver)
|
||||
|
||||
//! Attribute Driver.
|
||||
class XmlMDataStd_NoteBookDriver : public XmlMDF_ADriver
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT XmlMDataStd_NoteBookDriver(const Handle(Message_Messenger)& theMessageDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste (const XmlObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, XmlObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Source, XmlObjMgt_Persistent& Target, XmlObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XmlMDataStd_NoteBookDriver,XmlMDF_ADriver)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _XmlMDataStd_NoteBookDriver_HeaderFile
|
@@ -1,153 +0,0 @@
|
||||
// Created on: 2001-09-12
|
||||
// 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 <Message_Messenger.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDataStd_Relation.hxx>
|
||||
#include <TDataStd_Variable.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TDF_ListIteratorOfAttributeList.hxx>
|
||||
#include <XmlMDataStd_RelationDriver.hxx>
|
||||
#include <XmlObjMgt.hxx>
|
||||
#include <XmlObjMgt_Persistent.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_RelationDriver,XmlMDF_ADriver)
|
||||
IMPLEMENT_DOMSTRING (VariablesString, "variables")
|
||||
|
||||
//=======================================================================
|
||||
//function : XmlMDataStd_RelationDriver
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
XmlMDataStd_RelationDriver::XmlMDataStd_RelationDriver
|
||||
(const Handle(Message_Messenger)& theMsgDriver)
|
||||
: XmlMDF_ADriver (theMsgDriver, NULL)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) XmlMDataStd_RelationDriver::NewEmpty() const
|
||||
{
|
||||
return (new TDataStd_Relation());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : persistent -> transient (retrieve)
|
||||
//=======================================================================
|
||||
Standard_Boolean XmlMDataStd_RelationDriver::Paste
|
||||
(const XmlObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
XmlObjMgt_RRelocationTable& theRelocTable) const
|
||||
{
|
||||
Handle(TDataStd_Relation) aC =
|
||||
Handle(TDataStd_Relation)::DownCast(theTarget);
|
||||
const XmlObjMgt_Element& anElem = theSource;
|
||||
|
||||
Standard_Integer aNb;
|
||||
TCollection_ExtendedString aMsgString;
|
||||
|
||||
// expression
|
||||
TCollection_ExtendedString aString;
|
||||
if (!XmlObjMgt::GetExtendedString (theSource, aString))
|
||||
{
|
||||
myMessageDriver->Send("error retrieving ExtendedString for type TDataStd_Relation", Message_Fail);
|
||||
return Standard_False;
|
||||
}
|
||||
aC->SetRelation(aString);
|
||||
|
||||
// variables
|
||||
XmlObjMgt_DOMString aDOMStr = anElem.getAttribute(::VariablesString());
|
||||
if (aDOMStr != NULL)
|
||||
{
|
||||
Standard_CString aVs = Standard_CString(aDOMStr.GetString());
|
||||
|
||||
// first variable
|
||||
if (!XmlObjMgt::GetInteger(aVs, aNb))
|
||||
{
|
||||
aMsgString = TCollection_ExtendedString
|
||||
("XmlMDataStd_RelationDriver: Cannot retrieve reference on first variable from \"")
|
||||
+ aDOMStr + "\"";
|
||||
myMessageDriver->Send (aMsgString, Message_Fail);
|
||||
return Standard_False;
|
||||
}
|
||||
Standard_Integer i = 1;
|
||||
while (aNb > 0)
|
||||
{
|
||||
Handle(TDF_Attribute) aV;
|
||||
if (theRelocTable.IsBound(aNb))
|
||||
aV = Handle(TDataStd_Variable)::DownCast(theRelocTable.Find(aNb));
|
||||
else
|
||||
{
|
||||
aV = new TDataStd_Variable;
|
||||
theRelocTable.Bind(aNb, aV);
|
||||
}
|
||||
aC->GetVariables().Append(aV);
|
||||
|
||||
// next variable
|
||||
if (!XmlObjMgt::GetInteger(aVs, aNb)) aNb = 0;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : transient -> persistent (store)
|
||||
//=======================================================================
|
||||
void XmlMDataStd_RelationDriver::Paste
|
||||
(const Handle(TDF_Attribute)& theSource,
|
||||
XmlObjMgt_Persistent& theTarget,
|
||||
XmlObjMgt_SRelocationTable& theRelocTable) const
|
||||
{
|
||||
Handle(TDataStd_Relation) aC =
|
||||
Handle(TDataStd_Relation)::DownCast(theSource);
|
||||
XmlObjMgt_Element& anElem = theTarget;
|
||||
|
||||
Standard_Integer aNb;
|
||||
Handle(TDF_Attribute) TV;
|
||||
|
||||
// expression
|
||||
XmlObjMgt::SetExtendedString (theTarget, aC->Name());
|
||||
|
||||
// variables
|
||||
Standard_Integer nbvar = aC->GetVariables().Extent();
|
||||
if (nbvar >= 1)
|
||||
{
|
||||
TCollection_AsciiString aGsStr;
|
||||
TDF_ListIteratorOfAttributeList it;
|
||||
Standard_Integer index = 0;
|
||||
for (it.Initialize(aC->GetVariables()); it.More(); it.Next())
|
||||
{
|
||||
index++;
|
||||
TV = it.Value();
|
||||
if (!TV.IsNull())
|
||||
{
|
||||
aNb = theRelocTable.FindIndex(TV);
|
||||
if (aNb == 0)
|
||||
{
|
||||
aNb = theRelocTable.Add(TV);
|
||||
}
|
||||
aGsStr += TCollection_AsciiString(aNb) + " ";
|
||||
}
|
||||
else aGsStr += "0 ";
|
||||
}
|
||||
anElem.setAttribute(::VariablesString(), aGsStr.ToCString());
|
||||
}
|
||||
}
|
@@ -1,72 +0,0 @@
|
||||
// Created on: 2001-09-12
|
||||
// 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.
|
||||
|
||||
#ifndef _XmlMDataStd_RelationDriver_HeaderFile
|
||||
#define _XmlMDataStd_RelationDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <XmlMDF_ADriver.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <XmlObjMgt_RRelocationTable.hxx>
|
||||
#include <XmlObjMgt_SRelocationTable.hxx>
|
||||
class Message_Messenger;
|
||||
class TDF_Attribute;
|
||||
class XmlObjMgt_Persistent;
|
||||
|
||||
|
||||
class XmlMDataStd_RelationDriver;
|
||||
DEFINE_STANDARD_HANDLE(XmlMDataStd_RelationDriver, XmlMDF_ADriver)
|
||||
|
||||
//! Attribute Driver.
|
||||
class XmlMDataStd_RelationDriver : public XmlMDF_ADriver
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT XmlMDataStd_RelationDriver(const Handle(Message_Messenger)& theMessageDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste (const XmlObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, XmlObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Source, XmlObjMgt_Persistent& Target, XmlObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(XmlMDataStd_RelationDriver,XmlMDF_ADriver)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _XmlMDataStd_RelationDriver_HeaderFile
|
Reference in New Issue
Block a user