Class Variables

VarSpace
ClassModule Variables

A collection for the storage and retrieval of Variable Objects

Description:
This class is designed to simplify the storage and retrieval of Variable objects. Variable values may be stored and retrieved with the Value properties or the backward compatible SetValue/GetValue methods. References to the Variable objects may be retrieved through the GetVariable method.

Variable tracing is also available at this level.

Author:
Andrew Friedl

Copyright:
Copyright 1997.04.10, BlackBox Software & Consulting

History:

General Methods
object members
Item Public Property Get Item(vntIndexKey As Variant) As Variable
        Collection based retrieval
Count Public Property Get Count() As Long
        Collection based object count
NewEnum Public Property Get NewEnum() As IUnknown
        Collection based enumeration
Value Public Property Get Value(Name As String) As Variant
        Retrieves a named value from the collection.
Value Public Property Let Value(Name As String, Value As Variant)
        Stores a named value (non object) to the collection.
Value Public Property Set Value(Name As String, Value As Variant)
        Stores a named value (object) to the collection.
Storage Public Property Get Storage() As Collection
        Returns the collection storage for the variable set.
GetVariable Public Function GetVariable(Name As String, Value As Variable) As Boolean
        Locates a named Variable object.
SetValue Public Function SetValue(Name As String, Value As Variant, Optional ReadOnly As Variant) As Boolean
        Sets or creates a named variable within the collection.
GetValue Public Function GetValue(Name As String, Value As Variant) As Boolean
        Retrieves a named value from the collection.
SetTrace Public Function SetTrace(Name As String) As VarTrace
        Adds tracing to a named variable.
Remove Public Sub Remove(vntIndexKey As Variant)
        Collection based deletion
Clear Public Sub Clear()
        Removes all variables form the collection.

General Methods - Detail
object members

Item

Collection based retrieval

Definition:
Public Property Get Item(vntIndexKey As Variant) As Variable


Count

Collection based object count

Definition:
Public Property Get Count() As Long


NewEnum

Collection based enumeration

Definition:
Public Property Get NewEnum() As IUnknown


Value

Retrieves a named value from the collection.

Description:
This function retrieves the value of a named variable, assuming the variable exists.

Definition:
Public Property Get Value(Name As String) As Variant

Parameters:
Name The name of the variable whose value is to be retrieved.

Returns:
The value of the variable.


Value

Stores a named value (non object) to the collection.

Description:
This function stores a new non-object value to the collection or updates an existing variable with a given name. If the variable exists, an attempt is made to update it, otherwise it is created.

Definition:
Public Property Let Value(Name As String, Value As Variant)

Parameters:
Name The name of the variable whose value is to be retrieved.
Value The value of the variable to be updated or stored.


Value

Stores a named value (object) to the collection.

Description:
This function stores an object value to the collection or updates an existing variable. If the variable exists, an attempt is made to update it, otherwise it is created.

Definition:
Public Property Set Value(Name As String, Value As Variant)

Parameters:
Name The name of the whose value is to be retrieved.
Value The value of the variable to be updated or stored.


Storage

Returns the collection storage for the variable set.

Definition:
Public Property Get Storage() As Collection

Returns:
A Collection of Variable objects.


GetVariable

Locates a named Variable object.

Description:
This function seaches for and retreves a reference to a named Variable contained within the collection.

Definition:
Public Function GetVariable(Name As String, Value As Variable) As Boolean

Parameters:
Name The name of the variable to be located.
Value The reference that is to be set if the variable is found.

Returns:
True if the Variable is located, False otherwise.


SetValue

Sets or creates a named variable within the collection.

Description:
This function sets or creates a named value within the collection. If a value with the Name specified already exists, then it an attempt is made to update it to the new value. If no value exists then a new Variable is created with the value specified.

Definition:
Public Function SetValue(Name As String, Value As Variant, Optional ReadOnly As Variant) As Boolean

Parameters:
Name The name of the variable to be created or set.
Value The value to be stored or updated.
ReadOnly An optional parameter indicating the value os to be readonly. This parameter is only meaningful when a variable is first created.

Returns:
True if the Variable is created or updated, False otherwise.


GetValue

Retrieves a named value from the collection.

Description:
This function retrieves the value of a named variable and stores that value in the Value parameter, provided the variable exists.

Definition:
Public Function GetValue(Name As String, Value As Variant) As Boolean

Parameters:
Name The name of the variable whose value is to be retrieved.
Value The variant where the value is to be stored.

Returns:
True if the Variable exists, False otherwise.


SetTrace

Adds tracing to a named variable.

Description:
This function creates a trace upon a variable contained within the collection, provided the variable exists.

Definition:
Public Function SetTrace(Name As String) As VarTrace

Parameters:
Name The name of the variable to be traced.

Returns:
A VarTrace object capable of generating events.


Remove

Collection based deletion

Definition:
Public Sub Remove(vntIndexKey As Variant)


Clear

Removes all variables form the collection.

Description:
This subroutine causes all variables within the collection to be deleted. All variable traces in effect will receive event notifications prior to deletion.

Definition:
Public Sub Clear()


Generated by BlackBox Software's DocuPro for VB6
Software and Documentation Copyright 1999,2000 BlackBox Software, All Rights Reserved