Commit Graph

34 Commits

Author SHA1 Message Date
Patrick Walton dc1184ebe2 Revamp and modernize the Core Foundation APIs.
This change redoes the way Core Foundation works to make the API
smaller, safer, and easier to use. In particular:

* Deriving custom types is now based on `struct`s, not on making a
  type alias of `CFWrapper`.

* The attempts at type safety for `CFArray` and `CFDictionary` were
  removed as not pulling their weight (IMHO).

* Methods that are really unsafe (in particular `wrap_owned` and
  `wrap_shared`) are now marked `unsafe`.

* `wrap_owned` has been renamed to `wrap_under_create_rule` and
  `wrap_shared` has been renamed to `wrap_under_get_rule`, to match
  Apple's documentation.

* `borrow_ref` and friends have been simplified into
  `as_concrete_TypeRef()` and `as_TypeRef()`.

* Dictionaries, arrays, and sets now assume that their elements are
  Core Foundation objects. The old code tried not to assume that,
  but ended up assuming that anyway in a couple of places.

* `CFString`s can be converted from Rust types with the `FromStr`
  trait. `CFNumber`s can be converted to and from Rust types with
  `ToPrimitive` and `FromPrimitive`, eliminating the duplication of
  functionality inside this module.
2013-11-15 09:46:49 +09:00
Simon Sapin 95f2f30981 Upgrade to rustc 0.8-pre (0ac3e02 2013-08-30 05:45:45 -0700) 2013-09-02 17:13:27 +01:00
Brian Anderson 9755a007a0 Update for language changes 2013-08-29 15:33:30 -07:00
Jack Moffitt cfabac1e68 Fix string usage now that rust has dropped trailing nulls. 2013-08-16 11:02:38 -06:00
Jack Moffitt cb48972c1d Upgrade to latest rust. 2013-08-15 18:45:17 -06:00
Jack Moffitt 6648fac82c Upgrade to latest Rust. 2013-07-08 10:50:46 -06:00
Brian Anderson ea8d2bd026 Update for language changes 2013-06-25 19:45:15 -07:00
Jack Moffitt 5f4bdb2b08 Fix C FFI to use *mut pointers correctly and update code.
This was found because of unused mut warnings.
2013-05-09 11:13:20 -06:00
Patrick Walton 79afdda83a Update for language changes 2013-05-02 16:36:09 -07:00
Brian Anderson a8ebe76090 Add license headers 2013-04-04 19:01:35 -07:00
Jack Moffitt e9c5ee5c26 Change fail_unless! to assert!. 2013-03-26 16:44:16 -06:00
Jack Moffitt c8dd3d2096 Specify types on cast::transmute calls. 2013-03-26 16:17:54 -06:00
Jack Moffitt 648088bad4 Upgraded to Rust 0.6 syntax.
- removed pub from `pub impl A for B`
- replaced `const` with `static`
- implemented `Drop` and `Index` traits
- removed `pure` and `static` function keywords
- removed `DVec`
- added `self` parameters to methods
2013-03-26 16:17:39 -06:00
Patrick Walton 1152347b9f Update for language changes 2013-02-19 17:50:56 -08:00
Patrick Walton 01d8691bdf Update for language changes 2013-02-07 18:00:03 -08:00
Brian Anderson 990b275101 Rust upgrade 2013-01-30 14:33:26 -08:00
Brian J. Burg 04c0856f7d Implement AbstractCFType::type_id(). Switch to use CFTypeRef::downcast(). 2012-11-16 14:29:57 -08:00
Brian J. Burg 8af8ef0d6d Rewrite the Core Foundation wrapper system. 2012-11-16 11:03:26 -08:00
Brian J. Burg 7fcbf5112e Add binding for CFStringCreateWithBytes. 2012-11-12 19:22:20 -08:00
Brian J. Burg 3e5e34f4f4 Add support for getting floats out of CFNumber; add conversions from CFType to some other wrapper type; add AbstractCFType::type_id() 2012-11-09 15:01:34 -08:00
Brian J. Burg 22ff767266 Implement ToStr for CFString; fix off-by-one error in CFString::new_static; make clean now removes test binary. 2012-11-07 19:47:22 -08:00
Brian J. Burg a7eade7fc2 Add bindings for CFGetTypeID, CFHash, CFStringGetTypeID 2012-11-07 17:39:29 -08:00
Brian J. Burg f679a48102 Add all the CFString constants and enums. 2012-11-07 17:32:48 -08:00
Brian J. Burg 7f6dad8dd4 Add ALL the CFString function headers\!11 2012-11-07 16:11:42 -08:00
Brian J. Burg fde0ba88ec Change AbstractCFType::as_type_ref() to use get_ref(), and add AbstractCFTypeRef::as_CFTypeRef(). 2012-11-02 18:41:33 -07:00
Brian J. Burg 37ea78bb34 Clean up CFString; add borrow_ref experiment. 2012-11-02 17:21:41 -07:00
Brian J. Burg 13a2ef813a Rework base CF bindings, and add simple bindings for CFArray, CFURL, CFData. 2012-11-01 19:41:35 -07:00
Brian J. Burg a3ab85e4c2 Add UniChar typedef. 2012-10-19 18:12:03 -07:00
Patrick Walton 6ef2001b3c Update to newest Rust 2012-10-18 17:03:47 -07:00
Patrick Walton 007b583183 Update for new exports 2012-09-27 10:49:03 -07:00
Patrick Walton be4e26b2c7 Update for standard library changes 2012-09-20 10:02:03 -07:00
Brian J. Burg 94c7437779 Fix upstream build breaks by changing uses of reinterpret_cast to pass by reference. 2012-09-04 18:08:59 -07:00
Patrick Walton 4d402a7937 Add booleans and refactor to support existential types.
This allows dictionaries to contain values of multiple CFTypes, while remaining
type-safe.
2012-08-30 18:43:43 -07:00
Patrick Walton 0225d54195 Initial commit 2012-08-30 17:41:23 -07:00