Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TUnicodeArray
Inherited By:
None.
Purpose:
TToken, derived from TUnicodeArray, encapsulates a constant, fast string of Unicode characters. Tokens are assigned a unique identifier at instantiation, allowing them to be shared by all running programs. A given token is given the same identifier no matter how many times it is instantiated. After instantiation, the string encapsulated by a token can be replaced but not edited.
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.
- TToken (const char nullTerminated [])
- TToken (const UniChar that [], TTextCount thatLength)
- TToken (const TText & that)
- TToken (const TToken & that)
- TToken ()
Interface Category:
API.
Purpose:
- Constructs a token for the given character string.
- Constructs a token for the given character string.
- Constructs a token for the character string encapsulated by a text instance.
- Copy constructor.
- Default constructor.
Calling Context:
- Called to construct a token for a character string.
- Called to construct a token for a character string.
- Called to construct a token for a character string encapsulated by a text instance.
- Called to copy an object.
- Called by the stream-in operators.
Parameters:
- const char nullTerminated [] -The character string.
- const UniChar that [] -The character string.
- TTextCount thatLength -The length of the character string.
- const TText & that -The text instance containing the character string.
- const TToken & that -The object to copy.
- Takes no parameters.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual ~ TToken ()
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: TToken::operator=
TToken & operator =(const TToken & that)
Interface Category:
API.
Purpose:
Assignment operator.
Calling Context:
Called when an object is assigned to another compatible object.
Parameters:
- const TToken & that -The source object for the assignment.
Return Value:
A non-const reference to the left-hand side object.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TToken::operator==
bool operator ==(const TToken & that) const
Interface Category:
API.
Purpose:
Equality operator.
Calling Context:
Call to compare two instances of this class.
Parameters:
- const TToken & that -The object to compare with this object.
Return Value:
Returns true if the objects are equal.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TToken::Hash
virtual long Hash () const
Interface Category:
API.
Purpose:
Overrides inherited MCollectible function.
Calling Context:
Same as for base class.
Parameters:
Return Value:
The numeric value of the hash.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TToken::operator>>=
virtual TStream & operator >>=(TStream &) const
Interface Category:
API.
Purpose:
Stream-out operator.
Calling Context:
Called to stream out data.
Parameters:
- TStream & toWhere -The stream the object streams itself out to.
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: TToken::operator<<=
virtual TStream & operator <<= (TStream &)
Interface Category:
API.
Purpose:
Stream-in operator.
Calling Context:
Called to stream in data.
Parameters:
- TStream & fromWhere -The stream the object streams itself in from.
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: TToken::GetLength
virtual TTextCount GetLength () const
Interface Category:
API.
Purpose:
Returns the length of the encapsulated character string.
Calling Context:
Call to get the length of the encapsulated character string. If the length is 0, the token is invalid.
Parameters:
Return Value:
The length of the encapsulated character string.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TToken::GetData
- virtual TTextCount GetData (UniChar that [], TTextCount thatLength) const
- virtual TTextCount GetData (UniChar that [], TTextCount thatLength, const TTextRange & thisRange) const
- virtual TTextCount GetData (char that [], TTextCount thatLength) const
- virtual TTextCount GetData (char that [], TTextCount thatLength, const TTextRange & thisRange) const
Interface Category:
API.
Purpose:
- Gets the character string encapsulated by the token as a UniChar array.
- Gets the character string encapsulated by the token as a UniChar array.
- Gets the character string encapsulated by the token as a char array.
- Gets the character string encapsulated by the token as a char array.
Calling Context:
- Call to get the character string encapsulated by the token.
- Call to get the character string encapsulated by the token.
- Call to get the character string encapsulated by the token.
- Call to get the character string encapsulated by the token.
Parameters:
- UniChar that [] -The UniChar array encapsulated by the token.
- TTextCount thatLength -The length of the array.
- UniChar that [] -The UniChar array encapsulated by the token.
- TTextCount thatLength -The length of the array.
- const TTextRange & thisRange -The range to return.
- char that [] -The char array encapsulated by the token.
- TTextCount thatLength -The length of the array.
- char that [] -The char array encapsulated by the token.
- TTextCount thatLength -The length of the array.
- const TTextRange & thisRange -The range to return.
Return Value:
The actual length of the returned array.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TToken::SetData
- virtual void SetData (const UniChar that [], const TTextRange & thatRange)
- virtual void SetData (const char that [], const TTextRange & thatRange)
Interface Category:
API.
Purpose:
- Replaces the string in the token with the specified string.
- Replaces the string in the token with the specified string.
Calling Context:
- Call to replace the string in the token with the specified string.
- Call to replace the string in the token with the specified string.
Parameters:
- const UniChar that [] -The string to replace the current string.
- const TTextRange & thatRange -The range of the string to use.
- const char that [] -The string to replace the current string.
- const TTextRange & thatRange -The range of the string to use.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function provides the only mechanism for changing a token after instantiation.
Member Function: TToken::IsValid
bool IsValid () const
Interface Category:
API.
Purpose:
Queries whether a token is valid. A token is invalid if it contains a string of length 0; that is, no string.
Calling Context:
Call to query whether a token is valid.
Parameters:
Return Value:
Returns true if the token is valid.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TToken::GetInvalidToken
static const TToken & GetInvalidToken ()
Interface Category:
API.
Purpose:
Returns an invalid token instance.
Calling Context:
Call to get an invalid token.
Parameters:
Return Value:
An invalid TToken instance.
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.