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:
@@ -64,12 +64,13 @@ void MDataStd_BooleanListRetrievalDriver::Paste(const Handle(PDF_Attribute)& Sou
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -66,16 +66,19 @@ void MDataStd_BooleanListStorageDriver::Paste(const Handle(TDF_Attribute)& Sour
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
@@ -66,14 +66,15 @@ void MDataStd_ExtStringListRetrievalDriver::Paste(const Handle(PDF_Attribute)& S
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@@ -67,18 +67,22 @@ void MDataStd_ExtStringListStorageDriver::Paste(const Handle(TDF_Attribute)& Sou
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@@ -64,12 +64,12 @@ void MDataStd_IntegerListRetrievalDriver::Paste(const Handle(PDF_Attribute)& Sou
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@@ -66,16 +66,19 @@ void MDataStd_IntegerListStorageDriver::Paste(const Handle(TDF_Attribute)& Sour
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
@@ -64,12 +64,13 @@ void MDataStd_RealListRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -66,16 +66,19 @@ void MDataStd_RealListStorageDriver::Paste(const Handle(TDF_Attribute)& Source,
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
@@ -68,22 +68,21 @@ void MDataStd_ReferenceListRetrievalDriver::Paste(const Handle(PDF_Attribute)& S
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -69,23 +69,27 @@ void MDataStd_ReferenceListStorageDriver::Paste(const Handle(TDF_Attribute)& So
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user