I have never done this, but you can use a private API. In all likelihood, it will depend on a specific point version of OS X, as CF runtimes may vary from release to release. In any case, CF is open source, so I looked at what CFRuntime does. I was glad to see that Apple included an example:
// ========================= EXAMPLE ========================= // Example: EXRange -- a "range" object, which keeps the starting // location and length of the range. ("EX" as in "EXample"). // ---- API ---- typedef const struct __EXRange * EXRangeRef; CFTypeID EXRangeGetTypeID(void); EXRangeRef EXRangeCreate(CFAllocatorRef allocator, uint32_t location, uint32_t length); uint32_t EXRangeGetLocation(EXRangeRef rangeref); uint32_t EXRangeGetLength(EXRangeRef rangeref); // ---- implementation ----
source share