Class: TAttribute

Declaration: Attribute.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MCollectible

Inherited By:

TSharedAttribute TStyle TColorMatcher TDefaultGUIFontStyles TInternalAttribute

Purpose:

The Attributes classes handle storage management of data, provide a vehicle for sharing data, and provide a mechanism for attaching characteristics to data. An attribute is essentially a named wrapper for arbitrary data.

Instantiation:

TAttribute is the abstract base class that all attribute classes descend from.

Deriving Classes:

Directly derive from TAttribute in either of two situations: either the attribute data is so small that there is no gain by sharing it, or the attribute is by its nature not shareable.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TAttribute::~TAttribute

virtual ~ TAttribute ()

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: TAttribute::GetName

virtual const TToken & GetName () const

Interface Category:

API.

Purpose:

Returns the name associated with the attribute. The default implementation returns the name of the class.

Calling Context:

Called directly to get the name associated with an attribute.

Parameters:

Return Value:

Returns a const TToken reference.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttribute::GetCategory

virtual const TToken & GetCategory () const

Interface Category:

API.

Purpose:

Returns the category associated with the attribute. The default implementation returns the name of the class.

Calling Context:

Called directly to get the category associated with an attribute.

Parameters:

Return Value:

Returns a const TToken reference.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttribute::NamesMatch

bool NamesMatch (const TAttribute * anotherAttribute) const

Interface Category:

API.

Purpose:

Compares the names and categories of two attributes.

Calling Context:

Called directly to determine if two attributes have the same name and category.

Parameters:

Return Value:

Returns true if the names and categories of the two attributes are the same.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttribute::NamesAndValuesMatch

bool NamesAndValuesMatch (const TAttribute * anotherAttribute) const

Interface Category:

API.

Purpose:

Compares the names, categories, and data of two attributes.

Calling Context:

Called directly to determine if two attributes have the same name, category, and internal data.

Parameters:

Return Value:

Returns true if the names, categories, and data of the two attributes are the same.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttribute::Hash

virtual long Hash () const

Interface Category:

API.

Purpose:

Returns the hash value of the name of the class. A hash value is a number that is unique to different tokens. If two tokens are the same, then they will have the same hash value. However, two tokens with the same hash value are not necessarily the same. If the hash values are different, then it is guaranteed that the tokens are different.

Calling Context:

Called directly to get the hash value identifying an attribute.

Parameters:

Return Value:

A unique number that represents the name of the class. Attributes with different hash values are guaranteed to have different class names, but attributes with the same hash value do not necessarily have the same class name.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttribute::GetInternalAttribute

virtual TInternalAttribute * GetInternalAttribute () const

Interface Category:

API.

Purpose:

This member function is only useful for classes that are derived from TSharedAttribute. The default implementation in class TAttribute returns NIL.

Calling Context:

Called directly to get a pointer to the internal attribute of a shared attribute.

Parameters:

Return Value:

A pointer to the internal attribute.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttribute::operator>>=

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

Interface Category:

API.

Purpose:

Stream-out operator.

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: TAttribute::operator<<=

virtual TStream & operator <<= (TStream & aStream)

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 no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttribute::TAttribute

  1. TAttribute ()
  2. TAttribute (const TAttribute & anAttribute)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.

Calling Context:

  1. This is an abstract base class, so this constructor can not be called directly.
  2. This is an abstract base class, so this constructor can not be called directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttribute::SetInternalAttribute

virtual void SetInternalAttribute (TInternalAttribute * internal, TStream * aStream =NIL)

Interface Category:

API.

Purpose:

This member function is only useful for classes that are derived from TSharedAttribute. The default implementation in class TAttribute does nothing.

Calling Context:

This is a protected member function.

Parameters:

Return Value:

None.

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.