MBS Xojo Developer Conference and Training
Join us from 3rd to 6th May 2017 in Berlin, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

NewCFAbsoluteTimeMBS(time as Double) as CFAbsoluteTimeMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CFDate),
Plugin version: 3.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Returns a new absolute time object with the given value.
Notes: Returns nil on any error.
NewCFBinaryDataMBSMem(mem as memoryblock,len as Integer) as CFBinaryDataMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CF),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Returns a CFBinary object for the given memoryblock.
NewCFBinaryDataMBSStr(s as string) as CFBinaryDataMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CF),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

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
NewCFBooleanMBS(value as boolean) as CFBooleanMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CF),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Returns a CFBooleanMBS object created using the given boolean.

Some examples using this method:

NewCFDateMBS as CFDateMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CFDate),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Returns a new emptry CFDateMBS.

Some FAQ entries about this method:

NewCFMutableArrayMBS as CFMutableArrayMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CFDictionaryArray),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

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).
NewCFMutableBagMBS as CFMutableBagMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CFSetBag),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Returns a new emptry CFMutableBagMBS.
NewCFMutableBinaryDataMBSMem(len as Integer) as CFMutableBinaryDataMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CF),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Returns a CFMutableBinary object with the given size in bytes.
NewCFMutableDictionaryMBS as CFMutableDictionaryMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CFDictionaryArray),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Returns a new emptry CFMutableDictionaryMBS.
Example:
dim d as CFMutableDictionaryMBS

d=NewCFMutableDictionaryMBS
d.Add NewCFStringMBS("Key"),NewCFStringMBS("Value")
MsgBox d.XML.str
NewCFMutableSetMBS as CFMutableSetMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CFSetBag),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Returns a new emptry CFMutableSetMBS.
NewCFNumberMBSDouble(doubleValue as Double) as CFNumberMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CF),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Returns a CFNumberMBS object for the given double value.
NewCFNumberMBSInteger(integerValue as Integer) as CFNumberMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CF),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Returns a CFNumberMBS object for the given integer value.
NewCFNumberMBSSingle(singleValue as single) as CFNumberMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CF),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Returns a CFNumberMBS object for the given single value.
NewCFObjectMBS(handle as Integer) as CFObjectMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CF),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

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.
NewCFObjectMBSFromXML(XMLdata as CFBinaryDataMBS) as CFObjectMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CF),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

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.
NewCFTimeIntervalMBS(time as Double) as CFTimeIntervalMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CFDate),
Plugin version: 3.2, Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Returns a new time interval object with the given value.
Notes: Returns nil on any error.
NewCFURLMBSCFStringMBS(cfstr as CFStringMBS, baseurl as CFURLMBS) as CFURLMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CFURL),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Creates a new CFURLMBS from the CFStringMBS.

Some FAQ entries about this method:

NewCFURLMBSFile(f as folderitem) as CFURLMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CFURL),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Creates a new CFURLMBS from a file.
NewCFURLMBSHFSPath(cfstr as CFStringMBS,directory as boolean) as CFURLMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CFURL),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Creates a new CFURLMBS from the CFStringMBS which is interpreted as a HFS path.
NewCFURLMBSMem(mem as memoryblock,len as Integer,encoding as Integer,baseurl as CFURLMBS) as CFURLMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CFURL),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

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.
NewCFURLMBSPosixPath(cfstr as CFStringMBS,directory as boolean) as CFURLMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CFURL),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Creates a new CFURLMBS from the CFStringMBS which is interpreted as a Posix path.
NewCFURLMBSStr(str as string, baseurl as CFURLMBS) as CFURLMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CFURL),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

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.
NewCFURLMBSWindowsPath(cfstr as CFStringMBS,directory as boolean) as CFURLMBS
global method, CoreFoundation, MBS MacOSXCF Plugin (CFURL),
Mac: Yes, Win: No, Linux: No, Console & Web: Yes, Feedback.

Function: Creates a new CFURLMBS from the CFStringMBS which is interpreted as a Windows path.

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




Links
Christians Software aus Nickenich