Skip to content

Commit

Permalink
Update property
Browse files Browse the repository at this point in the history
  • Loading branch information
gcasa committed Dec 27, 2024
1 parent 261ab0a commit 6c60a0e
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 106 deletions.
70 changes: 40 additions & 30 deletions GormObjCHeaderParser/OCProperty.h
Original file line number Diff line number Diff line change
@@ -1,35 +1,45 @@
/* OCMethod.h
*
* Copyright (C) 1999 Free Software Foundation, Inc.
*
* Author: Gregory John Casamento <[email protected]>
* 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.
*/

#include <Foundation/Foundation.h>

#include "GormObjCHeaderParser/OCIVar.h"

#ifndef INCLUDED_OCProperty_h
#define INCLUDED_OCProperty_h
/* Definition 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.
*/

#ifndef _OCProperty_h_INCLUDE
#define _OCProperty_h_INCLUDE

#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 */

102 changes: 26 additions & 76 deletions GormObjCHeaderParser/OCProperty.m
Original file line number Diff line number Diff line change
@@ -1,80 +1,30 @@
/* OCHeaderParser.m
*
* Copyright (C) 1999 Free Software Foundation, Inc.
*
* Author: Gregory John Casamento <[email protected]>
* 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.
*/


#include <Foundation/Foundation.h>

#include "GormObjCHeaderParser/ParserFunctions.h"
#include "GormObjCHeaderParser/OCProperty.h"
#include "GormObjCHeaderParser/NSScanner+OCHeaderParser.h"

@interface OCProperty (Private)

- (void) _strip;

@end
/* 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.
*/

#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

0 comments on commit 6c60a0e

Please sign in to comment.