Removed more extraneous files
This commit is contained in:
parent
9fb58b6795
commit
9619e198b2
@ -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 <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
@interface SA_DiceErrorHandler : NSObject
|
|
||||||
|
|
||||||
+(void) addError:(NSString *)error
|
|
||||||
toExpression:(NSMutableDictionary *)expression;
|
|
||||||
|
|
||||||
+(void) addErrorsFromExpression:(NSDictionary *)sourceExpression
|
|
||||||
toExpression:(NSMutableDictionary *)targetExpression;
|
|
||||||
|
|
||||||
+(NSArray <NSString *> *) errorsForExpression:(NSDictionary *)expression;
|
|
||||||
|
|
||||||
@end
|
|
||||||
@ -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 <NSString *> 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 <NSString *> arrayWithArray:sourceExpression[SA_DB_ERRORS]];
|
|
||||||
} else {
|
|
||||||
[targetExpression[SA_DB_ERRORS] addObjectsFromArray:sourceExpression[SA_DB_ERRORS]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+(NSArray <NSString *> *) errorsForExpression:(NSDictionary *)expression {
|
|
||||||
return ([expression[SA_DB_ERRORS] count] > 0) ? expression[SA_DB_ERRORS] : nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
|
||||||
Loading…
Reference in New Issue
Block a user