home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / OPENSTEP / UNIX / Programming / class-dump-2.1.1-MIS / src / ObjcMethod.m < prev    next >
Encoding:
Text File  |  1997-12-07  |  2.1 KB  |  90 lines

  1. //
  2. // $Id: ObjcMethod.m,v 1.2 1997/12/07 22:31:45 nygard Exp $
  3. //
  4.  
  5. //
  6. //  This file is a part of class-dump v2, a utility for examining the
  7. //  Objective-C segment of Mach-O files.
  8. //  Copyright (C) 1997  Steve Nygard
  9. //
  10. //  This program is free software; you can redistribute it and/or modify
  11. //  it under the terms of the GNU General Public License as published by
  12. //  the Free Software Foundation; either version 2 of the License, or
  13. //  (at your option) any later version.
  14. //
  15. //  This program is distributed in the hope that it will be useful,
  16. //  but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18. //  GNU General Public License for more details.
  19. //
  20. //  You should have received a copy of the GNU General Public License
  21. //  along with this program; if not, write to the Free Software
  22. //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23. //
  24. //  You may contact the author by:
  25. //     e-mail:  nygard@telusplanet.net
  26. //
  27.  
  28. #import "ObjcMethod.h"
  29. #include "datatypes.h"
  30.  
  31. @implementation ObjcMethod
  32.  
  33. - initWithMethodName:(NSString *)methodName type:(NSString *)methodType
  34. {
  35.     if ([self initWithMethodName:methodName type:methodType address:0] == nil)
  36.         return nil;
  37.     
  38.     is_protocol_method = YES;
  39.  
  40.     return self;
  41. }
  42.  
  43. - initWithMethodName:(NSString *)methodName type:(NSString *)methodType address:(long)methodAddress
  44. {
  45.     [super init];
  46.  
  47.     method_name = [methodName retain];
  48.     method_type = [methodType retain];
  49.     method_address = methodAddress;
  50.     is_protocol_method = NO;
  51.  
  52.     return self;
  53. }
  54.  
  55. - (void) dealloc
  56. {
  57.     [method_name release];
  58.     [method_type release];
  59.     
  60.     [super dealloc];
  61. }
  62.  
  63. - (NSString *) description
  64. {
  65.     return [NSString stringWithFormat:@"%@/%@\t// %x", method_name, method_type, method_address];
  66. }
  67.  
  68. - (NSString *) methodName
  69. {
  70.     return method_name;
  71. }
  72.  
  73. - (long) address
  74. {
  75.     return method_address;
  76. }
  77.  
  78. - (void) showMethod:(char)prefix
  79. {
  80.     format_method (prefix, [method_name cString], [method_type cString]);
  81. }
  82.  
  83. - (NSComparisonResult) orderByMethodName:(ObjcMethod *)otherMethod
  84. {
  85.     return [method_name compare:[otherMethod methodName]];
  86. }
  87.  
  88.  
  89. @end
  90.