Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

NewCFAbsoluteTimeMBS(time as Double) as CFAbsoluteTimeMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin 3.2 Yes No No Yes, macOS only No
Function: Returns a new absolute time object with the given value.
Notes: Returns nil on any error.

Feedback, Comments & Corrections

NewCFBinaryDataMBSMem(mem as memoryblock,len as Integer) as CFBinaryDataMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Returns a CFBinary object for the given memoryblock.

Feedback, Comments & Corrections

NewCFBinaryDataMBSStr(s as string) as CFBinaryDataMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Returns a CFBinary object for the given string.
Example:
dim t as TextOutputStream
dim f as FolderItem
dim o as CFObjectMBS
dim s as string
dim i as TextInputStream

f=SpecialFolder.Desktop.Child("test")
o=NewCFStringMBS("Hello")

// write

s=o.XML.str
s=ConvertEncoding(s,Encodings.UTF8)

t=f.CreateTextFile
t.Write s
t.Close

// clear

o=nil

// now read back

i=f.OpenAsTextFile
s=i.ReadAll(Encodings.UTF8)
i.Close

o=NewCFObjectMBSFromXML(NewCFBinaryDataMBSStr(s))

MsgBox CFStringMBS(o).str

Feedback, Comments & Corrections

NewCFBooleanMBS(value as boolean) as CFBooleanMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Returns a CFBooleanMBS object created using the given boolean.

Some examples using this method:

Feedback, Comments & Corrections

NewCFDateMBS as CFDateMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Returns a new emptry CFDateMBS.

Some FAQ entries about this method:

Feedback, Comments & Corrections

NewCFMutableArrayMBS as CFMutableArrayMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Creates a new empty mutable array.
Notes: The array's maximum capacity is unlimited (or rather, only limited by address space and available memory constraints).

Feedback, Comments & Corrections

NewCFMutableBagMBS as CFMutableBagMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Returns a new emptry CFMutableBagMBS.

Feedback, Comments & Corrections

NewCFMutableBinaryDataMBSMem(len as Integer) as CFMutableBinaryDataMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Returns a CFMutableBinary object with the given size in bytes.

Feedback, Comments & Corrections

NewCFMutableDictionaryMBS as CFMutableDictionaryMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Returns a new emptry CFMutableDictionaryMBS.
Example:
dim d as CFMutableDictionaryMBS

d=NewCFMutableDictionaryMBS
d.Add NewCFStringMBS("Key"),NewCFStringMBS("Value")
MsgBox d.XML.str

Feedback, Comments & Corrections

NewCFMutableSetMBS as CFMutableSetMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Returns a new emptry CFMutableSetMBS.

Feedback, Comments & Corrections

NewCFNumberMBSDouble(doubleValue as Double) as CFNumberMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Returns a CFNumberMBS object for the given double value.

Feedback, Comments & Corrections

NewCFNumberMBSInteger(integerValue as Integer) as CFNumberMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Returns a CFNumberMBS object for the given integer value.

Feedback, Comments & Corrections

NewCFNumberMBSSingle(singleValue as single) as CFNumberMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Returns a CFNumberMBS object for the given single value.

Feedback, Comments & Corrections

NewCFObjectMBS(handle as Integer) as CFObjectMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Returns a CFObjectMBS object for the given handle.
Example:
dim d as CFMutableDictionaryMBS
dim s as CFStringMBS
dim o as CFObjectMBS
dim t as CFStringMBS

d=NewCFMutableDictionaryMBS
s=NewCFStringMBS("Hello")

d.Add s,s

o=d.Value(s) // uses NewCFObjectMBS internally

t=cfstringMBS(o) // Now you can cast here in v5.2!

MsgBox t.str
Notes:
Handle is just a CFTypeRef.
If release is true, the destructor of the CFObjectMBS will release the handle later.
In Version 5.2 this function can return objects which may be casted to CFURL, CFDictionary, CFString, CFNumber, CFCharacterSet, CFBag, CFArray, CFBoolean, CFBinaryData or CFSet.

Feedback, Comments & Corrections

NewCFObjectMBSFromXML(XMLdata as CFBinaryDataMBS) as CFObjectMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Parses the XML data and returns a CFObject.
Example:
dim f as FolderItem
dim t as TextInputStream
dim s as String
dim o as CFObjectMBS
dim d as CFDictionaryMBS

// get file name
f=GetFolderItem("CF XML Test.txt")
// open file
t=f.OpenAsTextFile
// Read String
s=t.ReadAll

// Create back
o=NewCFObjectMBSFromXML(NewCFBinaryDataMBSStr(s))

// now check if the dictionary we saved is there:
if o<>nil then
if o isa CFDictionaryMBS then
d=CFDictionaryMBS(o)
MsgBox CFStringMBS(d.Value(NewCFStringMBS("Key"))).str
end if
end if
Notes:
Same as NewCFObjectMBSFromXML, but with additional multithreading.
Must be called inside a Xojo (Real Studio) thread so time yields to main thread and you can keep the GUI running.

Note that the CFObject returned is in most times a CFDictionary or a CFArray.
This function takes text and binary plist file content.

Feedback, Comments & Corrections

NewCFTimeIntervalMBS(time as Double) as CFTimeIntervalMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin 3.2 Yes No No Yes, macOS only No
Function: Returns a new time interval object with the given value.
Notes: Returns nil on any error.

Feedback, Comments & Corrections

NewCFURLMBSCFStringMBS(cfstr as CFStringMBS, baseurl as CFURLMBS) as CFURLMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Creates a new CFURLMBS from the CFStringMBS.

Some FAQ entries about this method:

Feedback, Comments & Corrections

NewCFURLMBSFile(f as folderitem) as CFURLMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Creates a new CFURLMBS from a file.

Feedback, Comments & Corrections

NewCFURLMBSHFSPath(cfstr as CFStringMBS,directory as boolean) as CFURLMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Creates a new CFURLMBS from the CFStringMBS which is interpreted as a HFS path.

Feedback, Comments & Corrections

NewCFURLMBSMem(mem as memoryblock,len as Integer,encoding as Integer,baseurl as CFURLMBS) as CFURLMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Creates a new CFURLMBS from the data inside the memoryblock.
Notes:
Len is the len of the data inside the memoryblock.
Encoding the ID of the text encoding.
BaseURL is the base url. If baseurl=nil then the current application directory is used.

Feedback, Comments & Corrections

NewCFURLMBSPosixPath(cfstr as CFStringMBS,directory as boolean) as CFURLMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Creates a new CFURLMBS from the CFStringMBS which is interpreted as a Posix path.

Feedback, Comments & Corrections

NewCFURLMBSStr(str as string, baseurl as CFURLMBS) as CFURLMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Creates a new CFURLMBS from the string.
Example:
dim s as string
dim f as FolderItem
dim cu as CFURLMBS

s="file://localhost/Users/cs/Music/iTunes/iTunes%20Music"

cu=NewCFURLMBSStr(s,nil) // true=isdirectory
f=cu.file

MsgBox f.AbsolutePath
Notes: BaseURL is the base url. If baseurl=nil then the current application directory is used.

Feedback, Comments & Corrections

NewCFURLMBSWindowsPath(cfstr as CFStringMBS,directory as boolean) as CFURLMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreFoundation MBS MacOSXCF Plugin Yes No No Yes, macOS only No
Function: Creates a new CFURLMBS from the CFStringMBS which is interpreted as a Windows path.

Feedback, Comments & Corrections

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




Links
MBS Xojo tutorial videos