Refactor CoreFoundation objects so that they derive from a common base class

There is lots of duplicated code with the core foundation type objects. This removes much of the duplication and will make binding future objects easier.