XUIDictionary
Inherits Dictionary
Description
A case-sensitive dictionary subclass that gracefully handles mixtures of String
and Text
objects.
Properties
Name | Type | Read-Only |
---|---|---|
CaseSensitive | Boolean |
✔ |
mCaseSensitive | Boolean |
Methods
Name | Parameters | Returns |
---|---|---|
AsText | s As String |
Text |
Clone | XUIDictionary |
|
Constructor | ||
Constructor | caseSensitive As Boolean , ParamArray entries() As Pair |
|
Constructor | ParamArray entries() As Pair |
|
DecodeKey | key As Variant |
Variant |
EncodeKey | key As Variant |
Variant |
EquivalentTo | other As XUIDictionary |
Boolean |
HasKey | key As Variant |
Boolean |
Iterator | Iterator |
|
Key | index As Integer |
Variant |
Keys | Variant() |
|
Lookup | key As Variant , defaultValue As Variant |
Variant |
TextValue | key As Variant |
Text |
Value | key As Variant |
Variant |
Value | key As Variant , Assigns v As Variant |
Property Descriptions
CaseSensitive As Boolean
True if this dictionary's keys are case-sensitive.
mCaseSensitive As Boolean
Backing field for the computed CaseSensitive
computed property.
Method Descriptions
AsText(s As String) As Text
Returns s
as a Text
object.
Clone() As XUIDictionary
Returns a shallow clone of this dictionary
Results in a new XUIDictionary
that can be manipulated independently.
A shallow clone means that if a value or key refers to a class instance,
its contents are not cloned.
Constructor()
This is private to force users of the class to specify case sensitivity.
Constructor(caseSensitive As Boolean, ParamArray entries() As Pair)
caseSensitive
determines if case is considered when comparing keys.
Takes an optional number of Key:Value
Pair
instances.
Constructor(ParamArray entries() As Pair)
This is private to force users of the class to specify case sensitivity.
DecodeKey(key As Variant) As Variant
Decodes key
.
EncodeKey(key As Variant) As Variant
Encodes key
if required.
If we're case-sensitive, we encode all "textual" (String
or Text
)
keys as hex strings. Other key types are left as-is.
If we're not case-sensitive then we store all textual keys as Text
.
We do this so that we can compare the keys that may be Text
with
IDE string literals.
EquivalentTo(other As XUIDictionary) As Boolean
True if this dictionary's keys and values are equivalent to other
.
HasKey(key As Variant) As Boolean
True if key
is in the dictionary.
Iterator() As Iterator
Returns the dictionary iterator.
Part of the Xojo Iterable
interface.
Key(index As Integer) As Variant
Returns the value of key
for the index
th sequential item in this Dictionary.
The first item is numbered zero.
If there is no index
th item in the dictionary, an OutOfBoundsException
is raised.
Keys() As Variant()
Returns all the keys in this dictionary as an array of Variants.
Lookup(key As Variant, defaultValue As Variant) As Variant
Looks up the passed value of key
.
TextValue(key As Variant) As Text
Retrieves the value associated with key
converted to Text
.
Will fail if the value associated with key
cannot be converted to Text
.
Value(key As Variant) As Variant
Retrieves the value associated with key
.
Value(key As Variant, Assigns v As Variant)
Assigns a value to the key
item in the dictionary.