]> gitweb.factorcode.org Git - factor.git/blob - basis/core-foundation/utilities/utilities.factor
Switch to https urls
[factor.git] / basis / core-foundation / utilities / utilities.factor
1 ! Copyright (C) 2009 Slava Pestov.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: alien assocs byte-arrays core-foundation
4 core-foundation.arrays core-foundation.data
5 core-foundation.dictionaries core-foundation.numbers
6 core-foundation.strings destructors hashtables kernel math
7 sequences strings ;
8 IN: core-foundation.utilities
9
10 GENERIC: (>cf) ( obj -- cf )
11
12 M: number (>cf) <CFNumber> ;
13 M: t (>cf) <CFNumber> ;
14 M: f (>cf) <CFNumber> ;
15 M: string (>cf) <CFString> ;
16 M: byte-array (>cf) <CFData> ;
17 M: hashtable (>cf) [ [ (>cf) &CFRelease ] bi@ ] assoc-map <CFDictionary> ;
18 M: sequence (>cf) [ (>cf) &CFRelease ] map <CFArray> ;
19 M: alien (>cf) CFRetain ;
20
21 : >cf ( obj -- cf ) [ (>cf) ] with-destructors ;