Permalink
Browse files

fixed to show only appropriate method on header file

  • Loading branch information...
1 parent de73257 commit 0715e829a7e9436c9cbe353ee73b9f010486c433 @tomohisa tomohisa committed Feb 26, 2012
Showing with 19 additions and 5 deletions.
  1. +2 −1 Classes/DescriptionBuilder.h
  2. +17 −4 Classes/DescriptionBuilder.m
@@ -20,6 +20,7 @@ typedef enum DescriptionStyle {
+ (NSString *)reflectDescription:(id)obj;
+ (NSString *)reflectDescription:(id)obj style:(DescriptionStyle)style;
-+ (NSString *)reflectDescription:(id)obj style:(DescriptionStyle)style targetClass:(Class)cls;
++ (NSString *)reflectDescriptionWithSuperClass:(id)obj;
++ (NSString *)reflectDescriptionWithSuperClass:(id)obj style:(DescriptionStyle)style;
@end
@@ -9,12 +9,25 @@
#import "DescriptionBuilder.h"
#import <objc/runtime.h>
+@interface DescriptionBuilder()
++ (NSString *)reflectDescription:(id)obj style:(DescriptionStyle)style targetClass:(Class)cls withSuperClass:(BOOL) superClassFlag;
+@end
+
@implementation DescriptionBuilder
+ (NSString *)reflectDescription:(id)obj {
return [DescriptionBuilder reflectDescription:obj style:DescriptionStyleDefault];
}
++ (NSString *)reflectDescriptionWithSuperClass:(id)obj {
+ return [DescriptionBuilder reflectDescription:obj style:DescriptionStyleDefault targetClass:[obj class] withSuperClass:YES];
+}
+
++ (NSString *)reflectDescriptionWithSuperClass:(id)obj style:(DescriptionStyle)style {
+ return [DescriptionBuilder reflectDescription:obj style:style targetClass:[obj class] withSuperClass:YES];
+}
+
+
/**
c char
C unsigned char
@@ -37,9 +50,9 @@ + (NSString *)reflectDescription:(id)obj {
{ 構造体
*/
+ (NSString *)reflectDescription:(id)obj style:(DescriptionStyle)style {
- return [DescriptionBuilder reflectDescription:obj style:style targetClass:[obj class]];
+ return [DescriptionBuilder reflectDescription:obj style:style targetClass:[obj class] withSuperClass:NO];
}
-+ (NSString *)reflectDescription:(id)obj style:(DescriptionStyle)style targetClass:(Class)cls{
++ (NSString *)reflectDescription:(id)obj style:(DescriptionStyle)style targetClass:(Class)cls withSuperClass:(BOOL) superClassFlag{
id objValue;
Class classValue;
SEL selValue;
@@ -233,9 +246,9 @@ + (NSString *)reflectDescription:(id)obj style:(DescriptionStyle)style targetCla
break;
}
}
- if (class_getSuperclass(cls)) {
+ if (superClassFlag && class_getSuperclass(cls)) {
[description appendString:@"\n"];
- [description appendString:[DescriptionBuilder reflectDescription:obj style:style targetClass:class_getSuperclass(cls)]];
+ [description appendString:[DescriptionBuilder reflectDescription:obj style:style targetClass:class_getSuperclass(cls) withSuperClass:superClassFlag]];
}
[description appendString:@">"];
if (outCount > 0) { free(ivars); }

0 comments on commit 0715e82

Please sign in to comment.