Class: TDocumentComponent

Declaration: CompoundDocument.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TDocumentState

Inherited By:

TGUIModelPresenterDocumentComponentFor TGUIModelViewDocumentComponentFor

Purpose:

The document component is a basic building block of compound documents. It splits the document state into model and presenter states, and provides support for embedding document components in models. TDocumentComponent's responsibilities are to: (1) Produce a fake cached image-backed TModelPresenterState and TModel when the shared libraries for either the TModelPresenterState or TModel are not available during filing in or streaming in. (2) Hold and maintain the presenter state and model data even if the shared libraries for these are not available. (3) Stream in/out its contained model and presenter state during streaming. (4) File in/out only a reference to its contained model and presenter state during filing.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Do not derive from this class.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TDocumentComponent::TDocumentComponent

  1. TDocumentComponent (TModel * theModelToAdopt, TModelPresenterState * thePSToAdopt)
  2. TDocumentComponent ()
  3. TDocumentComponent (const TDocumentComponent &)

Interface Category:

API.

Purpose:

  1. Creates a document component containing a model and a presenter state.
  2. Default constructor. This is only for internal use by Resurrect. This function is protected.
  3. Copy constructor.

Calling Context:

  1. Call this function directly.
  2. Only for internal use by Resurrect. Developers should treat as protected.
  3. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws kNILModel if the model is NIL. Throws kNILPresenterState if the presenter state is NIL.

Concurrency:

Not multithread safe.

Other Considerations:

Preconditions: Assertion (TModel * != NIL && TModelPresenterState * != NIL).

Member Function: TDocumentComponent::~TDocumentComponent

virtual ~ TDocumentComponent ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TDocumentComponent::GetReference

TDocumentComponentReference GetReference () const

Interface Category:

API.

Purpose:

Creates a reference to this component. If this component is made persistent, the reference is valid across multiple document sessions.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to this component.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TDocumentComponent::CreateDocumentPresenter

virtual TDocumentPresenter * CreateDocumentPresenter (const TPlaceReference & ) const

Interface Category:

API.

Purpose:

Creates a default document level presenter for this component and delegates to the presenter state.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the presenter.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TDocumentComponent::GetPresenterStateReference

TPresenterStateReference GetPresenterStateReference () const

Interface Category:

API.

Purpose:

Gets a reference to the presenter state owned by this component.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to this component's presenter state.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TDocumentComponent::AdoptPresenterState

void AdoptPresenterState (TModelPresenterState *)

Interface Category:

API.

Purpose:

Adopts a presenter state into this presenter. The previously owned presenter state is deleted.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None. Owned by caller.

Exceptions:

Throws kNILPresenterState if the presenter state is NIL.

Concurrency:

Not multithread safe.

Other Considerations:

Preconditions: Assertion (TModelPresenterState * != NIL).

Member Function: TDocumentComponent::GetModelReference

TModelReference GetModelReference () const

Interface Category:

API.

Purpose:

Gets a reference to the model owned by this component.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to the model owned by this component.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TDocumentComponent::AdoptModel

void AdoptModel (TModel *)

Interface Category:

API.

Purpose:

Adopts a model into the component. The previously owned model is deleted.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Preconditions: Assertion (TModel* != NIL).

Member Function: TDocumentComponent::DeleteStore

void DeleteStore();

Interface Category:

API.

Purpose:

Deletes the TDocumentComponentStore associated with this component. The component stores of any children are deleted recursively.

Calling Context:

Called when the deletion of a component is committed, and the storage will never by used again.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TDocumentComponent::operator>>=

virtual TStream & operator >>=(TStream &) const

Interface Category:

API.

Purpose:

Stream-out operator. If the streaming is for the purpose of filing, only references to the contained model and presenter state are streamed. Otherwise, the presenter state and model are also streamed.

Calling Context:

Called to stream out data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TDocumentComponent::operator<<=

virtual TStream & operator <<= (TStream &)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Called to stream in data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws a TInvalidVersionError if the version of the object on the stream is unknown to the version of the shared library installed.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TDocumentComponent::Hash

virtual long Hash () const

Interface Category:

API.

Purpose:

Returns the hash value for this object. Hash values are used to speed comparison.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the hash value for this object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.