Re: Docs by Contradiction: -isDocumentEdited vs. -updateChangeCount:
Re: Docs by Contradiction: -isDocumentEdited vs. -updateChangeCount:
- Subject: Re: Docs by Contradiction: -isDocumentEdited vs. -updateChangeCount:
- From: Corbin Dunn <email@hidden>
- Date: Tue, 19 Jan 2010 08:48:40 -0800
On Jan 18, 2010, at 9:14 AM, Jerry Krinock wrote:
> In documentation,
>
> updateChangeCount: "if the change count is 0, the document has no changes to save, and if the change count is greater than 0, the document has been edited and is unsaved"
>
> isDocumentEdited "Returns YES if the receiver has changes that have not been saved, NO otherwise."
>
> I could write better code if I had a more direct definition. If I interpret "document has been edited and is unsaved" to mean the same as "has changes that have not been saved", then the converse follows by contradiction and thus the implementation of -isDocumentEdited must be simply this:
>
> - (BOOL)isDocumentEdited
> {
> return (_changeCount > 0) ;
> }
>
> Am I correct?
Please log some documentation bugs to get this clarified from engineering so we can help you write better code. Ideally, provide an example of what you need and why.
The actual implementation of the method is more complex; it also deals with core data stuff currently being edited or not. But, it does do a != 0 compare, since undoes do make it go negative.
corbin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden