mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-24 23:11:04 +00:00
Update property
This commit is contained in:
parent
261ab0a1de
commit
6c60a0e4b9
2 changed files with 61 additions and 101 deletions
|
@ -1,35 +1,45 @@
|
|||
/* OCMethod.h
|
||||
*
|
||||
* Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
* Date: 1999, 2002
|
||||
*
|
||||
* This file is part of GNUstep.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* Definition of class OCProperty
|
||||
Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento
|
||||
Date: 27-12-2024
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110 USA.
|
||||
*/
|
||||
|
||||
#include "GormObjCHeaderParser/OCIVar.h"
|
||||
#ifndef _OCProperty_h_INCLUDE
|
||||
#define _OCProperty_h_INCLUDE
|
||||
|
||||
#ifndef INCLUDED_OCProperty_h
|
||||
#define INCLUDED_OCProperty_h
|
||||
#import "OCIVar.h"
|
||||
#import <GNUstepBase/GSVersionMacros.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GS_EXPORT_CLASS
|
||||
@interface OCProperty : OCIVar
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OCProperty_h_INCLUDE */
|
||||
|
||||
|
|
|
@ -1,80 +1,30 @@
|
|||
/* OCHeaderParser.m
|
||||
*
|
||||
* Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
* Date: 1999, 2002
|
||||
*
|
||||
* This file is part of GNUstep.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* Implementation of class OCProperty
|
||||
Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento
|
||||
Date: 27-12-2024
|
||||
|
||||
This file is part of GNUstep.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
#include "GormObjCHeaderParser/ParserFunctions.h"
|
||||
#include "GormObjCHeaderParser/OCProperty.h"
|
||||
#include "GormObjCHeaderParser/NSScanner+OCHeaderParser.h"
|
||||
|
||||
@interface OCProperty (Private)
|
||||
|
||||
- (void) _strip;
|
||||
|
||||
@end
|
||||
#import "OCProperty.h"
|
||||
|
||||
@implementation OCProperty
|
||||
|
||||
- (void) parse
|
||||
{
|
||||
NSCharacterSet *wsnl = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||
NSScanner *scanner = nil;
|
||||
NSString *tempName = nil;
|
||||
|
||||
[self _strip];
|
||||
scanner = [NSScanner scannerWithString: ivarString];
|
||||
[scanner setCharactersToBeSkipped: [NSCharacterSet characterSetWithCharactersInString: @"*"]];
|
||||
if(lookAhead(ivarString,@"IBOutlet"))
|
||||
{
|
||||
[scanner scanUpToAndIncludingString: @"IBOutlet" intoString: NULL]; // return type
|
||||
[scanner scanCharactersFromSet: wsnl intoString: NULL];
|
||||
[scanner scanUpToCharactersFromSet: wsnl intoString: NULL]; // typespec...
|
||||
[scanner scanCharactersFromSet: wsnl intoString: NULL];
|
||||
[scanner scanUpToCharactersFromSet: wsnl intoString: &tempName]; // variable name...
|
||||
[self setIsOutlet: YES];
|
||||
}
|
||||
else if(lookAheadForToken(ivarString, @"id"))
|
||||
{
|
||||
[scanner scanUpToCharactersFromSet: wsnl intoString: NULL]; // id
|
||||
[scanner scanCharactersFromSet: wsnl intoString: NULL];
|
||||
[scanner scanUpToCharactersFromSet: wsnl intoString: &tempName]; // id
|
||||
[self setIsOutlet: YES];
|
||||
}
|
||||
else // for everything else...
|
||||
{
|
||||
[scanner scanUpToCharactersFromSet: wsnl intoString: NULL];
|
||||
[scanner scanCharactersFromSet: wsnl intoString: NULL];
|
||||
[scanner scanUpToCharactersFromSet: wsnl intoString: &tempName];
|
||||
}
|
||||
|
||||
// fix name...
|
||||
scanner = [NSScanner scannerWithString: tempName];
|
||||
[scanner setCharactersToBeSkipped: [NSCharacterSet characterSetWithCharactersInString: @"*"]];
|
||||
// [scanner scanUpToCharactersFromSet: wsnl intoString: &name];
|
||||
name = [tempName stringByTrimmingCharactersInSet: wsnl];
|
||||
RETAIN(name);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
Loading…
Reference in a new issue