(#573) Added new copy method for PdmObjects

Added copy method to XmlObjectHandle, and use this method from
PasteEclipseCases
This commit is contained in:
Magne Sjaastad
2015-10-23 09:00:17 +02:00
parent 36a0a4a948
commit 5b99439ed8
3 changed files with 30 additions and 13 deletions

View File

@@ -170,6 +170,21 @@ PdmObjectHandle* PdmXmlObjectHandle::readUnknownObjectFromXmlString(const QStrin
return newObject;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
PdmObjectHandle* PdmXmlObjectHandle::copyByXmlSerialization(PdmObjectFactory* objectFactory)
{
this->setupBeforeSaveRecursively();
QString xmlString = this->writeObjectToXmlString();
PdmObjectHandle* objectCopy = PdmXmlObjectHandle::readUnknownObjectFromXmlString(xmlString, objectFactory);
objectCopy->xmlCapability()->initAfterReadRecursively();
return objectCopy;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -36,6 +36,7 @@ public:
void readObjectFromXmlString(const QString& xmlString, PdmObjectFactory* objectFactory);
QString writeObjectToXmlString();
static PdmObjectHandle* readUnknownObjectFromXmlString(const QString& xmlString, PdmObjectFactory* objectFactory);
PdmObjectHandle* copyByXmlSerialization(PdmObjectFactory* objectFactory);
// Main XML serialization methods that is used internally by the document serialization system
// Not supposed to be used directly.