1 // Copyright (c) 2006-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #include <TDocStd_Document.hxx>
16 #include <CDM_Document.hxx>
17 #include <CDM_MetaData.hxx>
18 #include <Standard_Dump.hxx>
19 #include <Standard_Type.hxx>
20 #include <TCollection_AsciiString.hxx>
21 #include <TCollection_ExtendedString.hxx>
22 #include <TDF_AttributeDelta.hxx>
23 #include <TDF_AttributeDeltaList.hxx>
24 #include <TDF_AttributeIterator.hxx>
25 #include <TDF_AttributeList.hxx>
26 #include <TDF_Data.hxx>
27 #include <TDF_Delta.hxx>
28 #include <TDF_IDMap.hxx>
29 #include <TDF_Label.hxx>
30 #include <TDF_ListIteratorOfAttributeDeltaList.hxx>
31 #include <TDF_ListIteratorOfAttributeList.hxx>
32 #include <TDF_ListIteratorOfDeltaList.hxx>
33 #include <TDF_Reference.hxx>
34 #include <TDocStd.hxx>
35 #include <TDocStd_Application.hxx>
36 #include <TDocStd_CompoundDelta.hxx>
37 #include <TDocStd_Context.hxx>
38 #include <TDocStd_LabelIDMapDataMap.hxx>
39 #include <TDocStd_Modified.hxx>
40 #include <TDocStd_Owner.hxx>
41 #include <TDocStd_XLink.hxx>
42 #include <TDocStd_XLinkIterator.hxx>
44 IMPLEMENT_STANDARD_RTTIEXT(TDocStd_Document,CDM_Document)
46 // List should have a RemoveLast...
47 #define TDocStd_List_RemoveLast(theList) \
48 TDF_ListIteratorOfDeltaList it(theList); \
49 Standard_Integer i,n = theList.Extent(); \
50 for (i = 1; i < n; i++) it.Next(); \
57 #define SRN_DELTA_COMPACT
59 //=======================================================================
62 //=======================================================================
64 Handle(TDocStd_Document) TDocStd_Document::Get (const TDF_Label& acces)
66 return TDocStd_Owner::GetDocument(acces.Data());
69 //=======================================================================
70 //function : TDocStd_Document
72 //=======================================================================
75 TDocStd_Document::TDocStd_Document(const TCollection_ExtendedString& aStorageFormat) :
76 myStorageFormat(aStorageFormat),
77 myData (new TDF_Data()),
79 myUndoTransaction ("UNDO"),
81 myIsNestedTransactionMode(0),
82 mySaveEmptyLabels(Standard_False)
84 myUndoTransaction.Initialize (myData);
85 TDocStd_Owner::SetDocument(myData,this);
87 #ifdef SRN_DELTA_COMPACT
94 //=======================================================================
97 //=======================================================================
99 Standard_Boolean TDocStd_Document::IsSaved() const
101 return CDM_Document::IsStored();
105 //=======================================================================
108 //=======================================================================
110 TCollection_ExtendedString TDocStd_Document::GetName () const
112 return CDM_Document::MetaData()->Name();
115 //=======================================================================
118 //=======================================================================
120 TCollection_ExtendedString TDocStd_Document::GetPath () const
122 return CDM_Document::MetaData()->Path();
126 //=======================================================================
129 //=======================================================================
131 void TDocStd_Document::SetData (const Handle(TDF_Data)& D)
134 myUndoTransaction.Initialize (myData);
137 //=======================================================================
140 //=======================================================================
142 Handle(TDF_Data) TDocStd_Document::GetData () const
147 //=======================================================================
150 //=======================================================================
152 TDF_Label TDocStd_Document::Main () const
154 return myData->Root().FindChild(1,Standard_True);
157 //=======================================================================
160 //=======================================================================
162 Standard_Boolean TDocStd_Document::IsEmpty() const
164 TDF_AttributeIterator It (Main());
168 //=======================================================================
171 //=======================================================================
173 Standard_Boolean TDocStd_Document::IsValid() const
175 return TDocStd_Modified::IsEmpty(Main());
178 //=======================================================================
179 //function : SetModified
181 //=======================================================================
183 void TDocStd_Document::SetModified (const TDF_Label& L)
185 TDocStd_Modified::Add(L);
188 //=======================================================================
189 //function : IsModified
191 //=======================================================================
192 //Standard_Boolean TDocStd_Document::IsModified (const TDF_Label& L) const
194 // return TDocStd_Modified::Contains(L);
197 //=======================================================================
198 //function : PurgeModified
200 //=======================================================================
202 void TDocStd_Document::PurgeModified()
204 TDocStd_Modified::Clear(Main());
207 //=======================================================================
208 //function : GetModified
210 //=======================================================================
212 const TDF_LabelMap& TDocStd_Document::GetModified() const
214 return TDocStd_Modified::Get(Main());
219 //=======================================================================
222 //=======================================================================
224 void TDocStd_Document::Update(const Handle(CDM_Document)& /*aToDocument*/,
225 const Standard_Integer aReferenceIdentifier,
226 const Standard_Address aModifContext)
228 const TDocStd_Context* CC = static_cast<TDocStd_Context*> (aModifContext);
229 if (CC->ModifiedReferences() || !IsUpToDate(aReferenceIdentifier)) {
230 TCollection_AsciiString aDocEntry(aReferenceIdentifier);
231 UpdateReferences(aDocEntry);
232 SetIsUpToDate(aReferenceIdentifier);
236 //=======================================================================
237 //function : NewCommand
239 //=======================================================================
241 void TDocStd_Document::NewCommand()
243 #ifdef OCCT_DEBUG_TRANS
244 if (myUndoTransaction.IsOpen() && myData->Transaction() > 1) {
245 throw Standard_DomainError("NewCommand : many open transactions");
252 #ifdef OCCT_DEBUG_TRANS
253 std::cout<<"End NewCommand"<<std::endl;
258 //=======================================================================
259 //function : HasOpenCommand
261 //=======================================================================
262 Standard_Boolean TDocStd_Document::HasOpenCommand() const
264 return myUndoTransaction.IsOpen();
267 //=======================================================================
268 //function : OpenCommand
270 //=======================================================================
272 void TDocStd_Document::OpenCommand ()
274 if (!myIsNestedTransactionMode && myUndoTransaction.IsOpen()) {
275 throw Standard_DomainError("TDocStd_Document::OpenCommand : already open");
278 // if (myUndoLimit != 0) myUndoTransaction.Open();
281 //=======================================================================
282 //function : CommitCommand
284 //=======================================================================
286 Standard_Boolean TDocStd_Document::CommitCommand ()
288 return CommitTransaction();
292 //=======================================================================
293 //function : AbortCommand
295 //=======================================================================
297 void TDocStd_Document::AbortCommand ()
303 //=======================================================================
304 //function : CommitTransaction
305 //purpose : Private method.
306 //=======================================================================
308 Standard_Boolean TDocStd_Document::CommitTransaction()
310 myData->AllowModification(Standard_True);
312 Standard_Boolean isDone = Standard_False;
313 // nested transaction mode
314 if (myIsNestedTransactionMode && myUndoTransaction.IsOpen()) {
316 Handle(TDF_Delta) D = myUndoTransaction.Commit(Standard_True);
317 Handle(TDocStd_CompoundDelta) aCompDelta =
318 Handle(TDocStd_CompoundDelta)::DownCast(myUndoFILO.First());
319 AppendDeltaToTheFirst(aCompDelta, D);
321 myUndoFILO.RemoveFirst();
322 if(myUndoFILO.Extent()) {
323 aCompDelta = Handle(TDocStd_CompoundDelta)::DownCast(myUndoFILO.First());
324 AppendDeltaToTheFirst(aCompDelta, D);
325 myUndoTransaction.Open();
330 myRedos.Clear(); // if we push an Undo we clear the redos
331 isDone = Standard_True;
335 // deny modifications if the transaction is not opened
336 if(myOnlyTransactionModification) {
337 myData->AllowModification(myUndoTransaction.IsOpen() && myUndoLimit
338 ? Standard_True :Standard_False);
344 if (myUndoLimit != 0 && myUndoTransaction.IsOpen()) {
346 Handle(TDF_Delta) D = myUndoTransaction.Commit(Standard_True);
347 if (!(D.IsNull() || D->IsEmpty())) {
348 isDone = Standard_True;
350 myRedos.Clear(); // if we push an Undo we clear the redos
351 myUndos.Append(D); // New undos are at the end of the list
352 // Check the limit to remove the oldest one
353 if (myUndos.Extent() > myUndoLimit) {
354 #ifdef SRN_DELTA_COMPACT
355 Handle(TDF_Delta) aDelta = myUndos.First();
357 myUndos.RemoveFirst();
358 #ifdef SRN_DELTA_COMPACT
359 if(myFromUndo == aDelta) {
360 //The oldest Undo delta coincides with `from` delta
361 if(myUndos.Extent() == 1) { //There is the only Undo
362 myFromUndo.Nullify();
363 myFromRedo.Nullify();
366 myFromUndo = myUndos.First();
374 // deny or allow modifications acording to transaction state
375 if(myOnlyTransactionModification) {
376 myData->AllowModification (myUndoTransaction.IsOpen() && myUndoLimit
377 ? Standard_True :Standard_False);
380 // Notify CDM_Application of the successful commit
381 if (isDone && IsOpened()) {
382 const Handle(TDocStd_Application) anAppli =
383 Handle(TDocStd_Application)::DownCast(Application());
384 if (!anAppli.IsNull())
385 anAppli -> OnCommitTransaction (this);
391 //=======================================================================
392 //function : AbortTransaction
393 //purpose : Private method.
394 //=======================================================================
396 void TDocStd_Document::AbortTransaction()
398 myData->AllowModification(Standard_True);
400 if (myUndoTransaction.IsOpen())
401 if (myUndoLimit != 0)
402 myUndoTransaction.Abort();
404 if (myIsNestedTransactionMode && myUndoFILO.Extent()) {
405 if (!myUndoFILO.First()->IsEmpty())
406 myData->Undo(myUndoFILO.First(),Standard_True);
407 myUndoFILO.RemoveFirst();
408 if (myUndoFILO.Extent())
409 myUndoTransaction.Open();
411 // deny or allow modifications acording to transaction state
412 if (myOnlyTransactionModification) {
413 myData->AllowModification (myUndoTransaction.IsOpen() && myUndoLimit
414 ? Standard_True :Standard_False);
416 // Notify CDM_Application of the event
418 const Handle(TDocStd_Application) anAppli =
419 Handle(TDocStd_Application)::DownCast(Application());
420 if (!anAppli.IsNull())
421 anAppli -> OnAbortTransaction (this);
426 //=======================================================================
427 //function :OpenTransaction
428 //purpose : Private method.
429 //=======================================================================
431 void TDocStd_Document::OpenTransaction()
433 myData->AllowModification(Standard_True);
435 // nested transaction mode
436 if (myIsNestedTransactionMode) {
438 if (myUndoTransaction.IsOpen()) {
439 Handle(TDF_Delta) D = myUndoTransaction.Commit(Standard_True);
440 Handle(TDocStd_CompoundDelta) aCompDelta =
441 Handle(TDocStd_CompoundDelta)::DownCast(myUndoFILO.First());
442 AppendDeltaToTheFirst(aCompDelta, D);
444 Standard_Integer aLastTime = myData->Time();
445 if (myUndoFILO.Extent())
446 aLastTime = myUndoFILO.First()->EndTime();
447 Handle(TDocStd_CompoundDelta) aCompoundDelta =
448 new TDocStd_CompoundDelta;
449 aCompoundDelta->Validity(aLastTime, aLastTime);
450 myUndoFILO.Prepend(aCompoundDelta);
453 if (myUndoLimit != 0) myUndoTransaction.Open();
455 // deny or allow modifications acording to transaction state
456 if (myOnlyTransactionModification) {
457 myData->AllowModification (myUndoTransaction.IsOpen() && myUndoLimit
458 ? Standard_True :Standard_False);
460 // Notify CDM_Application of the event
462 const Handle(TDocStd_Application) anAppli =
463 Handle(TDocStd_Application)::DownCast(Application());
464 if (!anAppli.IsNull())
465 anAppli -> OnOpenTransaction (this);
469 //=======================================================================
470 //function : SetUndoLimit
472 //=======================================================================
474 void TDocStd_Document::SetUndoLimit(const Standard_Integer L)
476 #ifdef SRN_DELTA_COMPACT
477 myFromUndo.Nullify(); //Compaction has to aborted
478 myFromRedo.Nullify();
481 CommitTransaction ();
482 myUndoLimit = (L > 0) ? L : 0;
483 Standard_Integer n = myUndos.Extent() - myUndoLimit;
485 myUndos.RemoveFirst();
488 // deny or allow modifications acording to transaction state
489 if(myOnlyTransactionModification) {
490 myData->AllowModification(myUndoTransaction.IsOpen() && myUndoLimit
491 ? Standard_True :Standard_False);
493 //OpenTransaction(); dp 15/10/99
496 //=======================================================================
497 //function : GetUndoLimit
499 //=======================================================================
501 Standard_Integer TDocStd_Document::GetUndoLimit() const
506 //=======================================================================
509 //=======================================================================
511 Standard_Integer TDocStd_Document::GetAvailableUndos() const
513 return myUndos.Extent();
516 //=======================================================================
517 //function : ClearUndos
519 //=======================================================================
521 void TDocStd_Document::ClearUndos()
525 #ifdef SRN_DELTA_COMPACT
526 myFromRedo.Nullify();
527 myFromUndo.Nullify();
531 //=======================================================================
532 //function : ClearRedos
534 //=======================================================================
536 void TDocStd_Document::ClearRedos()
539 #ifdef SRN_DELTA_COMPACT
540 myFromRedo.Nullify();
544 //=======================================================================
547 // Some importante notice:
548 // 1) The most recent undo delta is at the end of the list.
549 // 2) Removing the LAST item of a list is tedious, but it is done only on
550 // Undo. Remove first is done at each command if the limit is reached!
551 // 3) To make fun, the redos are not like the undos: the most recent delta
552 // is at the beginning! Like this, it is easier to remove it after use.
553 //=======================================================================
554 Standard_Boolean TDocStd_Document::Undo()
556 // Don't call NewCommand(), because it may commit Interactive Attributes
557 // and generate a undesirable Delta!
559 Standard_Boolean isOpened = myUndoTransaction.IsOpen();
560 Standard_Boolean undoDone = Standard_False;
561 //TDF_Label currentObjectLabel = CurrentLabel (); //Sauve pour usage ulterieur.
563 if (!myUndos.IsEmpty()) {
564 // Reset the transaction
567 // only for nested transaction mode
568 while(myIsNestedTransactionMode && myUndoFILO.Extent())
571 // allow modifications
572 myData->AllowModification(Standard_True);
575 // should test the applicability before.
576 #ifdef OCCT_DEBUG_DELTA
577 std::cout<<"DF before Undo =================================="<<std::endl; TDF_Tool::DeepDump(std::cout,myData);
579 Handle(TDF_Delta) D = myData->Undo(myUndos.Last(),Standard_True);
580 D->SetName(myUndos.Last()->Name());
581 #ifdef OCCT_DEBUG_DELTA
582 std::cout<<"DF after Undo =================================="<<std::endl; TDF_Tool::DeepDump(std::cout,myData);
586 // Remove the last Undo
587 TDocStd_List_RemoveLast(myUndos);
588 undoDone = Standard_True;
591 if (isOpened && undoDone) OpenTransaction();
593 // deny or allow modifications acording to transaction state
594 if(myOnlyTransactionModification) {
595 myData->AllowModification(myUndoTransaction.IsOpen() && myUndoLimit
596 ? Standard_True :Standard_False);
602 //=======================================================================
603 //function : GetAvailableRedos
605 //=======================================================================
607 Standard_Integer TDocStd_Document:: GetAvailableRedos() const
609 // should test the applicability before.
610 return myRedos.Extent();
613 //=======================================================================
616 //=======================================================================
617 Standard_Boolean TDocStd_Document::Redo()
619 Standard_Boolean isOpened = myUndoTransaction.IsOpen();
620 Standard_Boolean undoDone = Standard_False;
621 // TDF_Label currentObjectLabel = CurrentLabel();//Sauve pour usage ulterieur.
622 if (!myRedos.IsEmpty()) {
623 // should test the applicability before.
624 // Reset the transaction
627 // only for nested transaction mode
628 while(myIsNestedTransactionMode && myUndoFILO.Extent())
631 // allow modifications
632 myData->AllowModification(Standard_True);
635 #ifdef OCCT_DEBUG_DELTA
636 std::cout<<"DF before Redo =================================="<<std::endl; TDF_Tool::DeepDump(std::cout,myData);
638 Handle(TDF_Delta) D = myData->Undo(myRedos.First(),Standard_True);
639 D->SetName(myRedos.First()->Name());
640 #ifdef OCCT_DEBUG_DELTA
641 std::cout<<"DF after Redo =================================="<<std::endl; TDF_Tool::DeepDump(std::cout,myData);
643 // Push the redo of the redo as an undo (got it !)
645 // remove the Redo from the head
646 myRedos.RemoveFirst();
647 undoDone = Standard_True;
650 if (isOpened && undoDone) OpenTransaction();
652 // deny or allow modifications acording to transaction state
653 if(myOnlyTransactionModification) {
654 myData->AllowModification(myUndoTransaction.IsOpen() && myUndoLimit
655 ? Standard_True :Standard_False);
661 //=======================================================================
662 //function : UpdateReferences
664 //=======================================================================
666 void TDocStd_Document::UpdateReferences(const TCollection_AsciiString& aDocEntry)
669 TDF_AttributeList aRefList;
670 TDocStd_XLink* xRefPtr;
671 for (TDocStd_XLinkIterator xItr (this); xItr.More(); xItr.Next()) {
672 xRefPtr = xItr.Value();
673 if (xRefPtr->DocumentEntry() == aDocEntry) {
674 aRefList.Append(xRefPtr->Update());
677 TDF_ListIteratorOfAttributeList It(aRefList);
678 for (;It.More();It.Next()) {
679 // // mise a jour import
680 SetModified(It.Value()->Label());
685 //=======================================================================
686 //function : GetUndos
688 //=======================================================================
690 const TDF_DeltaList& TDocStd_Document::GetUndos() const
696 //=======================================================================
697 //function : GetRedos
699 //=======================================================================
701 const TDF_DeltaList& TDocStd_Document::GetRedos() const
706 //=======================================================================
707 //function : InitDeltaCompaction
709 //=======================================================================
711 Standard_Boolean TDocStd_Document::InitDeltaCompaction()
713 #ifdef SRN_DELTA_COMPACT
714 if (myUndoLimit == 0 || myUndos.Extent() == 0) {
715 myFromRedo.Nullify();
716 myFromUndo.Nullify();
717 return Standard_False; //No Undos to compact
720 myFromRedo.Nullify();
722 myFromUndo = myUndos.Last();
723 if(myRedos.Extent() > 0) myFromRedo = myRedos.First();
725 return Standard_True;
728 //=======================================================================
729 //function : PerformDeltaCompaction
731 //=======================================================================
733 Standard_Boolean TDocStd_Document::PerformDeltaCompaction()
735 #ifdef SRN_DELTA_COMPACT
736 if(myFromUndo.IsNull()) return Standard_False; //Redo can be Null for this operation
739 Handle(TDocStd_CompoundDelta) aCompoundDelta = new TDocStd_CompoundDelta;
740 TDF_ListIteratorOfDeltaList anIterator(myUndos);
741 TDF_ListIteratorOfAttributeDeltaList aDeltasIterator;
742 TDocStd_LabelIDMapDataMap aMap;
743 Standard_Boolean isFound = Standard_False, isTimeSet = Standard_False;
747 for(; anIterator.More(); anIterator.Next()) {
749 if(myFromUndo == anIterator.Value()) isFound = Standard_True;
750 aList.Append(anIterator.Value()); //Fill the list of deltas that precede compound delta
754 if(!isTimeSet) { //Set begin and end time when the compound delta is valid
755 aCompoundDelta->Validity(anIterator.Value()->BeginTime(), myUndos.Last()->EndTime());
756 isTimeSet = Standard_True;
759 aDeltasIterator.Initialize(anIterator.Value()->AttributeDeltas());
760 for(; aDeltasIterator.More(); aDeltasIterator.Next()) {
761 if(!aMap.IsBound(aDeltasIterator.Value()->Label())) {
762 TDF_IDMap* pIDMap = new TDF_IDMap();
763 aMap.Bind(aDeltasIterator.Value()->Label(), *pIDMap);
766 if(aMap(aDeltasIterator.Value()->Label()).Add(aDeltasIterator.Value()->ID())) //The attribute is not
767 aCompoundDelta->AddAttributeDelta(aDeltasIterator.Value()); //already in the delta
772 myUndos.Assign(aList);
773 myUndos.Append(aCompoundDelta);
777 if(myFromRedo.IsNull()) {
779 return Standard_True;
784 for(anIterator.Initialize(myRedos); anIterator.More(); anIterator.Next()) {
785 aList.Append(anIterator.Value());
786 if(anIterator.Value() == myFromRedo) break;
790 myRedos.Assign(aList);
792 return Standard_True;
796 //=======================================================================
797 //function : StorageFormat
799 //=======================================================================
801 TCollection_ExtendedString TDocStd_Document::StorageFormat() const
803 return myStorageFormat;
807 //=======================================================================
808 //function : ChangeStorageFormat
810 //=======================================================================
812 void TDocStd_Document::ChangeStorageFormat (const TCollection_ExtendedString& newStorageFormat)
814 if (newStorageFormat != myStorageFormat) {
815 myStorageFormat = newStorageFormat;
816 myResourcesAreLoaded = Standard_False;
817 CDM_Document::LoadResources ();
824 //=======================================================================
825 //function : Recompute
827 //=======================================================================
829 void TDocStd_Document::Recompute ()
831 if (IsValid()) return;
832 // find the top function and execute it
833 // Handle(TDesign_Function) F;
834 // if (Main().FindAttribute(TDesign_Function::GetID(),F)) {
835 // TFunction_Solver slv;
836 // slv.SetTouched(GetModified());
837 // slv.ExecuteFrom(F);
841 //=======================================================================
842 //function : AppendDeltaToTheFirst
843 //purpose : Appends delta to the first delta in the myUndoFILO
844 //=======================================================================
846 void TDocStd_Document::AppendDeltaToTheFirst
847 (const Handle(TDocStd_CompoundDelta)& theDelta1,
848 const Handle(TDF_Delta)& theDelta2)
850 if(theDelta2->IsEmpty()) return;
851 TDocStd_LabelIDMapDataMap aMap;
853 TDF_ListIteratorOfAttributeDeltaList aDeltasIterator1
854 (theDelta1->AttributeDeltas());
855 for(; aDeltasIterator1.More(); aDeltasIterator1.Next()) {
856 TDF_Label aLabel = aDeltasIterator1.Value()->Label();
857 if(!aMap.IsBound(aLabel)) {
859 aMap.Bind(aLabel, aTmpIDMap);
861 Standard_GUID anID = aDeltasIterator1.Value()->ID();
862 TDF_IDMap& anIDMap = aMap.ChangeFind(aLabel);
866 theDelta1->Validity(theDelta1->BeginTime(), theDelta2->EndTime());
867 TDF_ListIteratorOfAttributeDeltaList aDeltasIterator2
868 (theDelta2->AttributeDeltas());
869 for(; aDeltasIterator2.More(); aDeltasIterator2.Next()) {
870 TDF_Label aLabel = aDeltasIterator2.Value()->Label();
871 Standard_GUID anID = aDeltasIterator2.Value()->ID();
872 if(aMap.IsBound(aLabel)) {
873 const TDF_IDMap& anIDMap = aMap.Find(aLabel);
874 if(anIDMap.Contains(anID)) continue;
876 theDelta1->AddAttributeDelta(aDeltasIterator2.Value());
880 //=======================================================================
881 //function : RemoveFirstUndo
883 //=======================================================================
884 void TDocStd_Document::RemoveFirstUndo() {
885 if (myUndos.IsEmpty()) return;
886 myUndos.RemoveFirst();
889 //=======================================================================
890 //function : BeforeClose
892 //=======================================================================
893 void TDocStd_Document::BeforeClose()
895 SetModificationMode(Standard_False);
897 if(myIsNestedTransactionMode)
902 //=======================================================================
903 //function : DumpJson
905 //=======================================================================
906 void TDocStd_Document::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
908 OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
910 OCCT_DUMP_BASE_CLASS (theOStream, theDepth, CDM_Document)
912 OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myStorageFormat)
914 for (TDF_DeltaList::Iterator anUndoIt (myUndos); anUndoIt.More(); anUndoIt.Next())
916 const Handle(TDF_Delta)& anUndo = anUndoIt.Value();
917 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, anUndo.get())
920 for (TDF_DeltaList::Iterator aRedoIt (myRedos); aRedoIt.More(); aRedoIt.Next())
922 const Handle(TDF_Delta)& aRedo = aRedoIt.Value();
923 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aRedo.get())
926 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myData.get())
927 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUndoLimit)
928 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myUndoTransaction)
929 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myFromUndo.get())
930 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myFromRedo.get())
931 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySaveTime)
932 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsNestedTransactionMode)
934 for (TDF_DeltaList::Iterator anUndoFILOIt (myUndoFILO); anUndoFILOIt.More(); anUndoFILOIt.Next())
936 const Handle(TDF_Delta)& anUndoFILO = anUndoFILOIt.Value();
937 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, anUndoFILO.get())
940 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myOnlyTransactionModification)
941 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySaveEmptyLabels)