Class: TTextArgumentDictionary

Declaration: TextArgumentDictionary.h

Taxonomy Categories:

Member Functions:


Interface Category:

Developer Tool Programmer Interface.

Inherits From:

None.

Inherited By:

None.

Purpose:

Parses input arguments. It takes as input an ordered collection of TText objects (in some form or another). It parses these TTexts as arguments on a command line, forming key-value pairs.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

You do not need to derive TTextArgumentDictionary. Use TTextArgumentDictionary directly.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TTextArgumentDictionary::TTextArgumentDictionary

  1. TTextArgumentDictionary ()
  2. TTextArgumentDictionary (TTest & theTest, const TText & nakedOptions =TTextArgumentDictionary :: kEmptyText, const TText & multipleValueOptions =TTextArgumentDictionary :: kEmptyText)
  3. TTextArgumentDictionary (const TSequenceOf < TText > & textArguments, const TText & nakedOptions =TTextArgumentDictionary :: kEmptyText, const TText & multipleValueOptions =TTextArgumentDictionary :: kEmptyText)
  4. TTextArgumentDictionary (const TText & argumentString, const TText & nakedOptions =TTextArgumentDictionary :: kEmptyText, const TText & multipleValueOptions =TTextArgumentDictionary :: kEmptyText)
  5. TTextArgumentDictionary (const TTextArgumentDictionary & source)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

  1. Default constructor.
  2. Constructor that takes a constant reference to a TTest object. Uses inputs in TTest as arguments.
  3. Constructor that takes a sequence of TText objects.
  4. Constructor that takes an argument string.
  5. Copy constructor.

Calling Context:

  1. Called by the stream-in operators and directly.
  2. Called by Test Framework and directly.
  3. Called by Test Framework and directly.
  4. Called by Test Framework and directly.
  5. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextArgumentDictionary::operator=

TTextArgumentDictionary & operator =(const TTextArgumentDictionary & rhs)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Assignment operator.

Calling Context:

Called when an object is assigned to another compatible object.

Parameters:

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: TTextArgumentDictionary::~TTextArgumentDictionary

virtual ~ TTextArgumentDictionary ()

Interface Category:

Developer Tool Programmer Interface.

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: TTextArgumentDictionary::SpecifyNakedOptions

void SpecifyNakedOptions (const TText & nakedOptions)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Specifies that the given options never take values.

Calling Context:

Called by TTextArgumentDictionary constructors.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextArgumentDictionary::SpecifyMultipleValueOptions

void SpecifyMultipleValueOptions (const TText & multipleValueOptions)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Specifies that the given options take multiple values.

Calling Context:

Called by TTextArgumentDictionary constructors.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextArgumentDictionary::LookupSimilarKeys

void LookupSimilarKeys (bool)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

If LookupSimilarKeys(true) is called, the dictionary henceforth calls FindSimilarKey for all lookups. It also matches similar keys during ImportTextArguments calls when checking to see if keys are naked or multiple value keys.

Calling Context:

Called by Test Framework and directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextArgumentDictionary::ImportTextArguments

  1. void ImportTextArguments (TTest & theTest)
  2. void ImportTextArguments (const TSequenceOf < TText > & textArguments)
  3. void ImportTextArguments (const TText & argumentString)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

  1. Copies text arguments from the given TTest object.
  2. Copies text arguments from the given sequence of text.
  3. Copies text arguments from the given argument string.

Calling Context:

  1. Called by TTextArgumentDictionary constructors and directly.
  2. Called by TTextArgumentDictionary constructors and directly.
  3. Called by TTextArgumentDictionary constructors and directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextArgumentDictionary::ExportTextArguments

void ExportTextArguments (TText & argumentString)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Exports the arguments in this dictionary as a string of space-delimited keys and values.

Calling Context:

Called by Test Framework and directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextArgumentDictionary::CopyTextArguments

void CopyTextArguments (TSequenceOf < TText > & textArguments)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Exports the arguments in this dictionary as a sequence of TText keys and values.

Calling Context:

Called by Test Framework and directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextArgumentDictionary::CountOfArguments

unsigned long CountOfArguments () const

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Returns the number of key-value pairs in the dictionary.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the number of key-value pairs in the dictionary.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextArgumentDictionary::RemoveOnLookup

void RemoveOnLookup (bool)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

If Remove on Lookup(true) is called, then the keys and values are removed from the dictionary as they are looked up.

Calling Context:

Called by Test Framework and directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

The caller owns the returned values from the lookup and must delete them if RemoveOnLookup is called with true.

Member Function: TTextArgumentDictionary::TextAt

TText * TextAt (const TText & key)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Retrieves the value associated with the given key.

Calling Context:

Called by Test Framework and directly.

Parameters:

Return Value:

If the value is numeric, TextAt returns it as a string. If no value is given, an empty TText object is returned. If the key is not present at all, then TextAt returns zero.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextArgumentDictionary::NthValue

TText * NthValue (const short index)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Returns the keyless value with the given index number.

Calling Context:

Called by Test Framework and directly.

Parameters:

Return Value:

Returns a pointer to the value. If no value is found for the given index, then NthValue returns zero.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextArgumentDictionary::MultipleValuesAt

bool MultipleValuesAt (const TText & key, TCollectionOf<TText> & toReceiveTTexts)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Returns a collection of values for keys that accept multiple values.

Calling Context:

Called by Test Framework and directly.

Parameters:

Return Value:

Returns true if the key is found in the dictionary.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

The multiple values feature is incompatible with type-safe collections, and, as such, is not recommended for use with any long-term test code. Later versions of the Test Framework will include a new method of handling this kind of argument.

Member Function: TTextArgumentDictionary::FindSimilarKey

TText * FindSimilarKey (const TText & keyToMatch) const

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Should be called to explicitly look for a key similar to the one given. A key is considered to match if it is of equal length or longer then the match key, and if all characters in the match key are equal (case insensitive) to those in the key.

Calling Context:

Called by Test Framework and directly.

Parameters:

Return Value:

Returns the similar key if found. Returns zero if no similar key is found.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextArgumentDictionary::NumberAt

  1. bool NumberAt (const TText & key, double & value, double minAllowed =-DBL_MAX, double maxAllowed =DBL_MAX)
  2. bool NumberAt (const TText & key, long & value, long minAllowed =LONG_MIN, long maxAllowed =LONG_MAX)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

  1. Looks up a number corresponding to the given key. The value is returned as a double.
  2. Looks up a number corresponding to the given key. The value is returned as a long.

Calling Context:

  1. Called by Test Framework and directly.
  2. Called by Test Framework and directly.

Parameters:

Return Value:

Returns true if the value is found, it parses perfectly, and it is within the given range. If the argument does not exist, NumberAt returns false and leaves value unchanged.

Exceptions:

Throws TArgumentDictionaryLookupFailureException if the number parses badly or is out of range.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextArgumentDictionary::NthNumber

  1. bool NthNumber (const short index, double & value, double minAllowed =-DBL_MAX, double maxAllowed =DBL_MAX)
  2. bool NthNumber (const short index, long & value, long minAllowed =LONG_MIN, long maxAllowed =LONG_MAX)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

  1. Looks up a number corresponding to the given index. The value is returned as a double.
  2. Looks up a number corresponding to the given index. The value is returned as a long.

Calling Context:

  1. Called by Test Framework and directly.
  2. Called by Test Framework and directly.

Parameters:

Return Value:

Returns true if the value is found, it parses perfectly, and it is within the given range. If the argument does not exist, NumberAt returns false and leaves value unchanged.

Exceptions:

Throws TArgumentDictionaryLookupFailureException if number parses badly or is out of range.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextArgumentDictionary::DeleteAll

void DeleteAll ()

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Deletes all key-value pairs from the dictionary.

Calling Context:

Called by Test Framework and directly.

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.