bugGNUstep - Bugs: bug #22277, KVC should handle common structs...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #22277: KVC should handle common structs like NSSize, NSRect etc.

Submitted by:  Quentin Mathé <qmathe>
Submitted on:  Sun 10 Feb 2008 03:16:03 PM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: BugStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Fri 22 Feb 2008 02:27:52 PM UTC, comment #4:

Works well now. Thanks Richard.

Quentin Mathé <qmathe>
Project Member
Fri 22 Feb 2008 01:03:16 PM UTC, comment #3:

> Why the return type includes human readable stuff like
> '{_NSRect={_NSPoint=ff}{_NSSize=ff}}' in addition to '12@4:8' for NSRect?


Good question ... the type information really should not include the size info at the end ... that's because it's using a pointer into the original cstring rather than creating a nul terminated string containing just the type info.

I've changed the code to produce proper nul terminated type strings. Hopefully nothing depends on the old behavior.

Richard Frith-Macdonald <CaS>
Project Member
Fri 22 Feb 2008 12:25:50 AM UTC, comment #2:

Thanks for implementing this feature.
I just tested it, but it doesn't work as expected.

If I add the following log statement at line 1764 of GSObjCRuntime.m: NSLog(@"encode rect %s point %s type %s", @encode(NSRect), @encode(NSPoint), type));

I observe that -[NSMethodSignature methodReturnType] doesn't exactly match @encode values for NSRect, NSPoint etc.

Here is the output I get:
2008-02-22 01:08:21.110 ObjectManagerExample[16975] encode rect {_NSRect={_NSPoint=ff}{_NSSize=ff}} point {_NSPoint=ff} type {_NSRect={_NSPoint=ff}{_NSSize=ff}}12@4:8
ObjectManagerExample.app/ObjectManagerExample: Uncaught exception NSInvalidArgumentException, reason: key-value get method unsupported struct

Why the return type includes human readable stuff like '{_NSRect={_NSPoint=ff}{_NSSize=ff}}' in addition to '12@4:8' for NSRect?

Quentin Mathé <qmathe>
Project Member
Wed 20 Feb 2008 03:15:24 PM UTC, comment #1:

I added code which should implement these structures ... perhaps you can test it?

Richard Frith-Macdonald <CaS>
Project Member
Sun 10 Feb 2008 03:16:03 PM UTC, original submission:

With gnustep-base trunk r26014

KVC on Mac OS X (Cocoa) takes care of handling common structs like NSPoint, NSRange, NSSize and NSRect in -setValue:forKey: when you pass them boxed in an NSValue. In the reverse way, it takes care of returning common structs boxed in an NSValue when you call -valueForKey:.

On GNUstep, such handling is missing, so for example an exception is raised by GSObjcSetVal() if you do:
[myObject setValue: [NSValue valueWithSize: NSMakeSize(32, 32)] forKey: @"size"];

Quentin.

Quentin Mathé <qmathe>
Project Member

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by CaS (Posted a comment)
  • -unavailable- added by qmathe (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 22 Feb 2008 03:59:27 PM UTCCaSOpen/ClosedIn Test=>Closed
    Wed 20 Feb 2008 03:15:24 PM UTCCaSStatusNone=>Fixed
      Open/ClosedOpen=>In Test

    Back to the top


    Powered by Savane 3.1-cleanup1