mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +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:
@@ -48,14 +48,15 @@ Standard_Boolean BinMDataStd_BooleanListDriver::Paste(const BinObjMgt_Persistent
|
|||||||
Standard_Integer aIndex, aFirstInd, aLastInd;
|
Standard_Integer aIndex, aFirstInd, aLastInd;
|
||||||
if (! (theSource >> aFirstInd >> aLastInd))
|
if (! (theSource >> aFirstInd >> aLastInd))
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
if(aLastInd == 0) return Standard_True;
|
||||||
|
|
||||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||||
if (aLength <= 0)
|
if (aLength <= 0)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
|
||||||
TColStd_Array1OfByte aTargetArray(aFirstInd, aLastInd);
|
TColStd_Array1OfByte aTargetArray(aFirstInd, aLastInd);
|
||||||
theSource.GetByteArray (&aTargetArray(aFirstInd), aLength);
|
theSource.GetByteArray (&aTargetArray(aFirstInd), aLength);
|
||||||
|
|
||||||
Handle(TDataStd_BooleanList) anAtt = Handle(TDataStd_BooleanList)::DownCast(theTarget);
|
const Handle(TDataStd_BooleanList) anAtt = Handle(TDataStd_BooleanList)::DownCast(theTarget);
|
||||||
for (aIndex = aFirstInd; aIndex <= aLastInd; aIndex++)
|
for (aIndex = aFirstInd; aIndex <= aLastInd; aIndex++)
|
||||||
{
|
{
|
||||||
anAtt->Append(aTargetArray.Value(aIndex) ? Standard_True : Standard_False);
|
anAtt->Append(aTargetArray.Value(aIndex) ? Standard_True : Standard_False);
|
||||||
@@ -71,22 +72,18 @@ void BinMDataStd_BooleanListDriver::Paste(const Handle(TDF_Attribute)& theSource
|
|||||||
BinObjMgt_Persistent& theTarget,
|
BinObjMgt_Persistent& theTarget,
|
||||||
BinObjMgt_SRelocationTable& ) const
|
BinObjMgt_SRelocationTable& ) const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_BooleanList) anAtt = Handle(TDataStd_BooleanList)::DownCast(theSource);
|
const Handle(TDataStd_BooleanList) anAtt = Handle(TDataStd_BooleanList)::DownCast(theSource);
|
||||||
const Standard_Integer aFirstInd = 1;
|
const Standard_Integer aFirstInd = (anAtt->Extent()> 0) ? 1 : 0;
|
||||||
const Standard_Integer aLastInd = anAtt->Extent();
|
const Standard_Integer aLastInd(anAtt->Extent());
|
||||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||||
if (aLength <= 0)
|
if (aLength <= 0) return;
|
||||||
return;
|
|
||||||
theTarget << aFirstInd << aLastInd;
|
theTarget << aFirstInd << aLastInd;
|
||||||
|
if(aLastInd == 0) return;
|
||||||
TColStd_Array1OfByte aSourceArray(aFirstInd, aLastInd);
|
TColStd_Array1OfByte aSourceArray(aFirstInd, aLastInd);
|
||||||
if (aLastInd >= 1)
|
TDataStd_ListIteratorOfListOfByte itr(anAtt->List());
|
||||||
{
|
for (Standard_Integer i = 1; itr.More(); itr.Next(), i++) {
|
||||||
TDataStd_ListIteratorOfListOfByte itr(anAtt->List());
|
aSourceArray.SetValue(i, itr.Value());
|
||||||
for (Standard_Integer i = 1; itr.More(); itr.Next(), i++)
|
|
||||||
{
|
|
||||||
aSourceArray.SetValue(i, itr.Value());
|
|
||||||
}
|
|
||||||
Standard_Byte *aPtr = (Standard_Byte *) &aSourceArray(aFirstInd);
|
|
||||||
theTarget.PutByteArray(aPtr, aLength);
|
|
||||||
}
|
}
|
||||||
|
Standard_Byte *aPtr = (Standard_Byte *) &aSourceArray(aFirstInd);
|
||||||
|
theTarget.PutByteArray(aPtr, aLength);
|
||||||
}
|
}
|
||||||
|
@@ -41,18 +41,20 @@ Handle(TDF_Attribute) BinMDataStd_ExtStringListDriver::NewEmpty() const
|
|||||||
//function : Paste
|
//function : Paste
|
||||||
//purpose : persistent -> transient (retrieve)
|
//purpose : persistent -> transient (retrieve)
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Boolean BinMDataStd_ExtStringListDriver::Paste(const BinObjMgt_Persistent& theSource,
|
Standard_Boolean BinMDataStd_ExtStringListDriver::Paste
|
||||||
const Handle(TDF_Attribute)& theTarget,
|
(const BinObjMgt_Persistent& theSource,
|
||||||
BinObjMgt_RRelocationTable& ) const
|
const Handle(TDF_Attribute)& theTarget,
|
||||||
|
BinObjMgt_RRelocationTable& ) const
|
||||||
{
|
{
|
||||||
Standard_Integer aFirstInd, aLastInd;
|
Standard_Integer aFirstInd, aLastInd;
|
||||||
if (! (theSource >> aFirstInd >> aLastInd))
|
if (! (theSource >> aFirstInd >> aLastInd))
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
if(aLastInd == 0) return Standard_True;
|
||||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||||
if (aLength <= 0)
|
if (aLength <= 0)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
const Handle(TDataStd_ExtStringList) anAtt =
|
||||||
Handle(TDataStd_ExtStringList) anAtt = Handle(TDataStd_ExtStringList)::DownCast(theTarget);
|
Handle(TDataStd_ExtStringList)::DownCast(theTarget);
|
||||||
for (Standard_Integer i = aFirstInd; i <= aLastInd; i ++)
|
for (Standard_Integer i = aFirstInd; i <= aLastInd; i ++)
|
||||||
{
|
{
|
||||||
TCollection_ExtendedString aStr;
|
TCollection_ExtendedString aStr;
|
||||||
@@ -70,13 +72,15 @@ Standard_Boolean BinMDataStd_ExtStringListDriver::Paste(const BinObjMgt_Persiste
|
|||||||
//function : Paste
|
//function : Paste
|
||||||
//purpose : transient -> persistent (store)
|
//purpose : transient -> persistent (store)
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void BinMDataStd_ExtStringListDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
void BinMDataStd_ExtStringListDriver::Paste
|
||||||
BinObjMgt_Persistent& theTarget,
|
(const Handle(TDF_Attribute)& theSource,
|
||||||
BinObjMgt_SRelocationTable& ) const
|
BinObjMgt_Persistent& theTarget,
|
||||||
|
BinObjMgt_SRelocationTable& ) const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_ExtStringList) anAtt = Handle(TDataStd_ExtStringList)::DownCast(theSource);
|
const Handle(TDataStd_ExtStringList) anAtt =
|
||||||
const Standard_Integer aFirstInd = 1;
|
Handle(TDataStd_ExtStringList)::DownCast(theSource);
|
||||||
const Standard_Integer aLastInd = anAtt->Extent();
|
const Standard_Integer aFirstInd = (anAtt->Extent()> 0) ? 1 : 0;
|
||||||
|
const Standard_Integer aLastInd(anAtt->Extent());
|
||||||
theTarget << aFirstInd << aLastInd;
|
theTarget << aFirstInd << aLastInd;
|
||||||
TDataStd_ListIteratorOfListOfExtendedString itr(anAtt->List());
|
TDataStd_ListIteratorOfListOfExtendedString itr(anAtt->List());
|
||||||
for (; itr.More(); itr.Next())
|
for (; itr.More(); itr.Next())
|
||||||
|
@@ -48,6 +48,8 @@ Standard_Boolean BinMDataStd_IntegerListDriver::Paste(const BinObjMgt_Persistent
|
|||||||
Standard_Integer aIndex, aFirstInd, aLastInd;
|
Standard_Integer aIndex, aFirstInd, aLastInd;
|
||||||
if (! (theSource >> aFirstInd >> aLastInd))
|
if (! (theSource >> aFirstInd >> aLastInd))
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
if(aLastInd == 0) return Standard_True;
|
||||||
|
|
||||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||||
if (aLength <= 0)
|
if (aLength <= 0)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
@@ -55,7 +57,7 @@ Standard_Boolean BinMDataStd_IntegerListDriver::Paste(const BinObjMgt_Persistent
|
|||||||
TColStd_Array1OfInteger aTargetArray(aFirstInd, aLastInd);
|
TColStd_Array1OfInteger aTargetArray(aFirstInd, aLastInd);
|
||||||
theSource.GetIntArray (&aTargetArray(aFirstInd), aLength);
|
theSource.GetIntArray (&aTargetArray(aFirstInd), aLength);
|
||||||
|
|
||||||
Handle(TDataStd_IntegerList) anAtt = Handle(TDataStd_IntegerList)::DownCast(theTarget);
|
const Handle(TDataStd_IntegerList) anAtt = Handle(TDataStd_IntegerList)::DownCast(theTarget);
|
||||||
for (aIndex = aFirstInd; aIndex <= aLastInd; aIndex++)
|
for (aIndex = aFirstInd; aIndex <= aLastInd; aIndex++)
|
||||||
{
|
{
|
||||||
anAtt->Append(aTargetArray.Value(aIndex));
|
anAtt->Append(aTargetArray.Value(aIndex));
|
||||||
@@ -71,13 +73,14 @@ void BinMDataStd_IntegerListDriver::Paste(const Handle(TDF_Attribute)& theSource
|
|||||||
BinObjMgt_Persistent& theTarget,
|
BinObjMgt_Persistent& theTarget,
|
||||||
BinObjMgt_SRelocationTable& ) const
|
BinObjMgt_SRelocationTable& ) const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_IntegerList) anAtt = Handle(TDataStd_IntegerList)::DownCast(theSource);
|
const Handle(TDataStd_IntegerList) anAtt = Handle(TDataStd_IntegerList)::DownCast(theSource);
|
||||||
const Standard_Integer aFirstInd = 1;
|
const Standard_Integer aFirstInd = (anAtt->Extent()> 0) ? 1 : 0;
|
||||||
const Standard_Integer aLastInd = anAtt->Extent();
|
const Standard_Integer aLastInd(anAtt->Extent());
|
||||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||||
if (aLength <= 0)
|
if (aLength <= 0)
|
||||||
return;
|
return;
|
||||||
theTarget << aFirstInd << aLastInd;
|
theTarget << aFirstInd << aLastInd;
|
||||||
|
if(aLastInd == 0) return;
|
||||||
TColStd_Array1OfInteger aSourceArray(aFirstInd, aLastInd);
|
TColStd_Array1OfInteger aSourceArray(aFirstInd, aLastInd);
|
||||||
if (aLastInd >= 1)
|
if (aLastInd >= 1)
|
||||||
{
|
{
|
||||||
|
@@ -48,6 +48,8 @@ Standard_Boolean BinMDataStd_RealListDriver::Paste(const BinObjMgt_Persistent&
|
|||||||
Standard_Integer aIndex, aFirstInd, aLastInd;
|
Standard_Integer aIndex, aFirstInd, aLastInd;
|
||||||
if (! (theSource >> aFirstInd >> aLastInd))
|
if (! (theSource >> aFirstInd >> aLastInd))
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
if(aLastInd == 0) return Standard_True;
|
||||||
|
|
||||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||||
if (aLength <= 0)
|
if (aLength <= 0)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
@@ -55,7 +57,7 @@ Standard_Boolean BinMDataStd_RealListDriver::Paste(const BinObjMgt_Persistent&
|
|||||||
TColStd_Array1OfReal aTargetArray(aFirstInd, aLastInd);
|
TColStd_Array1OfReal aTargetArray(aFirstInd, aLastInd);
|
||||||
theSource.GetRealArray (&aTargetArray(aFirstInd), aLength);
|
theSource.GetRealArray (&aTargetArray(aFirstInd), aLength);
|
||||||
|
|
||||||
Handle(TDataStd_RealList) anAtt = Handle(TDataStd_RealList)::DownCast(theTarget);
|
const Handle(TDataStd_RealList) anAtt = Handle(TDataStd_RealList)::DownCast(theTarget);
|
||||||
for (aIndex = aFirstInd; aIndex <= aLastInd; aIndex++)
|
for (aIndex = aFirstInd; aIndex <= aLastInd; aIndex++)
|
||||||
{
|
{
|
||||||
anAtt->Append(aTargetArray.Value(aIndex));
|
anAtt->Append(aTargetArray.Value(aIndex));
|
||||||
@@ -71,13 +73,14 @@ void BinMDataStd_RealListDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
|||||||
BinObjMgt_Persistent& theTarget,
|
BinObjMgt_Persistent& theTarget,
|
||||||
BinObjMgt_SRelocationTable& ) const
|
BinObjMgt_SRelocationTable& ) const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_RealList) anAtt = Handle(TDataStd_RealList)::DownCast(theSource);
|
const Handle(TDataStd_RealList) anAtt = Handle(TDataStd_RealList)::DownCast(theSource);
|
||||||
const Standard_Integer aFirstInd = 1;
|
const Standard_Integer aFirstInd = (anAtt->Extent()> 0) ? 1 : 0;
|
||||||
const Standard_Integer aLastInd = anAtt->Extent();
|
const Standard_Integer aLastInd(anAtt->Extent());
|
||||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||||
if (aLength <= 0)
|
if (aLength <= 0)
|
||||||
return;
|
return;
|
||||||
theTarget << aFirstInd << aLastInd;
|
theTarget << aFirstInd << aLastInd;
|
||||||
|
if(aLastInd == 0) return;
|
||||||
TColStd_Array1OfReal aSourceArray(aFirstInd, aLastInd);
|
TColStd_Array1OfReal aSourceArray(aFirstInd, aLastInd);
|
||||||
if (aLastInd >= 1)
|
if (aLastInd >= 1)
|
||||||
{
|
{
|
||||||
|
@@ -49,11 +49,13 @@ Standard_Boolean BinMDataStd_ReferenceListDriver::Paste(const BinObjMgt_Persiste
|
|||||||
Standard_Integer aFirstInd, aLastInd;
|
Standard_Integer aFirstInd, aLastInd;
|
||||||
if (! (theSource >> aFirstInd >> aLastInd))
|
if (! (theSource >> aFirstInd >> aLastInd))
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
if(aLastInd == 0) return Standard_True;
|
||||||
|
|
||||||
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
|
||||||
if (aLength <= 0)
|
if (aLength <= 0)
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
|
||||||
Handle(TDataStd_ReferenceList) anAtt = Handle(TDataStd_ReferenceList)::DownCast(theTarget);
|
const Handle(TDataStd_ReferenceList) anAtt = Handle(TDataStd_ReferenceList)::DownCast(theTarget);
|
||||||
for (Standard_Integer i = aFirstInd; i <= aLastInd; i++)
|
for (Standard_Integer i = aFirstInd; i <= aLastInd; i++)
|
||||||
{
|
{
|
||||||
TCollection_AsciiString entry;
|
TCollection_AsciiString entry;
|
||||||
@@ -76,13 +78,15 @@ void BinMDataStd_ReferenceListDriver::Paste(const Handle(TDF_Attribute)& theSour
|
|||||||
BinObjMgt_Persistent& theTarget,
|
BinObjMgt_Persistent& theTarget,
|
||||||
BinObjMgt_SRelocationTable& ) const
|
BinObjMgt_SRelocationTable& ) const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_ReferenceList) anAtt = Handle(TDataStd_ReferenceList)::DownCast(theSource);
|
const Handle(TDataStd_ReferenceList) anAtt = Handle(TDataStd_ReferenceList)::DownCast(theSource);
|
||||||
if (anAtt->IsEmpty())
|
if (anAtt.IsNull())
|
||||||
return;
|
return;
|
||||||
Standard_Integer aFirstInd = 1, aLastInd = anAtt->Extent(), i = aFirstInd;
|
const Standard_Integer aFirstInd = (anAtt->Extent()> 0) ? 1 : 0;
|
||||||
|
const Standard_Integer aLastInd(anAtt->Extent());
|
||||||
theTarget << aFirstInd << aLastInd;
|
theTarget << aFirstInd << aLastInd;
|
||||||
|
if(aLastInd == 0) return;
|
||||||
TDF_ListIteratorOfLabelList itr(anAtt->List());
|
TDF_ListIteratorOfLabelList itr(anAtt->List());
|
||||||
for (; itr.More(); itr.Next(), i++)
|
for (Standard_Integer i = aFirstInd; itr.More(); itr.Next(), i++)
|
||||||
{
|
{
|
||||||
TDF_Label L = itr.Value();
|
TDF_Label L = itr.Value();
|
||||||
if (!L.IsNull())
|
if (!L.IsNull())
|
||||||
|
@@ -94,6 +94,10 @@
|
|||||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||||
#include <TColStd_ListIteratorOfListOfReal.hxx>
|
#include <TColStd_ListIteratorOfListOfReal.hxx>
|
||||||
#include <TDataStd_ReferenceArray.hxx>
|
#include <TDataStd_ReferenceArray.hxx>
|
||||||
|
#include <TDataStd_ExtStringList.hxx>
|
||||||
|
#include <TDataStd_ReferenceList.hxx>
|
||||||
|
#include <TDF_ListIteratorOfLabelList.hxx>
|
||||||
|
#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : DDataStd_SetInteger
|
//function : DDataStd_SetInteger
|
||||||
@@ -1474,6 +1478,65 @@ static Standard_Integer DDataStd_SetBooleanArrayValue (Draw_Interpretor& di,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : DDataStd_SetExtStringList (DF, entry, elmt1, elmt2, ... )
|
||||||
|
//=======================================================================
|
||||||
|
static Standard_Integer DDataStd_SetExtStringList (Draw_Interpretor& di,
|
||||||
|
Standard_Integer nb,
|
||||||
|
const char** arg)
|
||||||
|
{
|
||||||
|
if (nb > 2)
|
||||||
|
{
|
||||||
|
Handle(TDF_Data) DF;
|
||||||
|
if (!DDF::GetDF(arg[1],DF))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
TDF_Label label;
|
||||||
|
DDF::AddLabel(DF, arg[2], label);
|
||||||
|
Handle(TDataStd_ExtStringList) A = TDataStd_ExtStringList::Set(label);
|
||||||
|
for(Standard_Integer i = 3; i <= nb - 1; i++)
|
||||||
|
{
|
||||||
|
TCollection_ExtendedString aValue(arg[i]);
|
||||||
|
A->Append(aValue);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
di << "DDataStd_SetExtStringList: Error" << "\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
//=======================================================================
|
||||||
|
//function : DDataStd_SetReferenceList (DF, entry, elmt1, elmt2, ... )
|
||||||
|
//=======================================================================
|
||||||
|
static Standard_Integer DDataStd_SetReferenceList (Draw_Interpretor& di,
|
||||||
|
Standard_Integer nb,
|
||||||
|
const char** arg)
|
||||||
|
{
|
||||||
|
if (nb > 2)
|
||||||
|
{
|
||||||
|
Handle(TDF_Data) DF;
|
||||||
|
if (!DDF::GetDF(arg[1],DF))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
TDF_Label label;
|
||||||
|
DDF::AddLabel(DF, arg[2], label);
|
||||||
|
if(!label.IsNull()) {
|
||||||
|
Handle(TDataStd_ReferenceList) A = TDataStd_ReferenceList::Set(label);
|
||||||
|
for(Standard_Integer i = 3; i <= nb - 1; i++)
|
||||||
|
{
|
||||||
|
TDF_Label aValueLabel;
|
||||||
|
DDF::AddLabel(DF, arg[i], aValueLabel);
|
||||||
|
if(aValueLabel.IsNull()) continue;
|
||||||
|
A->Append(aValueLabel);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
di << "DDataStd_SetReferenceList: Error" << "\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SetBooleanList (DF, entry, elmt1, elmt2, ... )
|
//function : SetBooleanList (DF, entry, elmt1, elmt2, ... )
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -1761,107 +1824,228 @@ static Standard_Integer DDataStd_ChangeByteArray (Draw_Interpretor& di,
|
|||||||
//function : GetBooleanList (DF, entry )
|
//function : GetBooleanList (DF, entry )
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
static Standard_Integer DDataStd_GetBooleanList (Draw_Interpretor& di,
|
static Standard_Integer DDataStd_GetBooleanList (Draw_Interpretor& di,
|
||||||
Standard_Integer,
|
Standard_Integer nb,
|
||||||
const char** arg)
|
const char** arg)
|
||||||
{
|
{
|
||||||
Handle(TDF_Data) DF;
|
if (nb == 3) {
|
||||||
if (!DDF::GetDF(arg[1],DF))
|
Handle(TDF_Data) DF;
|
||||||
|
if (!DDF::GetDF(arg[1],DF))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
TDF_Label label;
|
TDF_Label label;
|
||||||
if ( !DDF::FindLabel(DF, arg[2], label) )
|
if ( !DDF::FindLabel(DF, arg[2], label) )
|
||||||
{
|
{
|
||||||
di << "No label for entry" << "\n";
|
di << "No label for entry" << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(TDataStd_BooleanList) A;
|
Handle(TDataStd_BooleanList) A;
|
||||||
if ( !label.FindAttribute(TDataStd_BooleanList::GetID(), A) )
|
if ( !label.FindAttribute(TDataStd_BooleanList::GetID(), A) )
|
||||||
{
|
{
|
||||||
di << "There is no TDataStd_BooleanList at label" << "\n";
|
di << "There is no TDataStd_BooleanList at label" << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TDataStd_ListOfByte& bList = A->List();
|
const TDataStd_ListOfByte& bList = A->List();
|
||||||
TDataStd_ListIteratorOfListOfByte itr(bList);
|
Standard_Boolean isEmpty = (bList.Extent() > 0) ? Standard_False : Standard_True;
|
||||||
for (; itr.More(); itr.Next())
|
if(!isEmpty) {
|
||||||
{
|
TDataStd_ListIteratorOfListOfByte itr(bList);
|
||||||
di << (Standard_Integer) itr.Value() << " ";
|
for (; itr.More(); itr.Next())
|
||||||
|
{
|
||||||
|
di << (Standard_Integer) itr.Value() << " ";
|
||||||
|
}
|
||||||
|
di << "\n";
|
||||||
|
} else
|
||||||
|
di << "List is empty" << "\n";
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
di << "\n";
|
di << "DDataStd_GetBooleanList: Error" << "\n";
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GetIntegerList (DF, entry )
|
//function : GetIntegerList (DF, entry )
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
static Standard_Integer DDataStd_GetIntegerList (Draw_Interpretor& di,
|
static Standard_Integer DDataStd_GetIntegerList (Draw_Interpretor& di,
|
||||||
Standard_Integer,
|
Standard_Integer nb,
|
||||||
const char** arg)
|
const char** arg)
|
||||||
{
|
{
|
||||||
Handle(TDF_Data) DF;
|
if (nb == 3) {
|
||||||
if (!DDF::GetDF(arg[1],DF))
|
Handle(TDF_Data) DF;
|
||||||
|
if (!DDF::GetDF(arg[1],DF))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
TDF_Label label;
|
TDF_Label label;
|
||||||
if ( !DDF::FindLabel(DF, arg[2], label) )
|
if ( !DDF::FindLabel(DF, arg[2], label) )
|
||||||
{
|
{
|
||||||
di << "No label for entry" << "\n";
|
di << "No label for entry" << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(TDataStd_IntegerList) A;
|
Handle(TDataStd_IntegerList) A;
|
||||||
if ( !label.FindAttribute(TDataStd_IntegerList::GetID(), A) )
|
if ( !label.FindAttribute(TDataStd_IntegerList::GetID(), A) )
|
||||||
{
|
{
|
||||||
di << "There is no TDataStd_IntegerList at label" << "\n";
|
di << "There is no TDataStd_IntegerList at label" << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TColStd_ListOfInteger& iList = A->List();
|
const TColStd_ListOfInteger& iList = A->List();
|
||||||
TColStd_ListIteratorOfListOfInteger itr(iList);
|
Standard_Boolean isEmpty = (iList.Extent() > 0) ? Standard_False : Standard_True;
|
||||||
for (; itr.More(); itr.Next())
|
if(!isEmpty) {
|
||||||
{
|
TColStd_ListIteratorOfListOfInteger itr(iList);
|
||||||
di << itr.Value() << " ";
|
for (; itr.More(); itr.Next())
|
||||||
|
{
|
||||||
|
di << itr.Value() << " ";
|
||||||
|
}
|
||||||
|
di << "\n";
|
||||||
|
} else
|
||||||
|
di << "List is empty" << "\n";
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
di << "\n";
|
di << "DDataStd_GetIntegerList: Error" << "\n";
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GetRealList (DF, entry )
|
//function : GetRealList (DF, entry )
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
static Standard_Integer DDataStd_GetRealList (Draw_Interpretor& di,
|
static Standard_Integer DDataStd_GetRealList (Draw_Interpretor& di,
|
||||||
Standard_Integer,
|
Standard_Integer nb,
|
||||||
const char** arg)
|
const char** arg)
|
||||||
{
|
{
|
||||||
Handle(TDF_Data) DF;
|
if (nb == 3) {
|
||||||
if (!DDF::GetDF(arg[1],DF))
|
Handle(TDF_Data) DF;
|
||||||
|
if (!DDF::GetDF(arg[1],DF))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
TDF_Label label;
|
TDF_Label label;
|
||||||
if ( !DDF::FindLabel(DF, arg[2], label) )
|
if ( !DDF::FindLabel(DF, arg[2], label) )
|
||||||
{
|
{
|
||||||
di << "No label for entry" << "\n";
|
di << "No label for entry" << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(TDataStd_RealList) A;
|
Handle(TDataStd_RealList) A;
|
||||||
if ( !label.FindAttribute(TDataStd_RealList::GetID(), A) )
|
if ( !label.FindAttribute(TDataStd_RealList::GetID(), A) )
|
||||||
{
|
{
|
||||||
di << "There is no TDataStd_RealList at label" << "\n";
|
di << "There is no TDataStd_RealList at label" << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TColStd_ListOfReal& iList = A->List();
|
const TColStd_ListOfReal& rList = A->List();
|
||||||
TColStd_ListIteratorOfListOfReal itr(iList);
|
Standard_Boolean isEmpty = (rList.Extent() > 0) ? Standard_False : Standard_True;
|
||||||
for (; itr.More(); itr.Next())
|
if(!isEmpty) {
|
||||||
{
|
TColStd_ListIteratorOfListOfReal itr(rList);
|
||||||
di << itr.Value() << " ";
|
for (; itr.More(); itr.Next())
|
||||||
|
{
|
||||||
|
di << itr.Value() << " ";
|
||||||
|
}
|
||||||
|
di << "\n";
|
||||||
|
} else
|
||||||
|
di << "List is empty" << "\n";
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
di << "\n";
|
di << "DDataStd_GetRealList: Error" << "\n";
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : DDataStd_GetExtStringList (DF, entry)
|
||||||
|
//=======================================================================
|
||||||
|
static Standard_Integer DDataStd_GetExtStringList (Draw_Interpretor& di,
|
||||||
|
Standard_Integer nb,
|
||||||
|
const char** arg)
|
||||||
|
{
|
||||||
|
if (nb == 3)
|
||||||
|
{
|
||||||
|
Handle(TDF_Data) DF;
|
||||||
|
if (!DDF::GetDF(arg[1],DF))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
TDF_Label label;
|
||||||
|
if ( !DDF::FindLabel(DF, arg[2], label) )
|
||||||
|
{
|
||||||
|
di << "No label for entry" << "\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(TDataStd_ExtStringList) A;
|
||||||
|
if ( !label.FindAttribute(TDataStd_ExtStringList::GetID(), A) )
|
||||||
|
{
|
||||||
|
di << "There is no TDataStd_ExtStringList at label" << "\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TDataStd_ListOfExtendedString& aList = A->List();
|
||||||
|
Standard_Boolean isEmpty = (aList.Extent() > 0) ? Standard_False : Standard_True;
|
||||||
|
if(!isEmpty) {
|
||||||
|
TDataStd_ListIteratorOfListOfExtendedString itr(aList);
|
||||||
|
for (; itr.More(); itr.Next())
|
||||||
|
{
|
||||||
|
const TCollection_ExtendedString& aStr = itr.Value();
|
||||||
|
di << aStr << " ";
|
||||||
|
}
|
||||||
|
di << "\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
di << "List is empty" << "\n";
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
di << "DDataStd_GetExtStringList: Error" << "\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : DDataStd_GetReferenceList (DF, entry )
|
||||||
|
//=======================================================================
|
||||||
|
static Standard_Integer DDataStd_GetReferenceList (Draw_Interpretor& di,
|
||||||
|
Standard_Integer nb,
|
||||||
|
const char** arg)
|
||||||
|
{
|
||||||
|
if (nb == 3)
|
||||||
|
{
|
||||||
|
Handle(TDF_Data) DF;
|
||||||
|
if (!DDF::GetDF(arg[1],DF))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
TDF_Label label;
|
||||||
|
if ( !DDF::FindLabel(DF, arg[2], label) )
|
||||||
|
{
|
||||||
|
di << "No label for entry" << "\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(TDataStd_ReferenceList) A;
|
||||||
|
if ( !label.FindAttribute(TDataStd_ReferenceList::GetID(), A) )
|
||||||
|
{
|
||||||
|
di << "There is no TDataStd_ReferenceList at label" << "\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TDF_LabelList& aList = A->List();
|
||||||
|
Standard_Boolean isEmpty = (aList.Extent() > 0) ? Standard_False : Standard_True;
|
||||||
|
if(!isEmpty) {
|
||||||
|
TDF_ListIteratorOfLabelList itr(aList);
|
||||||
|
for (; itr.More(); itr.Next())
|
||||||
|
{
|
||||||
|
const TDF_Label& aLabel = itr.Value();
|
||||||
|
if (!aLabel.IsNull()) {
|
||||||
|
TCollection_AsciiString entry;
|
||||||
|
TDF_Tool::Entry(aLabel, entry);
|
||||||
|
di << entry.ToCString() << " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
di << "\n";
|
||||||
|
} else
|
||||||
|
di << "List is empty" << "\n";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
di << "DDataStd_GetReferenceList: Error" << "\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
//
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SetIntPackedMap (DF, entry, isDelta, key1, key2, ...
|
//function : SetIntPackedMap (DF, entry, isDelta, key1, key2, ...
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -3177,6 +3361,13 @@ void DDataStd::BasicCommands (Draw_Interpretor& theCommands)
|
|||||||
"SetRealList (DF, entry, elmt1, elmt2, ... )",
|
"SetRealList (DF, entry, elmt1, elmt2, ... )",
|
||||||
__FILE__, DDataStd_SetRealList, g);
|
__FILE__, DDataStd_SetRealList, g);
|
||||||
|
|
||||||
|
theCommands.Add ("SetExtStringList",
|
||||||
|
"SetExtStringList (DF, entry, elmt1, elmt2, ... )",
|
||||||
|
__FILE__, DDataStd_SetExtStringList, g);
|
||||||
|
|
||||||
|
theCommands.Add ("SetReferenceList",
|
||||||
|
"SetReferenceList (DF, entry, elmt1, elmt2, ... )",
|
||||||
|
__FILE__, DDataStd_SetReferenceList, g);
|
||||||
|
|
||||||
// GET
|
// GET
|
||||||
|
|
||||||
@@ -3285,7 +3476,13 @@ void DDataStd::BasicCommands (Draw_Interpretor& theCommands)
|
|||||||
"GetRealList (DF, entry )",
|
"GetRealList (DF, entry )",
|
||||||
__FILE__, DDataStd_GetRealList, g);
|
__FILE__, DDataStd_GetRealList, g);
|
||||||
|
|
||||||
|
theCommands.Add ("GetExtStringList",
|
||||||
|
"GetExtStringList (DF, entry)",
|
||||||
|
__FILE__, DDataStd_GetExtStringList, g);
|
||||||
|
|
||||||
|
theCommands.Add ("GetReferenceList",
|
||||||
|
"GetReferenceList (DF, entry)",
|
||||||
|
__FILE__, DDataStd_GetReferenceList, g);
|
||||||
|
|
||||||
// ========================= UTF =====================================
|
// ========================= UTF =====================================
|
||||||
const char* ggg = "UTF Commands";
|
const char* ggg = "UTF Commands";
|
||||||
|
@@ -64,12 +64,13 @@ void MDataStd_BooleanListRetrievalDriver::Paste(const Handle(PDF_Attribute)& Sou
|
|||||||
const Handle(TDF_Attribute)& Target,
|
const Handle(TDF_Attribute)& Target,
|
||||||
const Handle(MDF_RRelocationTable)& ) const
|
const Handle(MDF_RRelocationTable)& ) const
|
||||||
{
|
{
|
||||||
Handle(PDataStd_BooleanList) S = Handle(PDataStd_BooleanList)::DownCast (Source);
|
const Handle(PDataStd_BooleanList) S = Handle(PDataStd_BooleanList)::DownCast (Source);
|
||||||
Handle(TDataStd_BooleanList) T = Handle(TDataStd_BooleanList)::DownCast (Target);
|
const Handle(TDataStd_BooleanList) T = Handle(TDataStd_BooleanList)::DownCast (Target);
|
||||||
|
if(!S.IsNull()) {
|
||||||
Standard_Integer i, lower = S->Lower(), upper = S->Upper();
|
Standard_Integer i, lower = S->Lower(), upper = S->Upper();
|
||||||
for (i = lower; i <= upper; i++)
|
if(upper > 0)
|
||||||
{
|
for (i = lower; i <= upper; i++) {
|
||||||
T->Append(S->Value(i));
|
T->Append(S->Value(i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -66,16 +66,19 @@ void MDataStd_BooleanListStorageDriver::Paste(const Handle(TDF_Attribute)& Sour
|
|||||||
const Handle(PDF_Attribute)& Target,
|
const Handle(PDF_Attribute)& Target,
|
||||||
const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
|
const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_BooleanList) S = Handle(TDataStd_BooleanList)::DownCast (Source);
|
const Handle(TDataStd_BooleanList) S = Handle(TDataStd_BooleanList)::DownCast (Source);
|
||||||
Handle(PDataStd_BooleanList) T = Handle(PDataStd_BooleanList)::DownCast (Target);
|
const Handle(PDataStd_BooleanList) T = Handle(PDataStd_BooleanList)::DownCast (Target);
|
||||||
|
|
||||||
Standard_Integer lower = 1, upper = S->Extent(), i = lower;
|
Standard_Integer lower(1), upper = S->Extent();
|
||||||
if (upper >= lower)
|
if(upper == 0) {
|
||||||
|
lower = 0;
|
||||||
|
T->Init(lower, upper);
|
||||||
|
}
|
||||||
|
else if (upper >= lower)
|
||||||
{
|
{
|
||||||
T->Init(lower, upper);
|
T->Init(lower, upper);
|
||||||
TDataStd_ListIteratorOfListOfByte itr(S->List());
|
TDataStd_ListIteratorOfListOfByte itr(S->List());
|
||||||
for (; itr.More(); itr.Next(), i++)
|
for (Standard_Integer i = lower; itr.More(); itr.Next(), i++) {
|
||||||
{
|
|
||||||
T->SetValue(i, itr.Value());
|
T->SetValue(i, itr.Value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -66,14 +66,15 @@ void MDataStd_ExtStringListRetrievalDriver::Paste(const Handle(PDF_Attribute)& S
|
|||||||
const Handle(TDF_Attribute)& Target,
|
const Handle(TDF_Attribute)& Target,
|
||||||
const Handle(MDF_RRelocationTable)& ) const
|
const Handle(MDF_RRelocationTable)& ) const
|
||||||
{
|
{
|
||||||
Handle(PDataStd_ExtStringList) S = Handle(PDataStd_ExtStringList)::DownCast (Source);
|
const Handle(PDataStd_ExtStringList) S = Handle(PDataStd_ExtStringList)::DownCast (Source);
|
||||||
Handle(TDataStd_ExtStringList) T = Handle(TDataStd_ExtStringList)::DownCast (Target);
|
const Handle(TDataStd_ExtStringList) T = Handle(TDataStd_ExtStringList)::DownCast (Target);
|
||||||
|
if(S.IsNull()) return;
|
||||||
Standard_Integer i, lower = S->Lower(), upper = S->Upper();
|
Standard_Integer i, lower = S->Lower(), upper = S->Upper();
|
||||||
for (i = lower; i <= upper; i++)
|
if(upper > 0)
|
||||||
{
|
for (i = lower; i <= upper; i++)
|
||||||
const Handle(PCollection_HExtendedString)& pvalue = S->Value(i);
|
{
|
||||||
TCollection_ExtendedString tvalue = pvalue->Convert();
|
const Handle(PCollection_HExtendedString)& pvalue = S->Value(i);
|
||||||
T->Append(tvalue);
|
TCollection_ExtendedString tvalue = pvalue->Convert();
|
||||||
}
|
T->Append(tvalue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -67,18 +67,22 @@ void MDataStd_ExtStringListStorageDriver::Paste(const Handle(TDF_Attribute)& Sou
|
|||||||
const Handle(PDF_Attribute)& Target,
|
const Handle(PDF_Attribute)& Target,
|
||||||
const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
|
const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_ExtStringList) S = Handle(TDataStd_ExtStringList)::DownCast (Source);
|
const Handle(TDataStd_ExtStringList) S = Handle(TDataStd_ExtStringList)::DownCast (Source);
|
||||||
Handle(PDataStd_ExtStringList) T = Handle(PDataStd_ExtStringList)::DownCast (Target);
|
const Handle(PDataStd_ExtStringList) T = Handle(PDataStd_ExtStringList)::DownCast (Target);
|
||||||
|
if(S.IsNull()) return;
|
||||||
Standard_Integer lower = 1, upper = S->Extent(), i = lower;
|
Standard_Integer lower(1), upper = S->Extent();
|
||||||
if (upper >= lower)
|
if(upper == 0) {
|
||||||
|
lower = 0;
|
||||||
|
T->Init(lower, upper);
|
||||||
|
}
|
||||||
|
else if (upper >= lower)
|
||||||
{
|
{
|
||||||
T->Init(lower, upper);
|
T->Init(lower, upper);
|
||||||
TDataStd_ListIteratorOfListOfExtendedString itr(S->List());
|
TDataStd_ListIteratorOfListOfExtendedString itr(S->List());
|
||||||
for (; itr.More(); itr.Next(), i++)
|
for (Standard_Integer i = lower; itr.More(); itr.Next(), i++)
|
||||||
{
|
{
|
||||||
const TCollection_ExtendedString& tvalue = itr.Value();
|
const TCollection_ExtendedString& tvalue = itr.Value();
|
||||||
Handle(PCollection_HExtendedString) pvalue = new PCollection_HExtendedString(tvalue);
|
const Handle(PCollection_HExtendedString)& pvalue = new PCollection_HExtendedString(tvalue);
|
||||||
T->SetValue(i, pvalue);
|
T->SetValue(i, pvalue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -64,12 +64,12 @@ void MDataStd_IntegerListRetrievalDriver::Paste(const Handle(PDF_Attribute)& Sou
|
|||||||
const Handle(TDF_Attribute)& Target,
|
const Handle(TDF_Attribute)& Target,
|
||||||
const Handle(MDF_RRelocationTable)& ) const
|
const Handle(MDF_RRelocationTable)& ) const
|
||||||
{
|
{
|
||||||
Handle(PDataStd_IntegerList) S = Handle(PDataStd_IntegerList)::DownCast (Source);
|
const Handle(PDataStd_IntegerList) S = Handle(PDataStd_IntegerList)::DownCast (Source);
|
||||||
Handle(TDataStd_IntegerList) T = Handle(TDataStd_IntegerList)::DownCast (Target);
|
const Handle(TDataStd_IntegerList) T = Handle(TDataStd_IntegerList)::DownCast (Target);
|
||||||
|
|
||||||
Standard_Integer i, lower = S->Lower(), upper = S->Upper();
|
Standard_Integer i, lower = S->Lower(), upper = S->Upper();
|
||||||
for (i = lower; i <= upper; i++)
|
if(upper > 0)
|
||||||
{
|
for (i = lower; i <= upper; i++) {
|
||||||
T->Append(S->Value(i));
|
T->Append(S->Value(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -66,16 +66,19 @@ void MDataStd_IntegerListStorageDriver::Paste(const Handle(TDF_Attribute)& Sour
|
|||||||
const Handle(PDF_Attribute)& Target,
|
const Handle(PDF_Attribute)& Target,
|
||||||
const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
|
const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_IntegerList) S = Handle(TDataStd_IntegerList)::DownCast (Source);
|
const Handle(TDataStd_IntegerList) S = Handle(TDataStd_IntegerList)::DownCast (Source);
|
||||||
Handle(PDataStd_IntegerList) T = Handle(PDataStd_IntegerList)::DownCast (Target);
|
const Handle(PDataStd_IntegerList) T = Handle(PDataStd_IntegerList)::DownCast (Target);
|
||||||
|
|
||||||
Standard_Integer lower = 1, upper = S->Extent(), i = lower;
|
Standard_Integer lower(1), upper = S->Extent(), i = lower;
|
||||||
if (upper >= lower)
|
if(upper == 0) {
|
||||||
|
lower = 0;
|
||||||
|
T->Init(lower, upper);
|
||||||
|
}
|
||||||
|
else if (upper >= lower)
|
||||||
{
|
{
|
||||||
T->Init(lower, upper);
|
T->Init(lower, upper);
|
||||||
TColStd_ListIteratorOfListOfInteger itr(S->List());
|
TColStd_ListIteratorOfListOfInteger itr(S->List());
|
||||||
for (; itr.More(); itr.Next(), i++)
|
for (; itr.More(); itr.Next(), i++) {
|
||||||
{
|
|
||||||
T->SetValue(i, itr.Value());
|
T->SetValue(i, itr.Value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -64,12 +64,13 @@ void MDataStd_RealListRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source
|
|||||||
const Handle(TDF_Attribute)& Target,
|
const Handle(TDF_Attribute)& Target,
|
||||||
const Handle(MDF_RRelocationTable)& ) const
|
const Handle(MDF_RRelocationTable)& ) const
|
||||||
{
|
{
|
||||||
Handle(PDataStd_RealList) S = Handle(PDataStd_RealList)::DownCast (Source);
|
const Handle(PDataStd_RealList) S = Handle(PDataStd_RealList)::DownCast (Source);
|
||||||
Handle(TDataStd_RealList) T = Handle(TDataStd_RealList)::DownCast (Target);
|
const Handle(TDataStd_RealList) T = Handle(TDataStd_RealList)::DownCast (Target);
|
||||||
|
if(!S.IsNull()) {
|
||||||
Standard_Integer i, lower = S->Lower(), upper = S->Upper();
|
Standard_Integer i, lower = S->Lower(), upper = S->Upper();
|
||||||
for (i = lower; i <= upper; i++)
|
if(upper > 0)
|
||||||
{
|
for (i = lower; i <= upper; i++) {
|
||||||
T->Append(S->Value(i));
|
T->Append(S->Value(i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -66,16 +66,19 @@ void MDataStd_RealListStorageDriver::Paste(const Handle(TDF_Attribute)& Source,
|
|||||||
const Handle(PDF_Attribute)& Target,
|
const Handle(PDF_Attribute)& Target,
|
||||||
const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
|
const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_RealList) S = Handle(TDataStd_RealList)::DownCast (Source);
|
const Handle(TDataStd_RealList) S = Handle(TDataStd_RealList)::DownCast (Source);
|
||||||
Handle(PDataStd_RealList) T = Handle(PDataStd_RealList)::DownCast (Target);
|
const Handle(PDataStd_RealList) T = Handle(PDataStd_RealList)::DownCast (Target);
|
||||||
|
|
||||||
Standard_Integer lower = 1, upper = S->Extent(), i = lower;
|
Standard_Integer lower(1), upper = S->Extent();
|
||||||
if (upper >= lower)
|
if(upper == 0) {
|
||||||
|
lower = 0;
|
||||||
|
T->Init(lower, upper);
|
||||||
|
}
|
||||||
|
else if (upper >= lower)
|
||||||
{
|
{
|
||||||
T->Init(lower, upper);
|
T->Init(lower, upper);
|
||||||
TColStd_ListIteratorOfListOfReal itr(S->List());
|
TColStd_ListIteratorOfListOfReal itr(S->List());
|
||||||
for (; itr.More(); itr.Next(), i++)
|
for (Standard_Integer i = lower; itr.More(); itr.Next(), i++) {
|
||||||
{
|
|
||||||
T->SetValue(i, itr.Value());
|
T->SetValue(i, itr.Value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -68,22 +68,21 @@ void MDataStd_ReferenceListRetrievalDriver::Paste(const Handle(PDF_Attribute)& S
|
|||||||
const Handle(TDF_Attribute)& Target,
|
const Handle(TDF_Attribute)& Target,
|
||||||
const Handle(MDF_RRelocationTable)& ) const
|
const Handle(MDF_RRelocationTable)& ) const
|
||||||
{
|
{
|
||||||
Handle(PDataStd_ReferenceList) S = Handle(PDataStd_ReferenceList)::DownCast (Source);
|
const Handle(PDataStd_ReferenceList) S = Handle(PDataStd_ReferenceList)::DownCast (Source);
|
||||||
Handle(TDataStd_ReferenceList) T = Handle(TDataStd_ReferenceList)::DownCast (Target);
|
const Handle(TDataStd_ReferenceList) T = Handle(TDataStd_ReferenceList)::DownCast (Target);
|
||||||
|
if(S.IsNull()) return;
|
||||||
Standard_Integer i, lower = S->Lower(), upper = S->Upper();
|
Standard_Integer i, lower = S->Lower(), upper = S->Upper();
|
||||||
for (i = lower; i <= upper; i++)
|
if(upper > 0)
|
||||||
{
|
for (i = lower; i <= upper; i++)
|
||||||
const Handle(PCollection_HExtendedString)& pvalue = S->Value(i);
|
|
||||||
if (!pvalue.IsNull())
|
|
||||||
{
|
{
|
||||||
TDF_Label L;
|
const Handle(PCollection_HExtendedString)& pvalue = S->Value(i);
|
||||||
TCollection_AsciiString tvalue = pvalue->Convert();
|
if (!pvalue.IsNull())
|
||||||
TDF_Tool::Label(T->Label().Data(), tvalue, L, Standard_True);
|
|
||||||
if (!L.IsNull())
|
|
||||||
{
|
{
|
||||||
T->Append(L);
|
TDF_Label L;
|
||||||
|
const TCollection_AsciiString& tvalue = pvalue->Convert();
|
||||||
|
TDF_Tool::Label(T->Label().Data(), tvalue, L, Standard_True);
|
||||||
|
if (!L.IsNull())
|
||||||
|
T->Append(L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -69,23 +69,27 @@ void MDataStd_ReferenceListStorageDriver::Paste(const Handle(TDF_Attribute)& So
|
|||||||
const Handle(PDF_Attribute)& Target,
|
const Handle(PDF_Attribute)& Target,
|
||||||
const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
|
const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_ReferenceList) S = Handle(TDataStd_ReferenceList)::DownCast (Source);
|
const Handle(TDataStd_ReferenceList) S = Handle(TDataStd_ReferenceList)::DownCast (Source);
|
||||||
Handle(PDataStd_ReferenceList) T = Handle(PDataStd_ReferenceList)::DownCast (Target);
|
const Handle(PDataStd_ReferenceList) T = Handle(PDataStd_ReferenceList)::DownCast (Target);
|
||||||
|
if(S.IsNull()) return;
|
||||||
Standard_Integer lower = 1, upper = S->Extent(), i = lower;
|
Standard_Integer lower(1), upper = S->Extent();
|
||||||
if (upper >= lower)
|
if(upper == 0) {
|
||||||
|
lower = 0;
|
||||||
|
T->Init(lower, upper);
|
||||||
|
}
|
||||||
|
else if (upper >= lower)
|
||||||
{
|
{
|
||||||
T->Init(lower, upper);
|
T->Init(lower, upper);
|
||||||
TDF_ListIteratorOfLabelList itr(S->List());
|
TDF_ListIteratorOfLabelList itr(S->List());
|
||||||
for (; itr.More(); itr.Next(), i++)
|
for (Standard_Integer i = lower; itr.More(); itr.Next(), i++)
|
||||||
{
|
{
|
||||||
TDF_Label L = itr.Value();
|
TDF_Label L = itr.Value();
|
||||||
if (!L.IsNull())
|
if (!L.IsNull())
|
||||||
{
|
{
|
||||||
TCollection_AsciiString tvalue;
|
TCollection_AsciiString tvalue;
|
||||||
TDF_Tool::Entry(L, tvalue);
|
TDF_Tool::Entry(L, tvalue);
|
||||||
Handle(PCollection_HExtendedString) pvalue = new PCollection_HExtendedString(tvalue);
|
const Handle(PCollection_HExtendedString)& pvalue = new PCollection_HExtendedString(tvalue);
|
||||||
T->SetValue(i, pvalue);
|
T->SetValue(i, pvalue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -77,8 +77,9 @@ Standard_Boolean XmlMDataStd_BooleanListDriver::Paste(const XmlObjMgt_Persistent
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(TDataStd_BooleanList) aBooleanList = Handle(TDataStd_BooleanList)::DownCast(theTarget);
|
const Handle(TDataStd_BooleanList) aBooleanList = Handle(TDataStd_BooleanList)::DownCast(theTarget);
|
||||||
if (aFirstInd == aLastInd)
|
if(aLastInd == 0) aFirstInd = 0;
|
||||||
|
if (aFirstInd == aLastInd && aLastInd > 0)
|
||||||
{
|
{
|
||||||
Standard_Integer anInteger;
|
Standard_Integer anInteger;
|
||||||
if (!XmlObjMgt::GetStringValue(anElement).GetInteger(anInteger))
|
if (!XmlObjMgt::GetStringValue(anElement).GetInteger(anInteger))
|
||||||
@@ -91,7 +92,7 @@ Standard_Boolean XmlMDataStd_BooleanListDriver::Paste(const XmlObjMgt_Persistent
|
|||||||
}
|
}
|
||||||
aBooleanList->Append(anInteger ? Standard_True : Standard_False);
|
aBooleanList->Append(anInteger ? Standard_True : Standard_False);
|
||||||
}
|
}
|
||||||
else
|
else if(aLastInd >= 1)
|
||||||
{
|
{
|
||||||
Standard_CString aValueStr = Standard_CString(XmlObjMgt::GetStringValue(anElement).GetString());
|
Standard_CString aValueStr = Standard_CString(XmlObjMgt::GetStringValue(anElement).GetString());
|
||||||
for (ind = aFirstInd; ind <= aLastInd; ind++)
|
for (ind = aFirstInd; ind <= aLastInd; ind++)
|
||||||
@@ -120,21 +121,22 @@ void XmlMDataStd_BooleanListDriver::Paste(const Handle(TDF_Attribute)& theSource
|
|||||||
XmlObjMgt_Persistent& theTarget,
|
XmlObjMgt_Persistent& theTarget,
|
||||||
XmlObjMgt_SRelocationTable& ) const
|
XmlObjMgt_SRelocationTable& ) const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_BooleanList) aBooleanList = Handle(TDataStd_BooleanList)::DownCast(theSource);
|
const Handle(TDataStd_BooleanList) aBooleanList = Handle(TDataStd_BooleanList)::DownCast(theSource);
|
||||||
|
|
||||||
Standard_Integer anU = aBooleanList->Extent();
|
Standard_Integer anU = aBooleanList->Extent();
|
||||||
theTarget.Element().setAttribute(::LastIndexString(), anU);
|
theTarget.Element().setAttribute(::LastIndexString(), anU);
|
||||||
if (anU >= 1)
|
// Allocation of 1 char for each boolean value + a space.
|
||||||
|
NCollection_LocalArray<Standard_Character> str(2 * anU + 1);
|
||||||
|
if(anU == 0) str[0] = 0;
|
||||||
|
else if (anU >= 1)
|
||||||
{
|
{
|
||||||
// Allocation of 1 char for each boolean value + a space.
|
Standard_Integer iChar(0);
|
||||||
Standard_Integer iChar = 0;
|
|
||||||
NCollection_LocalArray<Standard_Character> str(2 * anU + 1);
|
|
||||||
TDataStd_ListIteratorOfListOfByte itr(aBooleanList->List());
|
TDataStd_ListIteratorOfListOfByte itr(aBooleanList->List());
|
||||||
for (; itr.More(); itr.Next())
|
for (; itr.More(); itr.Next())
|
||||||
{
|
{
|
||||||
const Standard_Byte& byte = itr.Value();
|
const Standard_Byte& byte = itr.Value();
|
||||||
iChar += Sprintf(&(str[iChar]), "%d ", byte);
|
iChar += Sprintf(&(str[iChar]), "%d ", byte);
|
||||||
}
|
}
|
||||||
XmlObjMgt::SetStringValue (theTarget, (Standard_Character*)str, Standard_True);
|
|
||||||
}
|
}
|
||||||
|
XmlObjMgt::SetStringValue (theTarget, (Standard_Character*)str, Standard_True);
|
||||||
}
|
}
|
||||||
|
@@ -79,7 +79,8 @@ Standard_Boolean XmlMDataStd_ExtStringListDriver::Paste(const XmlObjMgt_Persiste
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(TDataStd_ExtStringList) anExtStringList = Handle(TDataStd_ExtStringList)::DownCast(theTarget);
|
if(aLastInd == 0) return Standard_True;
|
||||||
|
const Handle(TDataStd_ExtStringList) anExtStringList = Handle(TDataStd_ExtStringList)::DownCast(theTarget);
|
||||||
|
|
||||||
if (!anElement.hasChildNodes())
|
if (!anElement.hasChildNodes())
|
||||||
{
|
{
|
||||||
@@ -114,7 +115,7 @@ void XmlMDataStd_ExtStringListDriver::Paste(const Handle(TDF_Attribute)& theSour
|
|||||||
XmlObjMgt_Persistent& theTarget,
|
XmlObjMgt_Persistent& theTarget,
|
||||||
XmlObjMgt_SRelocationTable& ) const
|
XmlObjMgt_SRelocationTable& ) const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_ExtStringList) anExtStringList = Handle(TDataStd_ExtStringList)::DownCast(theSource);
|
const Handle(TDataStd_ExtStringList) anExtStringList = Handle(TDataStd_ExtStringList)::DownCast(theSource);
|
||||||
|
|
||||||
Standard_Integer anU = anExtStringList->Extent();
|
Standard_Integer anU = anExtStringList->Extent();
|
||||||
XmlObjMgt_Element& anElement = theTarget;
|
XmlObjMgt_Element& anElement = theTarget;
|
||||||
|
@@ -77,8 +77,9 @@ Standard_Boolean XmlMDataStd_IntegerListDriver::Paste(const XmlObjMgt_Persistent
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(TDataStd_IntegerList) anIntList = Handle(TDataStd_IntegerList)::DownCast(theTarget);
|
const Handle(TDataStd_IntegerList) anIntList = Handle(TDataStd_IntegerList)::DownCast(theTarget);
|
||||||
if (aFirstInd == aLastInd)
|
if(aLastInd == 0) aFirstInd = 0;
|
||||||
|
if (aFirstInd == aLastInd && aLastInd > 0)
|
||||||
{
|
{
|
||||||
Standard_Integer anInteger;
|
Standard_Integer anInteger;
|
||||||
if (!XmlObjMgt::GetStringValue(anElement).GetInteger(anInteger))
|
if (!XmlObjMgt::GetStringValue(anElement).GetInteger(anInteger))
|
||||||
@@ -91,7 +92,7 @@ Standard_Boolean XmlMDataStd_IntegerListDriver::Paste(const XmlObjMgt_Persistent
|
|||||||
}
|
}
|
||||||
anIntList->Append(anInteger);
|
anIntList->Append(anInteger);
|
||||||
}
|
}
|
||||||
else
|
else if(aLastInd >= 1)
|
||||||
{
|
{
|
||||||
Standard_CString aValueStr = Standard_CString(XmlObjMgt::GetStringValue(anElement).GetString());
|
Standard_CString aValueStr = Standard_CString(XmlObjMgt::GetStringValue(anElement).GetString());
|
||||||
for (ind = aFirstInd; ind <= aLastInd; ind++)
|
for (ind = aFirstInd; ind <= aLastInd; ind++)
|
||||||
@@ -120,24 +121,25 @@ void XmlMDataStd_IntegerListDriver::Paste(const Handle(TDF_Attribute)& theSource
|
|||||||
XmlObjMgt_Persistent& theTarget,
|
XmlObjMgt_Persistent& theTarget,
|
||||||
XmlObjMgt_SRelocationTable& ) const
|
XmlObjMgt_SRelocationTable& ) const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_IntegerList) anIntList = Handle(TDataStd_IntegerList)::DownCast(theSource);
|
const Handle(TDataStd_IntegerList) anIntList = Handle(TDataStd_IntegerList)::DownCast(theSource);
|
||||||
|
|
||||||
Standard_Integer anU = anIntList->Extent();
|
Standard_Integer anU = anIntList->Extent();
|
||||||
theTarget.Element().setAttribute(::LastIndexString(), anU);
|
theTarget.Element().setAttribute(::LastIndexString(), anU);
|
||||||
if (anU >= 1)
|
NCollection_LocalArray<Standard_Character> str(12 * anU + 1);
|
||||||
|
if(anU == 0)
|
||||||
|
str[0] = 0;
|
||||||
|
else if (anU >= 1)
|
||||||
{
|
{
|
||||||
// Allocation of 12 chars for each integer including the space.
|
// Allocation of 12 chars for each integer including the space.
|
||||||
// An example: -2 147 483 648
|
// An example: -2 147 483 648
|
||||||
Standard_Integer iChar = 0;
|
Standard_Integer iChar = 0;
|
||||||
NCollection_LocalArray<Standard_Character> str(12 * anU + 1);
|
|
||||||
TColStd_ListIteratorOfListOfInteger itr(anIntList->List());
|
TColStd_ListIteratorOfListOfInteger itr(anIntList->List());
|
||||||
for (; itr.More(); itr.Next())
|
for (; itr.More(); itr.Next())
|
||||||
{
|
{
|
||||||
const Standard_Integer& intValue = itr.Value();
|
const Standard_Integer& intValue = itr.Value();
|
||||||
iChar += Sprintf(&(str[iChar]), "%d ", intValue);
|
iChar += Sprintf(&(str[iChar]), "%d ", intValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// No occurrence of '&', '<' and other irregular XML characters
|
|
||||||
XmlObjMgt::SetStringValue (theTarget, (Standard_Character*)str, Standard_True);
|
|
||||||
}
|
}
|
||||||
|
// No occurrence of '&', '<' and other irregular XML characters
|
||||||
|
XmlObjMgt::SetStringValue (theTarget, (Standard_Character*)str, Standard_True);
|
||||||
}
|
}
|
||||||
|
@@ -78,13 +78,13 @@ Standard_Boolean XmlMDataStd_RealListDriver::Paste(const XmlObjMgt_Persistent&
|
|||||||
return Standard_False;
|
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
|
// Check the type of LDOMString
|
||||||
const XmlObjMgt_DOMString& aString = XmlObjMgt::GetStringValue(anElement);
|
const XmlObjMgt_DOMString& aString = XmlObjMgt::GetStringValue(anElement);
|
||||||
|
if(aLastInd == 0) aFirstInd = 0;
|
||||||
if (aString.Type() == LDOMBasicString::LDOM_Integer)
|
if (aString.Type() == LDOMBasicString::LDOM_Integer)
|
||||||
{
|
{
|
||||||
if (aFirstInd == aLastInd)
|
if (aFirstInd == aLastInd && aLastInd > 0)
|
||||||
{
|
{
|
||||||
Standard_Integer anIntValue;
|
Standard_Integer anIntValue;
|
||||||
if (aString.GetInteger(anIntValue))
|
if (aString.GetInteger(anIntValue))
|
||||||
@@ -100,7 +100,7 @@ Standard_Boolean XmlMDataStd_RealListDriver::Paste(const XmlObjMgt_Persistent&
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if(aLastInd >= 1)
|
||||||
{
|
{
|
||||||
Standard_CString aValueStr = Standard_CString(aString.GetString());
|
Standard_CString aValueStr = Standard_CString(aString.GetString());
|
||||||
for (ind = aFirstInd; ind <= aLastInd; ind++)
|
for (ind = aFirstInd; ind <= aLastInd; ind++)
|
||||||
@@ -128,22 +128,23 @@ void XmlMDataStd_RealListDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
|||||||
XmlObjMgt_Persistent& theTarget,
|
XmlObjMgt_Persistent& theTarget,
|
||||||
XmlObjMgt_SRelocationTable& ) const
|
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();
|
Standard_Integer anU = aRealList->Extent();
|
||||||
theTarget.Element().setAttribute(::LastIndexString(), anU);
|
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:
|
NCollection_LocalArray<Standard_Character> str(25 * anU + 1);
|
||||||
// An example: -3.1512678732195273e+020
|
if(anU == 0) str[0] = 0;
|
||||||
|
else if (anU >= 1)
|
||||||
|
{
|
||||||
Standard_Integer iChar = 0;
|
Standard_Integer iChar = 0;
|
||||||
NCollection_LocalArray<Standard_Character> str(25 * anU + 1);
|
|
||||||
TColStd_ListIteratorOfListOfReal itr(aRealList->List());
|
TColStd_ListIteratorOfListOfReal itr(aRealList->List());
|
||||||
for (; itr.More(); itr.Next())
|
for (; itr.More(); itr.Next())
|
||||||
{
|
{
|
||||||
const Standard_Real& realValue = itr.Value();
|
const Standard_Real& realValue = itr.Value();
|
||||||
iChar += Sprintf(&(str[iChar]), "%.17g ", realValue);
|
iChar += Sprintf(&(str[iChar]), "%.17g ", realValue);
|
||||||
}
|
}
|
||||||
XmlObjMgt::SetStringValue (theTarget, (Standard_Character*)str, Standard_True);
|
|
||||||
}
|
}
|
||||||
|
XmlObjMgt::SetStringValue (theTarget, (Standard_Character*)str, Standard_True);
|
||||||
}
|
}
|
||||||
|
@@ -82,7 +82,8 @@ Standard_Boolean XmlMDataStd_ReferenceListDriver::Paste(const XmlObjMgt_Persiste
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(TDataStd_ReferenceList) aReferenceList = Handle(TDataStd_ReferenceList)::DownCast(theTarget);
|
if(aLastInd == 0) return Standard_True;
|
||||||
|
const Handle(TDataStd_ReferenceList) aReferenceList = Handle(TDataStd_ReferenceList)::DownCast(theTarget);
|
||||||
|
|
||||||
if (!anElement.hasChildNodes())
|
if (!anElement.hasChildNodes())
|
||||||
{
|
{
|
||||||
@@ -107,8 +108,8 @@ Standard_Boolean XmlMDataStd_ReferenceListDriver::Paste(const XmlObjMgt_Persiste
|
|||||||
if (XmlObjMgt::GetTagEntryString (aValueStr, anEntry) == Standard_False)
|
if (XmlObjMgt::GetTagEntryString (aValueStr, anEntry) == Standard_False)
|
||||||
{
|
{
|
||||||
TCollection_ExtendedString aMessage =
|
TCollection_ExtendedString aMessage =
|
||||||
TCollection_ExtendedString ("Cannot retrieve reference from \"")
|
TCollection_ExtendedString ("Cannot retrieve reference from \"")
|
||||||
+ aValueStr + '\"';
|
+ aValueStr + '\"';
|
||||||
WriteMessage (aMessage);
|
WriteMessage (aMessage);
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@@ -134,8 +135,8 @@ Standard_Boolean XmlMDataStd_ReferenceListDriver::Paste(const XmlObjMgt_Persiste
|
|||||||
if (XmlObjMgt::GetTagEntryString (aValueStr, anEntry) == Standard_False)
|
if (XmlObjMgt::GetTagEntryString (aValueStr, anEntry) == Standard_False)
|
||||||
{
|
{
|
||||||
TCollection_ExtendedString aMessage =
|
TCollection_ExtendedString aMessage =
|
||||||
TCollection_ExtendedString ("Cannot retrieve reference from \"")
|
TCollection_ExtendedString ("Cannot retrieve reference from \"")
|
||||||
+ aValueStr + '\"';
|
+ aValueStr + '\"';
|
||||||
WriteMessage (aMessage);
|
WriteMessage (aMessage);
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
@@ -158,7 +159,7 @@ void XmlMDataStd_ReferenceListDriver::Paste(const Handle(TDF_Attribute)& theSour
|
|||||||
XmlObjMgt_Persistent& theTarget,
|
XmlObjMgt_Persistent& theTarget,
|
||||||
XmlObjMgt_SRelocationTable& ) const
|
XmlObjMgt_SRelocationTable& ) const
|
||||||
{
|
{
|
||||||
Handle(TDataStd_ReferenceList) aReferenceList = Handle(TDataStd_ReferenceList)::DownCast(theSource);
|
const Handle(TDataStd_ReferenceList) aReferenceList = Handle(TDataStd_ReferenceList)::DownCast(theSource);
|
||||||
TDF_Label L = aReferenceList->Label();
|
TDF_Label L = aReferenceList->Label();
|
||||||
if (L.IsNull())
|
if (L.IsNull())
|
||||||
{
|
{
|
||||||
@@ -169,7 +170,7 @@ void XmlMDataStd_ReferenceListDriver::Paste(const Handle(TDF_Attribute)& theSour
|
|||||||
Standard_Integer anU = aReferenceList->Extent();
|
Standard_Integer anU = aReferenceList->Extent();
|
||||||
XmlObjMgt_Element& anElement = theTarget;
|
XmlObjMgt_Element& anElement = theTarget;
|
||||||
anElement.setAttribute(::LastIndexString(), anU);
|
anElement.setAttribute(::LastIndexString(), anU);
|
||||||
|
if(anU == 0) return;
|
||||||
XmlObjMgt_Document aDoc = anElement.getOwnerDocument().Doc();
|
XmlObjMgt_Document aDoc = anElement.getOwnerDocument().Doc();
|
||||||
|
|
||||||
TDF_ListIteratorOfLabelList itr(aReferenceList->List());
|
TDF_ListIteratorOfLabelList itr(aReferenceList->List());
|
||||||
|
127
tests/bugs/caf/bug25394_1
Executable file
127
tests/bugs/caf/bug25394_1
Executable file
@@ -0,0 +1,127 @@
|
|||||||
|
# =================== OCAF ======================
|
||||||
|
# Standard attributes of List containers (std format)
|
||||||
|
#
|
||||||
|
# Testing purpose: test of set /get & save / restore
|
||||||
|
# of TDataStd_BooleanList, TDataStd_IntegerList
|
||||||
|
# TDataStd_RealList, TDataStd_ExtStringList,
|
||||||
|
# TDataStd_ReferenceList attributes
|
||||||
|
#
|
||||||
|
# ===============================================
|
||||||
|
# Test case: t1 (testing Set /Get attribute with empty list)
|
||||||
|
# 1. create BooleanList attribute with empty list
|
||||||
|
# 2. create IntegerList attribute with empty list
|
||||||
|
# 3. create RealList attribute with empty list
|
||||||
|
# 4. create ExtStringList attribute with empty list
|
||||||
|
# 5. create ReferenceList attribute with empty list
|
||||||
|
# 6. save the Document in external std file
|
||||||
|
# 7. reopen the Document
|
||||||
|
# 8. check the restored attributes at the specified labels
|
||||||
|
# ===============================================
|
||||||
|
|
||||||
|
NewDocument D MDTV-Standard
|
||||||
|
# 1. create BooleanList attribute with empty list
|
||||||
|
set Lab1 [Label D 0:1:1]
|
||||||
|
SetBooleanList D $Lab1
|
||||||
|
set info1 [GetBooleanList D $Lab1]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
# 2. create IntegerList attribute with empty list
|
||||||
|
set Lab2 [Label D 0:1:2]
|
||||||
|
SetIntegerList D $Lab2
|
||||||
|
set info2 [GetIntegerList D $Lab2]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
# 3. create RealList attribute with empty list
|
||||||
|
set Lab3 [Label D 0:1:3]
|
||||||
|
SetRealList D $Lab3
|
||||||
|
set info3 [GetRealList D $Lab3]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
# 4. create ExtStringList attribute with empty list
|
||||||
|
set Lab4 [Label D 0:1:4]
|
||||||
|
SetExtStringList D $Lab4
|
||||||
|
set info4 [GetExtStringList D $Lab4]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
# 5. create ReferenceList attribute with empty list
|
||||||
|
set Lab5 [Label D 0:1:5]
|
||||||
|
SetReferenceList D $Lab5
|
||||||
|
set info5 [GetReferenceList D $Lab5]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
# 6. save the Document in external file
|
||||||
|
SaveAs D ${imagedir}/bug26014_test1.std
|
||||||
|
Close D
|
||||||
|
|
||||||
|
# 7. reopen the Document
|
||||||
|
Open ${imagedir}/bug26014_test1.std D
|
||||||
|
|
||||||
|
# 8. Check the restored attributes at the specified labels
|
||||||
|
set info8 [GetBooleanList D $Lab1]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
set info9 [GetIntegerList D $Lab2]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
set info10 [GetRealList D $Lab3]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
set info11 [GetExtStringList D $Lab4]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
set info12 [GetReferenceList D $Lab5]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
Close D
|
||||||
|
|
||||||
|
if { [regexp {List is empty} ${info1}] } {
|
||||||
|
puts "OK: created BooleanList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: created BooleanList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info2}] } {
|
||||||
|
puts "OK: created IntegerList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: created IntegerList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info3}] } {
|
||||||
|
puts "OK: created RealList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: created RealList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info4}] } {
|
||||||
|
puts "OK: created ExtStringList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: created ExtStringList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info5}] } {
|
||||||
|
puts "OK: created ReferenceList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: created ReferenceList attribute is bad"
|
||||||
|
}
|
||||||
|
|
||||||
|
if { [regexp {List is empty} ${info8}] } {
|
||||||
|
puts "OK: restored BooleanList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: restored BooleanList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info9}] } {
|
||||||
|
puts "OK: restored IntegerList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: restored IntegerList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info10}] } {
|
||||||
|
puts "OK: restored RealList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: restored RealList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info11}] } {
|
||||||
|
puts "OK: restored ExtStringList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: restored ExtStringList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info12}] } {
|
||||||
|
puts "OK: restored ReferenceList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: restored ReferenceList attribute is bad"
|
||||||
|
}
|
127
tests/bugs/caf/bug25394_2
Executable file
127
tests/bugs/caf/bug25394_2
Executable file
@@ -0,0 +1,127 @@
|
|||||||
|
# =================== OCAF ======================
|
||||||
|
# Standard attributes of List containers (bin format)
|
||||||
|
#
|
||||||
|
# Testing purpose: test of set /get & save / restore
|
||||||
|
# of TDataStd_BooleanList, TDataStd_IntegerList
|
||||||
|
# TDataStd_RealList, TDataStd_ExtStringList,
|
||||||
|
# TDataStd_ReferenceList attributes
|
||||||
|
#
|
||||||
|
# ===============================================
|
||||||
|
# Test case: t2 (testing Set /Get attribute with empty list)
|
||||||
|
# 1. create BooleanList attribute with empty list
|
||||||
|
# 2. create IntegerList attribute with empty list
|
||||||
|
# 3. create RealList attribute with empty list
|
||||||
|
# 4. create ExtStringList attribute with empty list
|
||||||
|
# 5. create ReferenceList attribute with empty list
|
||||||
|
# 6. save the Document in external cbf file
|
||||||
|
# 7. reopen the Document
|
||||||
|
# 8. check the restored attributes at the specified labels
|
||||||
|
# ===============================================
|
||||||
|
|
||||||
|
NewDocument D BinOcaf
|
||||||
|
# 1. create BooleanList attribute with empty list
|
||||||
|
set Lab1 [Label D 0:1:1]
|
||||||
|
SetBooleanList D $Lab1
|
||||||
|
set info1 [GetBooleanList D $Lab1]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
# 2. create IntegerList attribute with empty list
|
||||||
|
set Lab2 [Label D 0:1:2]
|
||||||
|
SetIntegerList D $Lab2
|
||||||
|
set info2 [GetIntegerList D $Lab2]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
# 3. create RealList attribute with empty list
|
||||||
|
set Lab3 [Label D 0:1:3]
|
||||||
|
SetRealList D $Lab3
|
||||||
|
set info3 [GetRealList D $Lab3]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
# 4. create ExtStringList attribute with empty list
|
||||||
|
set Lab4 [Label D 0:1:4]
|
||||||
|
SetExtStringList D $Lab4
|
||||||
|
set info4 [GetExtStringList D $Lab4]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
# 5. create ReferenceList attribute with empty list
|
||||||
|
set Lab5 [Label D 0:1:5]
|
||||||
|
SetReferenceList D $Lab5
|
||||||
|
set info5 [GetReferenceList D $Lab5]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
# 6. save the Document in external file
|
||||||
|
SaveAs D ${imagedir}/bug26014_test2.cbf
|
||||||
|
Close D
|
||||||
|
|
||||||
|
# 7. reopen the Document
|
||||||
|
Open ${imagedir}/bug26014_test2.cbf D
|
||||||
|
|
||||||
|
# 8. Check the restored attributes at the specified labels
|
||||||
|
set info8 [GetBooleanList D $Lab1]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
set info9 [GetIntegerList D $Lab2]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
set info10 [GetRealList D $Lab3]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
set info11 [GetExtStringList D $Lab4]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
set info12 [GetReferenceList D $Lab5]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
Close D
|
||||||
|
|
||||||
|
if { [regexp {List is empty} ${info1}] } {
|
||||||
|
puts "OK: created BooleanList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: created BooleanList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info2}] } {
|
||||||
|
puts "OK: created IntegerList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: created IntegerList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info3}] } {
|
||||||
|
puts "OK: created RealList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: created RealList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info4}] } {
|
||||||
|
puts "OK: created ExtStringList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: created ExtStringList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info5}] } {
|
||||||
|
puts "OK: created ReferenceList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: created ReferenceList attribute is bad"
|
||||||
|
}
|
||||||
|
|
||||||
|
if { [regexp {List is empty} ${info8}] } {
|
||||||
|
puts "OK: restored BooleanList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: restored BooleanList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info9}] } {
|
||||||
|
puts "OK: restored IntegerList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: restored IntegerList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info10}] } {
|
||||||
|
puts "OK: restored RealList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: restored RealList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info11}] } {
|
||||||
|
puts "OK: restored ExtStringList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: restored ExtStringList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info12}] } {
|
||||||
|
puts "OK: restored ReferenceList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: restored ReferenceList attribute is bad"
|
||||||
|
}
|
127
tests/bugs/caf/bug25394_3
Executable file
127
tests/bugs/caf/bug25394_3
Executable file
@@ -0,0 +1,127 @@
|
|||||||
|
# =================== OCAF ======================
|
||||||
|
# Standard attributes of List containers (xml format)
|
||||||
|
#
|
||||||
|
# Testing purpose: test of set /get & save / restore
|
||||||
|
# of TDataStd_BooleanList, TDataStd_IntegerList
|
||||||
|
# TDataStd_RealList, TDataStd_ExtStringList,
|
||||||
|
# TDataStd_ReferenceList attributes
|
||||||
|
#
|
||||||
|
# ===============================================
|
||||||
|
# Test case: t2 (testing Set /Get attribute with empty list)
|
||||||
|
# 1. create BooleanList attribute with empty list
|
||||||
|
# 2. create IntegerList attribute with empty list
|
||||||
|
# 3. create RealList attribute with empty list
|
||||||
|
# 4. create ExtStringList attribute with empty list
|
||||||
|
# 5. create ReferenceList attribute with empty list
|
||||||
|
# 6. save the Document in external xml file
|
||||||
|
# 7. reopen the Document
|
||||||
|
# 8. check the restored attributes at the specified labels
|
||||||
|
# ===============================================
|
||||||
|
|
||||||
|
NewDocument D XmlOcaf
|
||||||
|
# 1. create BooleanList attribute with empty list
|
||||||
|
set Lab1 [Label D 0:1:1]
|
||||||
|
SetBooleanList D $Lab1
|
||||||
|
set info1 [GetBooleanList D $Lab1]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
# 2. create IntegerList attribute with empty list
|
||||||
|
set Lab2 [Label D 0:1:2]
|
||||||
|
SetIntegerList D $Lab2
|
||||||
|
set info2 [GetIntegerList D $Lab2]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
# 3. create RealList attribute with empty list
|
||||||
|
set Lab3 [Label D 0:1:3]
|
||||||
|
SetRealList D $Lab3
|
||||||
|
set info3 [GetRealList D $Lab3]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
# 4. create ExtStringList attribute with empty list
|
||||||
|
set Lab4 [Label D 0:1:4]
|
||||||
|
SetExtStringList D $Lab4
|
||||||
|
set info4 [GetExtStringList D $Lab4]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
# 5. create ReferenceList attribute with empty list
|
||||||
|
set Lab5 [Label D 0:1:5]
|
||||||
|
SetReferenceList D $Lab5
|
||||||
|
set info5 [GetReferenceList D $Lab5]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
# 6. save the Document in external file
|
||||||
|
SaveAs D ${imagedir}/bug26014_test3.xml
|
||||||
|
Close D
|
||||||
|
|
||||||
|
# 7. reopen the Document
|
||||||
|
Open ${imagedir}/bug26014_test3.xml D
|
||||||
|
|
||||||
|
# 8. Check the restored attributes at the specified labels
|
||||||
|
set info8 [GetBooleanList D $Lab1]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
set info9 [GetIntegerList D $Lab2]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
set info10 [GetRealList D $Lab3]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
set info11 [GetExtStringList D $Lab4]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
set info12 [GetReferenceList D $Lab5]
|
||||||
|
# output => "List is empty"
|
||||||
|
|
||||||
|
Close D
|
||||||
|
|
||||||
|
if { [regexp {List is empty} ${info1}] } {
|
||||||
|
puts "OK: created BooleanList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: created BooleanList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info2}] } {
|
||||||
|
puts "OK: created IntegerList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: created IntegerList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info3}] } {
|
||||||
|
puts "OK: created RealList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: created RealList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info4}] } {
|
||||||
|
puts "OK: created ExtStringList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: created ExtStringList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info5}] } {
|
||||||
|
puts "OK: created ReferenceList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: created ReferenceList attribute is bad"
|
||||||
|
}
|
||||||
|
|
||||||
|
if { [regexp {List is empty} ${info8}] } {
|
||||||
|
puts "OK: restored BooleanList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: restored BooleanList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info9}] } {
|
||||||
|
puts "OK: restored IntegerList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: restored IntegerList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info10}] } {
|
||||||
|
puts "OK: restored RealList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: restored RealList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info11}] } {
|
||||||
|
puts "OK: restored ExtStringList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: restored ExtStringList attribute is bad"
|
||||||
|
}
|
||||||
|
if { [regexp {List is empty} ${info12}] } {
|
||||||
|
puts "OK: restored ReferenceList attribute is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: restored ReferenceList attribute is bad"
|
||||||
|
}
|
Reference in New Issue
Block a user