mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-18 14:27:39 +03:00
0025394: Make it possible to store/retrieve the list-based attributes containing no items
Attention! It is not a complete patch. First patch for Binary schema. Fix for Xml schema. Patch for the standard schema. Added new Draw commands to test ExtStringList & ReferenceList attributes. Fix of a small bug in ReferenceListDriver & improvement of Draw Get commands. Replace tabs with spaces in newly added lines. Test cases for issue CR25394
This commit is contained in:
@@ -78,13 +78,13 @@ Standard_Boolean XmlMDataStd_RealListDriver::Paste(const XmlObjMgt_Persistent&
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealList) aRealList = Handle(TDataStd_RealList)::DownCast(theTarget);
|
||||
|
||||
const Handle(TDataStd_RealList) aRealList = Handle(TDataStd_RealList)::DownCast(theTarget);
|
||||
// Check the type of LDOMString
|
||||
const XmlObjMgt_DOMString& aString = XmlObjMgt::GetStringValue(anElement);
|
||||
if(aLastInd == 0) aFirstInd = 0;
|
||||
if (aString.Type() == LDOMBasicString::LDOM_Integer)
|
||||
{
|
||||
if (aFirstInd == aLastInd)
|
||||
if (aFirstInd == aLastInd && aLastInd > 0)
|
||||
{
|
||||
Standard_Integer anIntValue;
|
||||
if (aString.GetInteger(anIntValue))
|
||||
@@ -100,7 +100,7 @@ Standard_Boolean XmlMDataStd_RealListDriver::Paste(const XmlObjMgt_Persistent&
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if(aLastInd >= 1)
|
||||
{
|
||||
Standard_CString aValueStr = Standard_CString(aString.GetString());
|
||||
for (ind = aFirstInd; ind <= aLastInd; ind++)
|
||||
@@ -128,22 +128,23 @@ void XmlMDataStd_RealListDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
XmlObjMgt_Persistent& theTarget,
|
||||
XmlObjMgt_SRelocationTable& ) const
|
||||
{
|
||||
Handle(TDataStd_RealList) aRealList = Handle(TDataStd_RealList)::DownCast(theSource);
|
||||
const Handle(TDataStd_RealList) aRealList = Handle(TDataStd_RealList)::DownCast(theSource);
|
||||
|
||||
Standard_Integer anU = aRealList->Extent();
|
||||
theTarget.Element().setAttribute(::LastIndexString(), anU);
|
||||
if (anU >= 1)
|
||||
{
|
||||
// Allocation of 25 chars for each double value including the space:
|
||||
// An example: -3.1512678732195273e+020
|
||||
// Allocation of 25 chars for each double value including the space:
|
||||
// An example: -3.1512678732195273e+020
|
||||
NCollection_LocalArray<Standard_Character> str(25 * anU + 1);
|
||||
if(anU == 0) str[0] = 0;
|
||||
else if (anU >= 1)
|
||||
{
|
||||
Standard_Integer iChar = 0;
|
||||
NCollection_LocalArray<Standard_Character> str(25 * anU + 1);
|
||||
TColStd_ListIteratorOfListOfReal itr(aRealList->List());
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
const Standard_Real& realValue = itr.Value();
|
||||
iChar += Sprintf(&(str[iChar]), "%.17g ", realValue);
|
||||
}
|
||||
XmlObjMgt::SetStringValue (theTarget, (Standard_Character*)str, Standard_True);
|
||||
}
|
||||
XmlObjMgt::SetStringValue (theTarget, (Standard_Character*)str, Standard_True);
|
||||
}
|
||||
|
Reference in New Issue
Block a user