[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Gorm bug (with patch)
From: |
Ludovic Marcotte |
Subject: |
Gorm bug (with patch) |
Date: |
Sat, 27 Oct 2001 19:53:07 -0400 (EDT) |
Hi,
Let's say you define two action of your responder class in Gorm:
testA
testB:
When you generate the source code and the header for this class, the
header will contain:
...
- (void) test: (id)sender;
- (void) testB: (id)sender;
...
and the source file:
...
- (void) testA: (id)sender
{
/* insert your code here */
}
- (void) testB:: (id)sender
{
/* insert your code here */
}
...
Which is wrong. The problem is in GormClassManager:
- (BOOL) makeSourceAndHeaderFilesForClass: (NSString*)className
withName: (NSString*)sourcePath
and: (NSString*)headerPath
We have:
...
for (i = 0; i < n; i++)
{
actionName = [actions objectAtIndex: i];
actionName = [actionName substringToIndex: [actionName length] - 1];
[headerFile appendFormat: @"- (void) %@: (id)sender;\n",
actionName];
[sourceFile appendFormat:
@"\n"
@"- (void) %@: (id)sender\n"
@"{\n"
@" /* insert your code here */\n"
@"}\n"
@"\n"
, [actions objectAtIndex: i]];
}
...
and it should be instead:
...
for (i = 0; i < n; i++)
{
actionName = [actions objectAtIndex: i];
if ([actionName hasSuffix: @":"])
actionName = [actionName substringToIndex: [actionName length] -
1];
[headerFile appendFormat: @"- (void) %@: (id)sender;\n",
actionName];
[sourceFile appendFormat:
@"\n"
@"- (void) %@: (id)sender\n"
@"{\n"
@" /* insert your code here */\n"
@"}\n"
@"\n"
, actionName];
}
...
So that we don't trim the last character for no reason but only if ":" is
present and that we use this right action name in the source too.
Ludo
--
Live as if you were to die tomorrow.
Learn as if you were to live forever.
- Gandhi
- Gorm bug (with patch),
Ludovic Marcotte <=