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
Standard_Integer aIndex, aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
return Standard_False;
+ if(aLastInd == 0) return Standard_True;
+
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
if (aLength <= 0)
return Standard_False;
-
TColStd_Array1OfByte aTargetArray(aFirstInd, aLastInd);
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++)
{
anAtt->Append(aTargetArray.Value(aIndex) ? Standard_True : Standard_False);
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& ) const
{
- Handle(TDataStd_BooleanList) anAtt = Handle(TDataStd_BooleanList)::DownCast(theSource);
- const Standard_Integer aFirstInd = 1;
- const Standard_Integer aLastInd = anAtt->Extent();
+ const Handle(TDataStd_BooleanList) anAtt = Handle(TDataStd_BooleanList)::DownCast(theSource);
+ const Standard_Integer aFirstInd = (anAtt->Extent()> 0) ? 1 : 0;
+ const Standard_Integer aLastInd(anAtt->Extent());
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
- if (aLength <= 0)
- return;
+ if (aLength <= 0) return;
theTarget << aFirstInd << aLastInd;
+ if(aLastInd == 0) return;
TColStd_Array1OfByte aSourceArray(aFirstInd, aLastInd);
- if (aLastInd >= 1)
- {
- TDataStd_ListIteratorOfListOfByte itr(anAtt->List());
- 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);
+ TDataStd_ListIteratorOfListOfByte itr(anAtt->List());
+ 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);
}
//function : Paste
//purpose : persistent -> transient (retrieve)
//=======================================================================
-Standard_Boolean BinMDataStd_ExtStringListDriver::Paste(const BinObjMgt_Persistent& theSource,
- const Handle(TDF_Attribute)& theTarget,
- BinObjMgt_RRelocationTable& ) const
+Standard_Boolean BinMDataStd_ExtStringListDriver::Paste
+ (const BinObjMgt_Persistent& theSource,
+ const Handle(TDF_Attribute)& theTarget,
+ BinObjMgt_RRelocationTable& ) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
return Standard_False;
+ if(aLastInd == 0) return Standard_True;
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
if (aLength <= 0)
return Standard_False;
-
- Handle(TDataStd_ExtStringList) anAtt = Handle(TDataStd_ExtStringList)::DownCast(theTarget);
+ const Handle(TDataStd_ExtStringList) anAtt =
+ Handle(TDataStd_ExtStringList)::DownCast(theTarget);
for (Standard_Integer i = aFirstInd; i <= aLastInd; i ++)
{
TCollection_ExtendedString aStr;
//function : Paste
//purpose : transient -> persistent (store)
//=======================================================================
-void BinMDataStd_ExtStringListDriver::Paste(const Handle(TDF_Attribute)& theSource,
- BinObjMgt_Persistent& theTarget,
- BinObjMgt_SRelocationTable& ) const
+void BinMDataStd_ExtStringListDriver::Paste
+ (const Handle(TDF_Attribute)& theSource,
+ BinObjMgt_Persistent& theTarget,
+ BinObjMgt_SRelocationTable& ) const
{
- Handle(TDataStd_ExtStringList) anAtt = Handle(TDataStd_ExtStringList)::DownCast(theSource);
- const Standard_Integer aFirstInd = 1;
- const Standard_Integer aLastInd = anAtt->Extent();
+ const Handle(TDataStd_ExtStringList) anAtt =
+ Handle(TDataStd_ExtStringList)::DownCast(theSource);
+ const Standard_Integer aFirstInd = (anAtt->Extent()> 0) ? 1 : 0;
+ const Standard_Integer aLastInd(anAtt->Extent());
theTarget << aFirstInd << aLastInd;
TDataStd_ListIteratorOfListOfExtendedString itr(anAtt->List());
for (; itr.More(); itr.Next())
Standard_Integer aIndex, aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
return Standard_False;
+ if(aLastInd == 0) return Standard_True;
+
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
if (aLength <= 0)
return Standard_False;
TColStd_Array1OfInteger aTargetArray(aFirstInd, aLastInd);
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++)
{
anAtt->Append(aTargetArray.Value(aIndex));
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& ) const
{
- Handle(TDataStd_IntegerList) anAtt = Handle(TDataStd_IntegerList)::DownCast(theSource);
- const Standard_Integer aFirstInd = 1;
- const Standard_Integer aLastInd = anAtt->Extent();
+ const Handle(TDataStd_IntegerList) anAtt = Handle(TDataStd_IntegerList)::DownCast(theSource);
+ const Standard_Integer aFirstInd = (anAtt->Extent()> 0) ? 1 : 0;
+ const Standard_Integer aLastInd(anAtt->Extent());
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
if (aLength <= 0)
return;
theTarget << aFirstInd << aLastInd;
+ if(aLastInd == 0) return;
TColStd_Array1OfInteger aSourceArray(aFirstInd, aLastInd);
if (aLastInd >= 1)
{
Standard_Integer aIndex, aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
return Standard_False;
+ if(aLastInd == 0) return Standard_True;
+
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
if (aLength <= 0)
return Standard_False;
TColStd_Array1OfReal aTargetArray(aFirstInd, aLastInd);
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++)
{
anAtt->Append(aTargetArray.Value(aIndex));
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& ) const
{
- Handle(TDataStd_RealList) anAtt = Handle(TDataStd_RealList)::DownCast(theSource);
- const Standard_Integer aFirstInd = 1;
- const Standard_Integer aLastInd = anAtt->Extent();
+ const Handle(TDataStd_RealList) anAtt = Handle(TDataStd_RealList)::DownCast(theSource);
+ const Standard_Integer aFirstInd = (anAtt->Extent()> 0) ? 1 : 0;
+ const Standard_Integer aLastInd(anAtt->Extent());
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
if (aLength <= 0)
return;
theTarget << aFirstInd << aLastInd;
+ if(aLastInd == 0) return;
TColStd_Array1OfReal aSourceArray(aFirstInd, aLastInd);
if (aLastInd >= 1)
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
return Standard_False;
+ if(aLastInd == 0) return Standard_True;
+
const Standard_Integer aLength = aLastInd - aFirstInd + 1;
if (aLength <= 0)
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++)
{
TCollection_AsciiString entry;
BinObjMgt_Persistent& theTarget,
BinObjMgt_SRelocationTable& ) const
{
- Handle(TDataStd_ReferenceList) anAtt = Handle(TDataStd_ReferenceList)::DownCast(theSource);
- if (anAtt->IsEmpty())
+ const Handle(TDataStd_ReferenceList) anAtt = Handle(TDataStd_ReferenceList)::DownCast(theSource);
+ if (anAtt.IsNull())
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;
+ if(aLastInd == 0) return;
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();
if (!L.IsNull())
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfReal.hxx>
#include <TDataStd_ReferenceArray.hxx>
+#include <TDataStd_ExtStringList.hxx>
+#include <TDataStd_ReferenceList.hxx>
+#include <TDF_ListIteratorOfLabelList.hxx>
+#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
//=======================================================================
//function : DDataStd_SetInteger
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 : GetBooleanList (DF, entry )
//=======================================================================
static Standard_Integer DDataStd_GetBooleanList (Draw_Interpretor& di,
- Standard_Integer,
+ Standard_Integer nb,
const char** arg)
{
- Handle(TDF_Data) DF;
- if (!DDF::GetDF(arg[1],DF))
+ 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;
- }
+ TDF_Label label;
+ if ( !DDF::FindLabel(DF, arg[2], label) )
+ {
+ di << "No label for entry" << "\n";
+ return 1;
+ }
- Handle(TDataStd_BooleanList) A;
- if ( !label.FindAttribute(TDataStd_BooleanList::GetID(), A) )
- {
- di << "There is no TDataStd_BooleanList at label" << "\n";
- return 1;
- }
+ Handle(TDataStd_BooleanList) A;
+ if ( !label.FindAttribute(TDataStd_BooleanList::GetID(), A) )
+ {
+ di << "There is no TDataStd_BooleanList at label" << "\n";
+ return 1;
+ }
- const TDataStd_ListOfByte& bList = A->List();
- TDataStd_ListIteratorOfListOfByte itr(bList);
- for (; itr.More(); itr.Next())
- {
- di << (Standard_Integer) itr.Value() << " ";
+ const TDataStd_ListOfByte& bList = A->List();
+ Standard_Boolean isEmpty = (bList.Extent() > 0) ? Standard_False : Standard_True;
+ if(!isEmpty) {
+ TDataStd_ListIteratorOfListOfByte itr(bList);
+ for (; itr.More(); itr.Next())
+ {
+ di << (Standard_Integer) itr.Value() << " ";
+ }
+ di << "\n";
+ } else
+ di << "List is empty" << "\n";
+ return 0;
}
- di << "\n";
- return 0;
+ di << "DDataStd_GetBooleanList: Error" << "\n";
+ return 1;
}
//=======================================================================
//function : GetIntegerList (DF, entry )
//=======================================================================
static Standard_Integer DDataStd_GetIntegerList (Draw_Interpretor& di,
- Standard_Integer,
+ Standard_Integer nb,
const char** arg)
-{
- Handle(TDF_Data) DF;
- if (!DDF::GetDF(arg[1],DF))
+{
+ 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;
- }
+ TDF_Label label;
+ if ( !DDF::FindLabel(DF, arg[2], label) )
+ {
+ di << "No label for entry" << "\n";
+ return 1;
+ }
- Handle(TDataStd_IntegerList) A;
- if ( !label.FindAttribute(TDataStd_IntegerList::GetID(), A) )
- {
- di << "There is no TDataStd_IntegerList at label" << "\n";
- return 1;
- }
+ Handle(TDataStd_IntegerList) A;
+ if ( !label.FindAttribute(TDataStd_IntegerList::GetID(), A) )
+ {
+ di << "There is no TDataStd_IntegerList at label" << "\n";
+ return 1;
+ }
- const TColStd_ListOfInteger& iList = A->List();
- TColStd_ListIteratorOfListOfInteger itr(iList);
- for (; itr.More(); itr.Next())
- {
- di << itr.Value() << " ";
+ const TColStd_ListOfInteger& iList = A->List();
+ Standard_Boolean isEmpty = (iList.Extent() > 0) ? Standard_False : Standard_True;
+ if(!isEmpty) {
+ TColStd_ListIteratorOfListOfInteger itr(iList);
+ for (; itr.More(); itr.Next())
+ {
+ di << itr.Value() << " ";
+ }
+ di << "\n";
+ } else
+ di << "List is empty" << "\n";
+
+ return 0;
}
- di << "\n";
- return 0;
+ di << "DDataStd_GetIntegerList: Error" << "\n";
+ return 1;
}
//=======================================================================
//function : GetRealList (DF, entry )
//=======================================================================
static Standard_Integer DDataStd_GetRealList (Draw_Interpretor& di,
- Standard_Integer,
+ Standard_Integer nb,
const char** arg)
{
- Handle(TDF_Data) DF;
- if (!DDF::GetDF(arg[1],DF))
+ 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;
- }
+ TDF_Label label;
+ if ( !DDF::FindLabel(DF, arg[2], label) )
+ {
+ di << "No label for entry" << "\n";
+ return 1;
+ }
- Handle(TDataStd_RealList) A;
- if ( !label.FindAttribute(TDataStd_RealList::GetID(), A) )
- {
- di << "There is no TDataStd_RealList at label" << "\n";
- return 1;
- }
+ Handle(TDataStd_RealList) A;
+ if ( !label.FindAttribute(TDataStd_RealList::GetID(), A) )
+ {
+ di << "There is no TDataStd_RealList at label" << "\n";
+ return 1;
+ }
- const TColStd_ListOfReal& iList = A->List();
- TColStd_ListIteratorOfListOfReal itr(iList);
- for (; itr.More(); itr.Next())
- {
- di << itr.Value() << " ";
+ const TColStd_ListOfReal& rList = A->List();
+ Standard_Boolean isEmpty = (rList.Extent() > 0) ? Standard_False : Standard_True;
+ if(!isEmpty) {
+ TColStd_ListIteratorOfListOfReal itr(rList);
+ for (; itr.More(); itr.Next())
+ {
+ di << itr.Value() << " ";
+ }
+ di << "\n";
+ } else
+ di << "List is empty" << "\n";
+ return 0;
}
- di << "\n";
- return 0;
+ di << "DDataStd_GetRealList: Error" << "\n";
+ 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, ...
//=======================================================================
"SetRealList (DF, entry, elmt1, elmt2, ... )",
__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
"GetRealList (DF, entry )",
__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 =====================================
const char* ggg = "UTF Commands";
const Handle(TDF_Attribute)& Target,
const Handle(MDF_RRelocationTable)& ) const
{
- Handle(PDataStd_BooleanList) S = Handle(PDataStd_BooleanList)::DownCast (Source);
- Handle(TDataStd_BooleanList) T = Handle(TDataStd_BooleanList)::DownCast (Target);
-
- Standard_Integer i, lower = S->Lower(), upper = S->Upper();
- for (i = lower; i <= upper; i++)
- {
- T->Append(S->Value(i));
+ const Handle(PDataStd_BooleanList) S = Handle(PDataStd_BooleanList)::DownCast (Source);
+ const Handle(TDataStd_BooleanList) T = Handle(TDataStd_BooleanList)::DownCast (Target);
+ if(!S.IsNull()) {
+ Standard_Integer i, lower = S->Lower(), upper = S->Upper();
+ if(upper > 0)
+ for (i = lower; i <= upper; i++) {
+ T->Append(S->Value(i));
+ }
}
}
const Handle(PDF_Attribute)& Target,
const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
{
- Handle(TDataStd_BooleanList) S = Handle(TDataStd_BooleanList)::DownCast (Source);
- Handle(PDataStd_BooleanList) T = Handle(PDataStd_BooleanList)::DownCast (Target);
+ const Handle(TDataStd_BooleanList) S = Handle(TDataStd_BooleanList)::DownCast (Source);
+ const Handle(PDataStd_BooleanList) T = Handle(PDataStd_BooleanList)::DownCast (Target);
- Standard_Integer lower = 1, upper = S->Extent(), i = lower;
- if (upper >= lower)
+ Standard_Integer lower(1), upper = S->Extent();
+ if(upper == 0) {
+ lower = 0;
+ T->Init(lower, upper);
+ }
+ else if (upper >= lower)
{
T->Init(lower, upper);
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());
}
}
const Handle(TDF_Attribute)& Target,
const Handle(MDF_RRelocationTable)& ) const
{
- Handle(PDataStd_ExtStringList) S = Handle(PDataStd_ExtStringList)::DownCast (Source);
- Handle(TDataStd_ExtStringList) T = Handle(TDataStd_ExtStringList)::DownCast (Target);
-
+ const Handle(PDataStd_ExtStringList) S = Handle(PDataStd_ExtStringList)::DownCast (Source);
+ const Handle(TDataStd_ExtStringList) T = Handle(TDataStd_ExtStringList)::DownCast (Target);
+ if(S.IsNull()) return;
Standard_Integer i, lower = S->Lower(), upper = S->Upper();
- for (i = lower; i <= upper; i++)
- {
- const Handle(PCollection_HExtendedString)& pvalue = S->Value(i);
- TCollection_ExtendedString tvalue = pvalue->Convert();
- T->Append(tvalue);
- }
+ if(upper > 0)
+ for (i = lower; i <= upper; i++)
+ {
+ const Handle(PCollection_HExtendedString)& pvalue = S->Value(i);
+ TCollection_ExtendedString tvalue = pvalue->Convert();
+ T->Append(tvalue);
+ }
}
const Handle(PDF_Attribute)& Target,
const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
{
- Handle(TDataStd_ExtStringList) S = Handle(TDataStd_ExtStringList)::DownCast (Source);
- Handle(PDataStd_ExtStringList) T = Handle(PDataStd_ExtStringList)::DownCast (Target);
-
- Standard_Integer lower = 1, upper = S->Extent(), i = lower;
- if (upper >= lower)
+ const Handle(TDataStd_ExtStringList) S = Handle(TDataStd_ExtStringList)::DownCast (Source);
+ const Handle(PDataStd_ExtStringList) T = Handle(PDataStd_ExtStringList)::DownCast (Target);
+ if(S.IsNull()) return;
+ Standard_Integer lower(1), upper = S->Extent();
+ if(upper == 0) {
+ lower = 0;
+ T->Init(lower, upper);
+ }
+ else if (upper >= lower)
{
T->Init(lower, upper);
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();
- Handle(PCollection_HExtendedString) pvalue = new PCollection_HExtendedString(tvalue);
+ const Handle(PCollection_HExtendedString)& pvalue = new PCollection_HExtendedString(tvalue);
T->SetValue(i, pvalue);
}
}
const Handle(TDF_Attribute)& Target,
const Handle(MDF_RRelocationTable)& ) const
{
- Handle(PDataStd_IntegerList) S = Handle(PDataStd_IntegerList)::DownCast (Source);
- Handle(TDataStd_IntegerList) T = Handle(TDataStd_IntegerList)::DownCast (Target);
+ const Handle(PDataStd_IntegerList) S = Handle(PDataStd_IntegerList)::DownCast (Source);
+ const Handle(TDataStd_IntegerList) T = Handle(TDataStd_IntegerList)::DownCast (Target);
Standard_Integer i, lower = S->Lower(), upper = S->Upper();
- for (i = lower; i <= upper; i++)
- {
- T->Append(S->Value(i));
- }
+ if(upper > 0)
+ for (i = lower; i <= upper; i++) {
+ T->Append(S->Value(i));
+ }
}
const Handle(PDF_Attribute)& Target,
const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
{
- Handle(TDataStd_IntegerList) S = Handle(TDataStd_IntegerList)::DownCast (Source);
- Handle(PDataStd_IntegerList) T = Handle(PDataStd_IntegerList)::DownCast (Target);
+ const Handle(TDataStd_IntegerList) S = Handle(TDataStd_IntegerList)::DownCast (Source);
+ const Handle(PDataStd_IntegerList) T = Handle(PDataStd_IntegerList)::DownCast (Target);
- Standard_Integer lower = 1, upper = S->Extent(), i = lower;
- if (upper >= lower)
+ Standard_Integer lower(1), upper = S->Extent(), i = lower;
+ if(upper == 0) {
+ lower = 0;
+ T->Init(lower, upper);
+ }
+ else if (upper >= lower)
{
T->Init(lower, upper);
TColStd_ListIteratorOfListOfInteger itr(S->List());
- for (; itr.More(); itr.Next(), i++)
- {
+ for (; itr.More(); itr.Next(), i++) {
T->SetValue(i, itr.Value());
}
}
const Handle(TDF_Attribute)& Target,
const Handle(MDF_RRelocationTable)& ) const
{
- Handle(PDataStd_RealList) S = Handle(PDataStd_RealList)::DownCast (Source);
- Handle(TDataStd_RealList) T = Handle(TDataStd_RealList)::DownCast (Target);
-
- Standard_Integer i, lower = S->Lower(), upper = S->Upper();
- for (i = lower; i <= upper; i++)
- {
- T->Append(S->Value(i));
+ const Handle(PDataStd_RealList) S = Handle(PDataStd_RealList)::DownCast (Source);
+ const Handle(TDataStd_RealList) T = Handle(TDataStd_RealList)::DownCast (Target);
+ if(!S.IsNull()) {
+ Standard_Integer i, lower = S->Lower(), upper = S->Upper();
+ if(upper > 0)
+ for (i = lower; i <= upper; i++) {
+ T->Append(S->Value(i));
+ }
}
}
const Handle(PDF_Attribute)& Target,
const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
{
- Handle(TDataStd_RealList) S = Handle(TDataStd_RealList)::DownCast (Source);
- Handle(PDataStd_RealList) T = Handle(PDataStd_RealList)::DownCast (Target);
+ const Handle(TDataStd_RealList) S = Handle(TDataStd_RealList)::DownCast (Source);
+ const Handle(PDataStd_RealList) T = Handle(PDataStd_RealList)::DownCast (Target);
- Standard_Integer lower = 1, upper = S->Extent(), i = lower;
- if (upper >= lower)
+ Standard_Integer lower(1), upper = S->Extent();
+ if(upper == 0) {
+ lower = 0;
+ T->Init(lower, upper);
+ }
+ else if (upper >= lower)
{
T->Init(lower, upper);
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());
}
}
const Handle(TDF_Attribute)& Target,
const Handle(MDF_RRelocationTable)& ) const
{
- Handle(PDataStd_ReferenceList) S = Handle(PDataStd_ReferenceList)::DownCast (Source);
- Handle(TDataStd_ReferenceList) T = Handle(TDataStd_ReferenceList)::DownCast (Target);
-
+ const Handle(PDataStd_ReferenceList) S = Handle(PDataStd_ReferenceList)::DownCast (Source);
+ const Handle(TDataStd_ReferenceList) T = Handle(TDataStd_ReferenceList)::DownCast (Target);
+ if(S.IsNull()) return;
Standard_Integer i, lower = S->Lower(), upper = S->Upper();
- for (i = lower; i <= upper; i++)
- {
- const Handle(PCollection_HExtendedString)& pvalue = S->Value(i);
- if (!pvalue.IsNull())
+ if(upper > 0)
+ for (i = lower; i <= upper; i++)
{
- TDF_Label L;
- TCollection_AsciiString tvalue = pvalue->Convert();
- TDF_Tool::Label(T->Label().Data(), tvalue, L, Standard_True);
- if (!L.IsNull())
+ const Handle(PCollection_HExtendedString)& pvalue = S->Value(i);
+ if (!pvalue.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);
}
}
- }
}
const Handle(PDF_Attribute)& Target,
const Handle(MDF_SRelocationTable)& /*RelocTable*/) const
{
- Handle(TDataStd_ReferenceList) S = Handle(TDataStd_ReferenceList)::DownCast (Source);
- Handle(PDataStd_ReferenceList) T = Handle(PDataStd_ReferenceList)::DownCast (Target);
-
- Standard_Integer lower = 1, upper = S->Extent(), i = lower;
- if (upper >= lower)
+ const Handle(TDataStd_ReferenceList) S = Handle(TDataStd_ReferenceList)::DownCast (Source);
+ const Handle(PDataStd_ReferenceList) T = Handle(PDataStd_ReferenceList)::DownCast (Target);
+ if(S.IsNull()) return;
+ Standard_Integer lower(1), upper = S->Extent();
+ if(upper == 0) {
+ lower = 0;
+ T->Init(lower, upper);
+ }
+ else if (upper >= lower)
{
T->Init(lower, upper);
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();
if (!L.IsNull())
{
- TCollection_AsciiString tvalue;
- TDF_Tool::Entry(L, tvalue);
- Handle(PCollection_HExtendedString) pvalue = new PCollection_HExtendedString(tvalue);
- T->SetValue(i, pvalue);
+ TCollection_AsciiString tvalue;
+ TDF_Tool::Entry(L, tvalue);
+ const Handle(PCollection_HExtendedString)& pvalue = new PCollection_HExtendedString(tvalue);
+ T->SetValue(i, pvalue);
}
}
}
return Standard_False;
}
- Handle(TDataStd_BooleanList) aBooleanList = Handle(TDataStd_BooleanList)::DownCast(theTarget);
- if (aFirstInd == aLastInd)
+ const Handle(TDataStd_BooleanList) aBooleanList = Handle(TDataStd_BooleanList)::DownCast(theTarget);
+ if(aLastInd == 0) aFirstInd = 0;
+ if (aFirstInd == aLastInd && aLastInd > 0)
{
Standard_Integer anInteger;
if (!XmlObjMgt::GetStringValue(anElement).GetInteger(anInteger))
}
aBooleanList->Append(anInteger ? Standard_True : Standard_False);
}
- else
+ else if(aLastInd >= 1)
{
Standard_CString aValueStr = Standard_CString(XmlObjMgt::GetStringValue(anElement).GetString());
for (ind = aFirstInd; ind <= aLastInd; ind++)
XmlObjMgt_Persistent& theTarget,
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();
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;
- NCollection_LocalArray<Standard_Character> str(2 * anU + 1);
+ Standard_Integer iChar(0);
TDataStd_ListIteratorOfListOfByte itr(aBooleanList->List());
for (; itr.More(); itr.Next())
{
const Standard_Byte& byte = itr.Value();
iChar += Sprintf(&(str[iChar]), "%d ", byte);
}
- XmlObjMgt::SetStringValue (theTarget, (Standard_Character*)str, Standard_True);
}
+ XmlObjMgt::SetStringValue (theTarget, (Standard_Character*)str, Standard_True);
}
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())
{
XmlObjMgt_Persistent& theTarget,
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();
XmlObjMgt_Element& anElement = theTarget;
return Standard_False;
}
- Handle(TDataStd_IntegerList) anIntList = Handle(TDataStd_IntegerList)::DownCast(theTarget);
- if (aFirstInd == aLastInd)
+ const Handle(TDataStd_IntegerList) anIntList = Handle(TDataStd_IntegerList)::DownCast(theTarget);
+ if(aLastInd == 0) aFirstInd = 0;
+ if (aFirstInd == aLastInd && aLastInd > 0)
{
Standard_Integer anInteger;
if (!XmlObjMgt::GetStringValue(anElement).GetInteger(anInteger))
}
anIntList->Append(anInteger);
}
- else
+ else if(aLastInd >= 1)
{
Standard_CString aValueStr = Standard_CString(XmlObjMgt::GetStringValue(anElement).GetString());
for (ind = aFirstInd; ind <= aLastInd; ind++)
XmlObjMgt_Persistent& theTarget,
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();
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.
// An example: -2 147 483 648
Standard_Integer iChar = 0;
- NCollection_LocalArray<Standard_Character> str(12 * anU + 1);
TColStd_ListIteratorOfListOfInteger itr(anIntList->List());
for (; itr.More(); itr.Next())
{
const Standard_Integer& intValue = itr.Value();
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);
}
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))
return Standard_False;
}
}
- else
+ else if(aLastInd >= 1)
{
Standard_CString aValueStr = Standard_CString(aString.GetString());
for (ind = aFirstInd; ind <= aLastInd; ind++)
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);
}
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 (XmlObjMgt::GetTagEntryString (aValueStr, anEntry) == Standard_False)
{
TCollection_ExtendedString aMessage =
- TCollection_ExtendedString ("Cannot retrieve reference from \"")
- + aValueStr + '\"';
+ TCollection_ExtendedString ("Cannot retrieve reference from \"")
+ + aValueStr + '\"';
WriteMessage (aMessage);
return Standard_False;
}
if (XmlObjMgt::GetTagEntryString (aValueStr, anEntry) == Standard_False)
{
TCollection_ExtendedString aMessage =
- TCollection_ExtendedString ("Cannot retrieve reference from \"")
- + aValueStr + '\"';
+ TCollection_ExtendedString ("Cannot retrieve reference from \"")
+ + aValueStr + '\"';
WriteMessage (aMessage);
return Standard_False;
}
XmlObjMgt_Persistent& theTarget,
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();
if (L.IsNull())
{
Standard_Integer anU = aReferenceList->Extent();
XmlObjMgt_Element& anElement = theTarget;
anElement.setAttribute(::LastIndexString(), anU);
-
+ if(anU == 0) return;
XmlObjMgt_Document aDoc = anElement.getOwnerDocument().Doc();
TDF_ListIteratorOfLabelList itr(aReferenceList->List());
--- /dev/null
+# =================== 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"
+}
--- /dev/null
+# =================== 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"
+}
--- /dev/null
+# =================== 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"
+}