# ApplicationFramework
TKLCAF
TDocStd

# TDocStd_Document Class Reference

The contents of a TDocStd_Application, a
document is a container for a data framework
composed of labels and attributes. As such,
TDocStd_Document is the entry point into the data framework.
To gain access to the data, you create a document as follows:
Handle(TDocStd_Document) MyDF = new TDocStd_Document
The document also allows you to manage:
- modifications, providing Undo and Redo functions.
- command transactions.
Warning: The only data saved is the framework (TDF_Data)
.

`#include <TDocStd_Document.hxx>`

Inheritance diagram for TDocStd_Document:

[legend]

## Public Member Functions

Standard_EXPORT | TDocStd_Document (const TCollection_ExtendedString &astorageformat)
| Constructs a document object defined by the string astorageformat. .
Standard_EXPORT Standard_Boolean | IsSaved () const
| the document is saved in a file.
Standard_Boolean | IsChanged () const
| returns True if document differs from the state of last saving. this method have to be called only wroking in the transaction mode
void | SetSaved ()
| This method have to be called to show document that it has been saved .
void | SetSavedTime (const Standard_Integer theTime)
| Say to document what it is not saved. Use value, returned earlier by GetSavedTime(). .
Standard_Integer | GetSavedTime () const
| Returns value of <mysavedtime> to be used later in SetSavedTime() .
Standard_EXPORT TCollection_ExtendedString | GetName () const
| raise if <me> is not saved.
Standard_EXPORT TCollection_ExtendedString | GetPath () const
| returns the OS path of the file, in wich one <me> is saved. Raise an exception if <me> is not saved.
Standard_EXPORT void | SetData (const Handle(TDF_Data)&data)
Standard_EXPORT Handle_TDF_Data | GetData () const
Standard_EXPORT TDF_Label | Main () const
| Returns the main label in this data framework. By definition, this is the label with the entry 0:1. .
Standard_EXPORT Standard_Boolean | IsEmpty () const
| Returns True if the main label has no attributes .
Standard_EXPORT Standard_Boolean | IsValid () const
| Returns False if the document has been modified but not recomputed. .
Standard_EXPORT void | SetModified (const TDF_Label &L)
| Notify the label as modified, the Document becomes UnValid. //! returns True if <l> has been notified as modified. .
Standard_EXPORT void | PurgeModified ()
| Remove all modifications. After this call The document becomesagain Valid. .
Standard_EXPORT const TDF_LabelMap & | GetModified () const
| Returns the labels which have been modified in this document. .
Standard_EXPORT void | NewCommand ()
| Launches a new command. This command may be undone. .
Standard_EXPORT Standard_Boolean | HasOpenCommand () const
| returns True if a Command transaction is open in the curret .
Standard_EXPORT void | OpenCommand ()
| Opens a new command transaction in this document. You can use HasOpenCommand to see whether a command is already open. Exceptions Standard_DomainError if a command is already open in this document. .
Standard_EXPORT Standard_Boolean | CommitCommand ()
| Commits documents transactions and fills the transaction manager with documents that have been changed during the transaction. If no command transaction is open, nothing is done. Returns True if a new delta has been added to myUndos. .
Standard_EXPORT void | AbortCommand ()
| Abort the Command transaction. Does nothing If there is no Command transaction open. .
Standard_EXPORT Standard_Integer | GetUndoLimit () const
| The current limit on the number of undos .
Standard_EXPORT void | SetUndoLimit (const Standard_Integer L)
| Set the limit on the number of Undo Delta stored 0 will disable Undo on the document A negative value means no limit. Note that by default Undo is disabled. Enabling it will take effect with the next call to NewCommand. Of course this limit is the same for Redo .
Standard_EXPORT void | ClearUndos ()
| Remove all stored Undos and Redos .
Standard_EXPORT void | ClearRedos ()
| Remove all stored Redos .
Standard_EXPORT Standard_Integer | GetAvailableUndos () const
| Returns the number of undos stored in this document. If this figure is greater than 0, the method Undo can be used. .
Standard_EXPORT Standard_Boolean | Undo ()
| Will UNDO one step, returns False if no undo was done (Undos == 0). Otherwise, true is returned and one step in the list of undoes is undone. .
Standard_EXPORT Standard_Integer | GetAvailableRedos () const
| Returns the number of redos stored in this document. If this figure is greater than 0, the method Redo can be used. .
Standard_EXPORT Standard_Boolean | Redo ()
| Will REDO one step, returns False if no redo was done (Redos == 0). Otherwise, true is returned, and one step in the list of redoes is done again. .
Standard_EXPORT const TDF_DeltaList & | GetUndos () const
Standard_EXPORT const TDF_DeltaList & | GetRedos () const
Standard_EXPORT void | RemoveFirstUndo ()
| Removes the first undo in the list of document undos. It is used in the application when the undo limit is exceed. .
Standard_EXPORT Standard_Boolean | InitDeltaCompaction ()
| Initializes the procedure of delta compaction Returns false if there is no delta to compact Marks the last delta as a "from" delta .
Standard_EXPORT Standard_Boolean | PerformDeltaCompaction ()
| Performs the procedure of delta compaction Makes all deltas starting from "from" delta till the last one to be one delta. .
Standard_EXPORT void | UpdateReferences (const TCollection_AsciiString &aDocEntry)
| Set modifications on labels impacted by external references to the entry. The document becomes invalid and must be recomputed. .
Standard_EXPORT void | Recompute ()
| Recompute if the document was not valid and propagate the reccorded modification. .
virtual Standard_EXPORT void | Update (const Handle(CDM_Document)&aToDocument, const Standard_Integer aReferenceIdentifier, const Standard_Address aModifContext)

This method Update will be called
to signal the end of the modified references list.
The document should be recomputed and
UpdateFromDocuments should be called. Update should
returns True in case of success, false otherwise. In
case of Failure, additional information can be given in
ErrorString.
//! Update the document by propagation
==================================
//! Update the document from internal stored
modifications. If you want to undoing this
operation, please call NewCommand before.
//! to change format (advanced programming)
================
.

virtual Standard_EXPORT TCollection_ExtendedString | StorageFormat () const
| The Storage Format is the key which is used to determine in the application resources the storage driver plugin, the file extension and other data used to store the document. .
virtual Standard_EXPORT void | ChangeStorageFormat (const TCollection_ExtendedString &newStorageFormat)
| methods for the nested transaction mode
Standard_EXPORT void | SetNestedTransactionMode (const Standard_Boolean isAllowed=Standard_True)
| Sets nested transaction mode if isAllowed == Standard_True .
Standard_Boolean | IsNestedTransactionMode () const
| Returns Standard_True if mode is set .
void | SetModificationMode (const Standard_Boolean theTransactionOnly)
| if theTransactionOnly is True changes is denied outside transactions
Standard_Boolean | ModificationMode () const
| returns True if changes allowed only inside transactions
Standard_EXPORT const | Handle (Standard_Type)&DynamicType() const

## Static Public Member Functions

static Standard_EXPORT Handle_TDocStd_Document | Get (const TDF_Label &L)
| Will Abort any execution, and commit the Undo transaction //! returns the document which contains <l>. raises an exception if the document is not found. .

## Protected Member Functions

virtual Standard_EXPORT Standard_Boolean | CommitTransaction ()
| Returns Standard_True done .
virtual Standard_EXPORT void | AbortTransaction ()
virtual Standard_EXPORT void | OpenTransaction ()
| methods for protection of changes outside transactions

## Protected Attributes

TCollection_ExtendedString | myStorageFormat

## Static Private Member Functions

static Standard_EXPORT void | AppendDeltaToTheFirst (const Handle(TDocStd_CompoundDelta)&theDelta1, const Handle(TDF_Delta)&theDelta2)
| Appends delta to the first delta in the myUndoFILO //! private methods =============== .

## Private Attributes

Handle_TDF_Data | myData
Standard_Integer | myUndoLimit
TDF_Transaction | myUndoTransaction
TDF_DeltaList | myUndos
TDF_DeltaList | myRedos
Handle_TDF_Delta | myFromUndo
Handle_TDF_Delta | myFromRedo
Standard_Integer | mySaveTime
Standard_Boolean | myIsNestedTransactionMode
TDF_DeltaList | myUndoFILO
Standard_Boolean | myOnlyTransactionModification

## Constructor & Destructor Documentation

Standard_EXPORT TDocStd_Document::TDocStd_Document | ( | const TCollection_ExtendedString & | astorageformat | ) |

## Member Function Documentation

Standard_EXPORT void TDocStd_Document::AbortCommand | ( |  | ) |

virtual Standard_EXPORT void TDocStd_Document::AbortTransaction | ( |  | ) | `[protected, virtual]`

static Standard_EXPORT void TDocStd_Document::AppendDeltaToTheFirst | ( | const Handle(TDocStd_CompoundDelta)& | theDelta1,
|  | const Handle(TDF_Delta)& | theDelta2
| ) | `[static, private]`

virtual Standard_EXPORT void TDocStd_Document::ChangeStorageFormat | ( | const TCollection_ExtendedString & | newStorageFormat | ) | `[virtual]`

Standard_EXPORT void TDocStd_Document::ClearRedos | ( |  | ) |

Standard_EXPORT void TDocStd_Document::ClearUndos | ( |  | ) |

Standard_EXPORT Standard_Boolean TDocStd_Document::CommitCommand | ( |  | ) |

virtual Standard_EXPORT Standard_Boolean TDocStd_Document::CommitTransaction | ( |  | ) | `[protected, virtual]`

static Standard_EXPORT Handle_TDocStd_Document TDocStd_Document::Get | ( | const TDF_Label & | L | ) | `[static]`

Standard_EXPORT Standard_Integer TDocStd_Document::GetAvailableRedos | ( |  | ) | const

Standard_EXPORT Standard_Integer TDocStd_Document::GetAvailableUndos | ( |  | ) | const

Standard_EXPORT Handle_TDF_Data TDocStd_Document::GetData | ( |  | ) | const

Standard_EXPORT const TDF_LabelMap& TDocStd_Document::GetModified | ( |  | ) | const

Standard_EXPORT TCollection_ExtendedString TDocStd_Document::GetName | ( |  | ) | const

Standard_EXPORT TCollection_ExtendedString TDocStd_Document::GetPath | ( |  | ) | const

Standard_EXPORT const TDF_DeltaList& TDocStd_Document::GetRedos | ( |  | ) | const

Standard_Integer TDocStd_Document::GetSavedTime | ( |  | ) | const`[inline]`

Standard_EXPORT Standard_Integer TDocStd_Document::GetUndoLimit | ( |  | ) | const

Standard_EXPORT const TDF_DeltaList& TDocStd_Document::GetUndos | ( |  | ) | const

Standard_EXPORT const TDocStd_Document::Handle | ( | Standard_Type |  | ) | const

| Reimplemented from CDM_Document.

Standard_EXPORT Standard_Boolean TDocStd_Document::HasOpenCommand | ( |  | ) | const

Standard_EXPORT Standard_Boolean TDocStd_Document::InitDeltaCompaction | ( |  | ) |

Standard_Boolean TDocStd_Document::IsChanged | ( |  | ) | const`[inline]`

Standard_EXPORT Standard_Boolean TDocStd_Document::IsEmpty | ( |  | ) | const

Standard_Boolean TDocStd_Document::IsNestedTransactionMode | ( |  | ) | const`[inline]`

Standard_EXPORT Standard_Boolean TDocStd_Document::IsSaved | ( |  | ) | const

Standard_EXPORT Standard_Boolean TDocStd_Document::IsValid | ( |  | ) | const

Standard_EXPORT TDF_Label TDocStd_Document::Main | ( |  | ) | const

Standard_Boolean TDocStd_Document::ModificationMode | ( |  | ) | const`[inline]`

Standard_EXPORT void TDocStd_Document::NewCommand | ( |  | ) |

Standard_EXPORT void TDocStd_Document::OpenCommand | ( |  | ) |

virtual Standard_EXPORT void TDocStd_Document::OpenTransaction | ( |  | ) | `[protected, virtual]`

Standard_EXPORT Standard_Boolean TDocStd_Document::PerformDeltaCompaction | ( |  | ) |

Standard_EXPORT void TDocStd_Document::PurgeModified | ( |  | ) |

Standard_EXPORT void TDocStd_Document::Recompute | ( |  | ) |

Standard_EXPORT Standard_Boolean TDocStd_Document::Redo | ( |  | ) |

Standard_EXPORT void TDocStd_Document::RemoveFirstUndo | ( |  | ) |

Standard_EXPORT void TDocStd_Document::SetData | ( | const Handle(TDF_Data)& | data | ) |

void TDocStd_Document::SetModificationMode | ( | const Standard_Boolean | theTransactionOnly | ) | `[inline]`

Standard_EXPORT void TDocStd_Document::SetModified | ( | const TDF_Label & | L | ) |

void TDocStd_Document::SetNestedTransactionMode | ( | const Standard_Boolean | isAllowed = `Standard_True` | ) | `[inline]`

void TDocStd_Document::SetSaved | ( |  | ) | `[inline]`

void TDocStd_Document::SetSavedTime | ( | const Standard_Integer | theTime | ) | `[inline]`

Standard_EXPORT void TDocStd_Document::SetUndoLimit | ( | const Standard_Integer | L | ) |

virtual Standard_EXPORT TCollection_ExtendedString TDocStd_Document::StorageFormat | ( |  | ) | const`[virtual]`

| Implements CDM_Document.

Standard_EXPORT Standard_Boolean TDocStd_Document::Undo | ( |  | ) |

virtual Standard_EXPORT void TDocStd_Document::Update | ( | const Handle(CDM_Document)& | aToDocument,
|  | const Standard_Integer | aReferenceIdentifier,
|  | const Standard_Address | aModifContext
| ) | `[virtual]`

| Reimplemented from CDM_Document.

Standard_EXPORT void TDocStd_Document::UpdateReferences | ( | const TCollection_AsciiString & | aDocEntry | ) |

## Field Documentation

Handle_TDF_Data TDocStd_Document::myData `[private]`

Handle_TDF_Delta TDocStd_Document::myFromRedo `[private]`

Handle_TDF_Delta TDocStd_Document::myFromUndo `[private]`

Standard_Boolean TDocStd_Document::myIsNestedTransactionMode `[private]`

Standard_Boolean TDocStd_Document::myOnlyTransactionModification `[private]`

TDF_DeltaList TDocStd_Document::myRedos `[private]`

Standard_Integer TDocStd_Document::mySaveTime `[private]`

TCollection_ExtendedString TDocStd_Document::myStorageFormat `[protected]`

TDF_DeltaList TDocStd_Document::myUndoFILO `[private]`

Standard_Integer TDocStd_Document::myUndoLimit `[private]`

TDF_DeltaList TDocStd_Document::myUndos `[private]`

TDF_Transaction TDocStd_Document::myUndoTransaction `[private]`

The documentation for this class was generated from the following files:

- TDocStd_Document.hxx
- TDocStd_Document.lxx