Hi Stephan, Am 27.05.2010 22:45, schrieb Stephan Assmus:
< cut>
- entry_ref* OnClickFile() const; - void SetOnClickFile(const entry_ref* file); + const entry_ref* OnClickFile() const; + status_t SetOnClickFile(const entry_ref* file); - BList* OnClickRefs() const; - void AddOnClickRef(const entry_ref* ref); + status_t AddOnClickRef(const entry_ref* ref); + status_t AddOnClickRef(const entry_ref& ref);I wonder what's the point here in having two different signatures? I would expect the pointer one to take ownership of the passed entry_ref, while the reference one does a copy of the argument. Same for all other entry_ref* signatures.I don't agree that passing any const parameter signifies that the ownership is transfered. However having two versions is probably still bogus. I was wondering about it and then thought "ah... what the heck". :-)
I would have expected an implementation like Add(Child, Item, View), that means passing a non const entry_ref* and taking ower ownership. But yes, I'm still fine with your point of view. :)
BTW, one of our technical writer and API designer has written a small document on API design. Of course it is Qt related, but maybe it is a good read anyway.
http://www.scribd.com/doc/15361591/The-Little-Manual-of-API-Design-Jasmin-Blanchette-Trolltech And yes, it has a major typo somewhere in the middle ;) -- Karsten