ARC: Update ns framework

This commit is contained in:
Allan Odgaard
2012-12-17 21:48:06 +01:00
parent 1eb54282af
commit 6bc36a565b
3 changed files with 10 additions and 8 deletions

View File

@@ -44,8 +44,8 @@ namespace ns
NSDictionary* to_dictionary (plist::any_t const& plist)
{
CFPropertyListRef res = plist::create_cf_property_list(plist);
NSDictionary* dict = (NSDictionary*)res;
return [dict autorelease];
NSDictionary* dict = (NSDictionary*)CFBridgingRelease(res);
return dict;
}
NSMutableDictionary* to_mutable_dictionary (plist::any_t const& plist)

View File

@@ -3,3 +3,6 @@ TEST_SOURCES = tests/*.{cc,mm}
LINK += text OakFoundation plist
FRAMEWORKS = Cocoa
EXPORT = src/*.h
OBJCXX_FLAGS += -fobjc-arc
LN_FLAGS += -fobjc-arc-cxxlib=libc++

View File

@@ -28,11 +28,10 @@
- (NSDictionary*)stringAttributes
{
static NSDictionary* attrs = [[NSDictionary dictionaryWithObjectsAndKeys:
[NSColor blackColor], NSForegroundColorAttributeName,
[NSFont userFixedPitchFontOfSize:12], NSFontAttributeName,
nil] retain];
return attrs;
return @{
NSFontAttributeName: [NSFont userFixedPitchFontOfSize:12],
NSForegroundColorAttributeName: [NSColor blackColor]
};
}
- (void)keyDown:(NSEvent*)anEvent
@@ -58,7 +57,7 @@ public:
void test_key_events ()
{
@autoreleasepool {
OakSetupApplicationWithView([[[MyEventView alloc] initWithFrame:NSMakeRect(0, 0, 200, 100)] autorelease], "key_events");
OakSetupApplicationWithView([[MyEventView alloc] initWithFrame:NSMakeRect(0, 0, 200, 100)], "key_events");
}
}
};