Platforms to show: All Mac Windows Linux Cross-Platform

Back to CFArrayMBS class.

CFArrayMBS.AsArray as Variant()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 23.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Converts all objects in the CFArray to Xojo variants.
Example

Dim m As New CFMutableArrayMBS

// add one value
m.Append NewCFStringMBS("Hello")

// convert to Xojo array
Dim a() As Variant = m.AsArray

// and show value
MessageBox a(0)

CFArrayMBS.clone as CFArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a new immutable array with the values from the given array.

The values itself are not duplicated, but retained.

CFArrayMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 10.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a new editable array object.
Example
dim b as new CFMutableArrayMBS

b.Append(NewCFStringMBS("Hello"))

MsgBox str(b.Count)

See also:

CFArrayMBS.Constructor(values() as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a new CFArrayMBS object with CFString objects created from the given string array.
Example
dim values() as string = array("Hello", "World", "Just", "a", "Test")
dim a as new CFArrayMBS(values)

MsgBox str(a.Count)+" elements"
MsgBox a.XML.Str // show as xml

See also:

CFArrayMBS.ContainsValue(value as CFObjectMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
Reports whether or not the value is in the array.

CFArrayMBS.CountOfValue(value as CFObjectMBS) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
Counts the number of times the given value occurs in the array.

CFArrayMBS.Edit as CFMutableArrayMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a new mutable array with the values from the current array.

CFArrayMBS.FirstIndexOfValue(value as CFObjectMBS) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
Searches the array for the value.

Result:
The lowest index of the matching values, or -1 if no value matched.

CFArrayMBS.Item(index as Integer) as CFObjectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the entry with the given index.

Index from 0 to count-1.

CFArrayMBS.LastIndexOfValue(value as CFObjectMBS) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
Searches the array for the value.

Result:
The lowest highest of the matching values, or -1 if no value matched.

CFArrayMBS.writeToFile(file as folderitem, useAuxiliaryFile as boolean) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 10.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Writes the contents of the receiver to a file at a given path.
Example
dim a as new CFMutableArrayMBS

a.Append NewCFStringMBS("Hello")
a.Append NewCFStringMBS("World")

dim f as FolderItem = SpecialFolder.Desktop.Child("test.xml")

if a.writeToFile(f, true) then
MsgBox "OK"
else
MsgBox "Failed"
end if

dim x as CFArrayMBS = CFArrayMBS.arrayWithContentsOfFile(f)
MsgBox x.XML.str

file: The path at which to write the contents of the receiver.
useAuxiliaryFile: If true, the array is written to an auxiliary file, and then the auxiliary file is renamed to path. If false, the array is written directly to path. The true option guarantees that path, if it exists at all, won't be corrupted even if the system should crash during writing.

Returns true if the file is written successfully, otherwise false.

If the receiver's contents are all property list objects (NSString, NSData, NSArray, or NSDictionary objects), the file written by this method can be used to initialize a new array with the class method arrayWithContentsOfFile. This method recursively validates that all the contained objects are property list objects before writing out the file, and returns false if all the objects are not property list objects, since the resultant file would not be a valid property list.

CFArrayMBS.writeToURL(url as string, atomically as boolean) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 10.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Writes the contents of the receiver to the location specified by a given URL.

URL: The location at which to write the receiver.
atomically: If true, the array is written to an auxiliary location, and then the auxiliary location is renamed to aURL. If false, the array is written directly to aURL. The true option guarantees that aURL, if it exists at all, won't be corrupted even if the system should crash during writing.

Returns true if the location is written successfully, otherwise false.

If the receiver's contents are all property list objects (NSString, NSData, NSArray, or NSDictionary objects), the location written by this method can be used to initialize a new array with the class method arrayWithContentsOfURL.

The items on this page are in the following plugins: MBS MacCF Plugin.


The biggest plugin in space...