bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Patch/gui] NSCell -compare:


From: David Ayers
Subject: [Patch/gui] NSCell -compare:
Date: Sat, 27 Sep 2003 11:19:23 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5b) Gecko/20030827

Committed:

   * Source/NSCell.m (-compare:):  Compare the stringValue of
   NSCell's rather than their contents directly.

Cheers,
David

Index: Source/NSCell.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSCell.m,v
retrieving revision 1.147
diff -u -r1.147 NSCell.m
--- Source/NSCell.m     31 Jul 2003 23:52:09 -0000      1.147
+++ Source/NSCell.m     27 Sep 2003 09:04:27 -0000
@@ -1056,8 +1056,11 @@
   return [self menu];
 }
 
-/*
- * Comparing to Another NSCell
+/**
+ * Compares the reciever to another to another NSCell.
+ * The argument must be an NSCell sublclass and have
+ * the NSCellType NSTextCellType.  Returns the result
+ * of the comparison of each cell's stringVaule.
  */
 - (NSComparisonResult) compare: (id)otherCell
 {
@@ -1072,7 +1075,9 @@
       [NSException raise: NSBadComparisonException
                   format: @"Comparison between non-text cells"];
     }
-  return [_contents compare: ((NSCell*)otherCell)->_contents];
+  /* We shouldn't access instance variables directly as subclasses
+     may override stringValue to retrieve the value from somewhere else.  */
+  return [[self stringValue] compare: [(NSCell*)otherCell stringValue]];
 }
 
 /*

reply via email to

[Prev in Thread] Current Thread [Next in Thread]