diff --git a/SA_DiceErrorHandling.h b/SA_DiceErrorHandling.h deleted file mode 100644 index 9faf1b6..0000000 --- a/SA_DiceErrorHandling.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// SA_DiceErrorHandling.h -// -// Copyright (c) 2016 Said Achmiz. -// -// This software is licensed under the MIT license. -// See the file "LICENSE" for more information. - -#import - -@interface SA_DiceErrorHandler : NSObject - -+(void) addError:(NSString *)error - toExpression:(NSMutableDictionary *)expression; - -+(void) addErrorsFromExpression:(NSDictionary *)sourceExpression - toExpression:(NSMutableDictionary *)targetExpression; - -+(NSArray *) errorsForExpression:(NSDictionary *)expression; - -@end diff --git a/SA_DiceErrorHandling.m b/SA_DiceErrorHandling.m deleted file mode 100644 index efe65fd..0000000 --- a/SA_DiceErrorHandling.m +++ /dev/null @@ -1,50 +0,0 @@ -// -// SA_DiceErrorHandling.m -// -// Copyright (c) 2016 Said Achmiz. -// -// This software is licensed under the MIT license. -// See the file "LICENSE" for more information. - -#import "SA_DiceErrorHandling.h" - -#import "SA_DiceExpressionStringConstants.h" - -@implementation SA_DiceErrorHandler - -+(void) addError:(NSString *)error - toExpression:(NSMutableDictionary *)expression { - if (error == nil || expression == nil) { - return; - } - - if (expression[SA_DB_ERRORS] == nil) { - expression[SA_DB_ERRORS] = [NSMutableArray arrayWithObjects:error, nil]; - } else { - [expression[SA_DB_ERRORS] addObject:error]; - } -} - -// Top-level errors only (i.e. the expression tree is not traversed in search -// of deeper errors). -+(void) addErrorsFromExpression:(NSDictionary *)sourceExpression - toExpression:(NSMutableDictionary *)targetExpression { - if (sourceExpression == nil || targetExpression == nil) { - return; - } - - if (sourceExpression[SA_DB_ERRORS] == nil || [sourceExpression[SA_DB_ERRORS] count] == 0) { - // Do absolutely nothing; no errors to add. - } else if(targetExpression[SA_DB_ERRORS] == nil) { - targetExpression[SA_DB_ERRORS] = [NSMutableArray arrayWithArray:sourceExpression[SA_DB_ERRORS]]; - } else { - [targetExpression[SA_DB_ERRORS] addObjectsFromArray:sourceExpression[SA_DB_ERRORS]]; - } -} - -+(NSArray *) errorsForExpression:(NSDictionary *)expression { - return ([expression[SA_DB_ERRORS] count] > 0) ? expression[SA_DB_ERRORS] : nil; -} - - -@end