This is RTFExampleClass.m in view mode; [Download] [Up]
{\rtf0\ansi{\fonttbl\f3\fmodern Ohlfs;\f4\fmodern Courier;\f2\fswiss Helvetica;}
\margl40
\margr40
{\colortbl;\red17\green81\blue31;\red0\green0\blue0;\red0\green0\blue136;\red255\green0\blue3;\red85\green85\blue85;\red214\green0\blue3;}
\pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\f3\b0\i0\ulnone\fs20\gray221\fc1\cf1 /* RTFExampleClass.m \
*\
* This class servers as an example for how to layout Rich Sources\
* so that they are still parsable with the ClassEditor.\
*\
* For interface-info see the header file. The comments in this file mostly\
* cover only the real implementation details.\
\gray0\fc0\cf0 *\
* Written by: Thomas Engel\
* Created:
\fc2\cf2 20.01.1995
\fc0\cf0 (Copyleft)\
* Last modified:
\fc2\cf2 20.01.1995
\fc0\cf0 \
*/\
\
\f4\b\fs24\fc2\cf2 #define
\f3\b0\fs20\fc0\cf0 CURRENT_VERSION 1.2\
\
\f4\b\fs24\fc2\cf2 #import
\f3\b0\fs20\fc0\cf0 "RTFExampleClass.h"\
\f4\b\fs24\fc2\cf2 #import
\f3\b0\fs20\fc0\cf0 <misckit/MiscString.h>\
\
\f4\b\fs24\fc2\cf2 @implementation
\f3\b0\fs20\fc0\cf0 RTFExampleClass\
\
\gray57\fc3\cf3 + initialize\
\gray0\fc0\cf0 \{\
\f4\b\fs24\fc2\cf2 if
\f3\b0\fs20\fc0\cf0 ( self == [RTFExampleClass class] )\
[RTFExampleClass setVersion:CURRENT_VERSION];\
\
\f4\b\fs24\fc2\cf2 return
\f3\b0\fs20\fc0\cf0 self;\
\}\
\
\fc2\cf2 - init\
\fc0\cf0 \{\
[super init];\
\f4\b\fs24\fc2\cf2 return
\f3\b0\fs20\fc0\cf0 [self initFromText:[MiscString newWithString:"- myMethod:sender"]];\
\
\f2\fs24\gray300\fc4\cf4 // BUG: Memory leak ! Who frees this string ?\
// initFromText does not !\
\f3\fs20\gray0\fc0\cf0 \}\
\
\fc2\cf2 - initFromText:theLine\
\fc0\cf0 \{\
[super init];\
name = [MiscString new];\
[name takeStringValue:theLine];\
[name replaceEveryOccurrenceOf:";" with:" "];\
[name trimWhiteSpaces];\
\
\f2\fs24\gray333\fc5\cf5 // Now charAt:0 _MUST_ be the method type !!\
\f3\fs20\gray0\fc0\cf0 \
selectorName = [name copy];\
[selectorName replaceCharAt:0 withChar:' ']; \
[selectorName trimWhiteSpaces];\
\
return self;\
\}\
\
- free\
\{\
[selectorName free];\
\
\f2\fs24\gray300\fc4\cf4 // BUG: Really nasty guy...we don't really take care of all the \
// real bugs. We have forgoten about the name.\
// looks like there are more memory leaks too.\
\f3\fs20\gray0\fc0\cf0 \
\f4\b\fs24\fc2\cf2 return
\f3\b0\fs20\fc0\cf0 [super free];\
\}\
\
- (char *)name\
\{\
\f4\b\fs24\fc2\cf2 return
\f3\b0\fs20\fc0\cf0 [name stringValue];\
\}\
\
- (char *)selectorName\
\{\
\f2\fs24\gray333\fc5\cf5 // Now here nothing really happens...right ?\
// It would be nice if we had some me details on what with is all about....\
\
\f3\fs20\gray0\fc0\cf0
\f4\b\fs24\fc2\cf2 return
\f3\b0\fs20\fc0\cf0 [selectorName stringValue];\
\}\
\
- (BOOL)isInstanceMethod\
\{\
\f4\b\fs24\fc2\cf2 if
\f3\b0\fs20\fc0\cf0 ( [name charAt:0] == '+' )
\f4\b\fs24\fc2\cf2 return
\f3\b0\fs20\fc0\cf0
\fc2\cf2 NO
\fc0\cf0 ;\
\f4\b\fs24\fc2\cf2 return
\f3\b0\fs20\fc0\cf0 YES;\
\}\
\
- (void *)doNothing:(int)right butWithSpeed:forTesting;\
\{\
\f2\fs24\gray333\fc5\cf5 // stupid dummy !!!\
\f3\fs20\gray0\fc0\cf0 \}\
\f4\b\fs24\fc2\cf2 @end
\f3\b0\fs20\fc0\cf0 \
\
/*\
* History: 13.01.95 Buh\
* \
*\
*
\gray252\fc6\cf6 Bugs: - ...\
\gray0\fc0\cf0 */
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.