From b35ce5e20508a035f64e59f04326828fab1b377e Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Sat, 8 Jul 2023 12:53:09 -0400 Subject: [PATCH] Add capability to dump class and connection information using gormtool --- GormCore/GormClassManager.h | 1 + GormCore/GormClassManager.m | 5 +++++ GormCore/GormDocument.h | 5 +++++ Tools/gormtool/AppDelegate.m | 35 ++++++++++++++++++++++++++++++++++- 4 files changed, 45 insertions(+), 1 deletion(-) diff --git a/GormCore/GormClassManager.h b/GormCore/GormClassManager.h index 53b6cec7..49d75a94 100644 --- a/GormCore/GormClassManager.h +++ b/GormCore/GormClassManager.h @@ -120,6 +120,7 @@ - (BOOL) isAction: (NSString *)actionName onCategoryForClassNamed: (NSString *)className; - (NSString *) classNameForObject: (id)object; - (NSString *) findClassByName: (NSString *)name; +- (NSDictionary *) classInformation; /* Parsing and creating classes */ - (BOOL) makeSourceAndHeaderFilesForClass: (NSString *)className diff --git a/GormCore/GormClassManager.m b/GormCore/GormClassManager.m index a8510aa8..214b88f4 100644 --- a/GormCore/GormClassManager.m +++ b/GormCore/GormClassManager.m @@ -2260,6 +2260,11 @@ return className; } +- (NSDictionary *) classInformation +{ + return classInformation; +} + - (NSString *) description { return [NSString stringWithFormat: @"<%s: %lx> = %@", diff --git a/GormCore/GormDocument.h b/GormCore/GormDocument.h index b61f7c0a..964af862 100644 --- a/GormCore/GormDocument.h +++ b/GormCore/GormDocument.h @@ -299,6 +299,11 @@ /* Connections */ +/** + * + */ +- (NSMutableArray *) connections; + /** * Build our reverse mapping information and other initialisation */ diff --git a/Tools/gormtool/AppDelegate.m b/Tools/gormtool/AppDelegate.m index ddea70bd..d7467683 100644 --- a/Tools/gormtool/AppDelegate.m +++ b/Tools/gormtool/AppDelegate.m @@ -122,6 +122,24 @@ [pair setArgument: obj]; parse_val = YES; } + + if ([obj isEqualToString: @"--connections"]) + { + [pair setArgument: obj]; + parse_val = NO; + } + + if ([obj isEqualToString: @"--classes"]) + { + [pair setArgument: obj]; + parse_val = NO; + } + + // If there is no parameter for the argument, set it anyway... + if (parse_val == NO) + { + [result setObject: pair forKey: obj]; + } } } @@ -136,7 +154,7 @@ if ([[pi arguments] count] > 1) { - NSString *file = nil; // [[pi arguments] lastObject]; + NSString *file = nil; NSString *outputPath = @"./"; GormDocumentController *dc = [GormDocumentController sharedDocumentController]; GormDocument *doc = nil; @@ -225,6 +243,21 @@ [cm parseHeader: classFile]; } + + opt = [args objectForKey: @"--connections"]; + if (opt != nil) + { + NSArray *connections = [doc connections]; + NSLog(@"connections = %@", connections); + } + + opt = [args objectForKey: @"--classes"]; + if (opt != nil) + { + NSDictionary *classes = [[doc classManager] classInformation]; + NSLog(@"classes = %@", classes); + } + // These options sound always be processed last... opt = [args objectForKey: @"--write"]; if (opt != nil)