#include <TDataStd_ListIteratorOfListOfByte.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfReal.hxx>
+#include <TDataStd_ReferenceArray.hxx>
//=======================================================================
//function : DDataStd_SetInteger
return 1;
}
+//=======================================================================
+//function : SetRefArray (DF, entry , From, To, elmt1, elmt2, ...
+//=======================================================================
+static Standard_Integer DDataStd_SetRefArray (Draw_Interpretor& di,
+ Standard_Integer,
+ const char** arg)
+{
+
+ Handle(TDF_Data) DF;
+ if (!DDF::GetDF(arg[1],DF)) return 1;
+ TDF_Label label;
+ DDF::AddLabel(DF, arg[2], label);
+
+ Standard_Integer From = Draw::Atoi(arg[3]), To = Draw::Atoi( arg[4] ), j;
+ di << "RefArray with bounds from = " << From << " to = " << To << "\n";
+
+ Handle(TDataStd_ReferenceArray) A = TDataStd_ReferenceArray::Set(label, From, To);
+
+ j = 5;
+ for(Standard_Integer i = From; i<=To; i++) {
+ TDF_Label aRefLabel;
+ DDF::AddLabel(DF, arg[j], aRefLabel);
+ A->SetValue(i, aRefLabel);
+ j++;
+ }
+ return 0;
+}
+//=======================================================================
+//function : GetRefArray (DF, entry )
+//=======================================================================
+static Standard_Integer DDataStd_GetRefArray (Draw_Interpretor& di,
+ Standard_Integer,
+ const char** arg)
+{
+
+ 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_ReferenceArray) A;
+ if ( !label.FindAttribute(TDataStd_ReferenceArray::GetID(), A) ) {
+ di << "There is no TDataStd_ReferenceArray under label" << "\n";
+ return 1;
+ }
+
+ for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
+ const TDF_Label& aLabel = A->Value(i);
+ TCollection_AsciiString entry;
+ TDF_Tool::Entry(aLabel, entry);
+ di << entry.ToCString();
+ if(i<A->Upper())
+ di<<" ";
+ }
+ di<<"\n";
+ return 0;
+}
+
//=======================================================================
//function : BasicCommands
//purpose :
"SetExtStringArray (DF, entry, isDelta, From, To, elmt1, elmt2, ... )",
__FILE__, DDataStd_SetExtStringArray, g);
+ theCommands.Add ("SetRefArray",
+ "SetRefArray (DF, entry, From, To, lab1, lab2,.. )",
+ __FILE__, DDataStd_SetRefArray, g);
+
theCommands.Add ("SetIntPackedMap",
"SetIntPackedMap (DF, entry, isDelta, key1, key2, ... )",
__FILE__, DDataStd_SetIntPackedMap, g);
"GetExtStringArray (DF, entry )",
__FILE__, DDataStd_GetExtStringArray, g);
+ theCommands.Add ("GetRefArray",
+ "GetRefArray (DF, entry )",
+ __FILE__, DDataStd_GetRefArray, g);
+
theCommands.Add ("GetIntPackedMap",
"GetIntPackedMap (DF, entry )",
__FILE__, DDataStd_GetIntPackedMap, g);
return TDocStd_Owner::GetDocument(acces.Data());
}
-//=======================================================================
-//function : Destroy
-//purpose :
-//=======================================================================
-void TDocStd_Document::Destroy()
-{
- SetModificationMode(Standard_False);
- myData->Root().ForgetAllAttributes(Standard_True);
- myUndoTransaction.Abort();
- if(!myUndoFILO.IsEmpty())
- myUndoFILO.Clear();
- ClearUndos();
- myData.Nullify();
-
-}
-
-
//=======================================================================
//function : TDocStd_Document
//purpose :
myUndos.RemoveFirst();
}
+//=======================================================================
+//function : BeforeClose
+//purpose :
+//=======================================================================
+void TDocStd_Document::BeforeClose()
+{
+ SetModificationMode(Standard_False);
+ AbortTransaction();
+ if(myIsNestedTransactionMode)
+ myUndoFILO.Clear();
+ ClearUndos();
+}
--- /dev/null
+pload DCAF
+
+set BugNumber OCC24164
+if { [info exists imagedir] == 0 } {
+ set imagedir .
+}
+
+#1 open new document
+NewDocument D MDTV-Standard
+UndoLimit D 10 0 0
+
+#2 define set of labels
+NewCommand D
+set Lab1 [Label D 0:1:1]
+set Lab2 [Label D 0:1:2]
+set Lab3 [Label D 0:1:3]
+set Lab4 [Label D 0:1:4]
+set Lab5 [Label D 0:1:5]
+set Lab6 [Label D 0:1:6]
+
+#3 set references
+SetRefArray D $Lab1 1 2 $Lab2 $Lab1
+SetRefArray D $Lab2 1 2 $Lab3 $Lab4
+SetRefArray D $Lab3 1 1 $Lab1
+
+#4 set additional references
+NewCommand D
+SetRefArray D $Lab4 1 2 $Lab5 $Lab1
+SetRefArray D $Lab5 1 1 $Lab6
+SetRefArray D $Lab6 1 2 $Lab3 $Lab4
+
+NewCommand D
+
+#5 check references
+GetRefArray D $Lab1
+GetRefArray D $Lab2
+GetRefArray D $Lab3
+GetRefArray D $Lab4
+GetRefArray D $Lab5
+GetRefArray D $Lab6
+
+#6 save the document
+SaveAs D ${imagedir}/testDoc2.std
+
+#7 close the document
+set catch_status 0
+if { [catch {Close D} catch_result] } {
+ set catch_status 1
+}
+if { ${catch_status} != 0 } {
+ puts "Faulty ${BugNumber}"
+} else {
+ puts "OK ${BugNumber}"
+}
+
+#8 reopen just saved document with the same name
+Open ${imagedir}/testDoc2.std D
+
+#9 close the document
+if { [catch {Close D} catch_result] } {
+ set catch_status 1
+}
+
+if { ${catch_status} != 0 } {
+ puts "Faulty ${BugNumber}"
+} else {
+ puts "OK ${BugNumber}"
+}
+