summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/NSMutableDictionary+Store.h
blob: 26493a1b8fb4096c8389a3a9c4b0d103e88d9c1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
//  NSMutableDictionary+Store.h
//  SmartDeviceLink-iOS
//
//  Created by Muller, Alexander (A.) on 11/7/16.
//  Copyright © 2016 smartdevicelink. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "SDLMacros.h"
#import "SDLLogMacros.h"

NS_ASSUME_NONNULL_BEGIN

typedef NSString* SDLRPCParameterName SDL_SWIFT_ENUM;
typedef NSString* SDLEnum SDL_SWIFT_ENUM;

@interface NSDictionary (Store)

- (void)sdl_setObject:(nullable NSObject *)object forName:(SDLRPCParameterName)name;

- (nullable SDLEnum)sdl_enumForName:(SDLRPCParameterName)name error:(NSError * _Nullable *)error;
- (nullable NSArray<SDLEnum> *)sdl_enumsForName:(SDLRPCParameterName)name error:(NSError * _Nullable *)error;

/**
 *  @param classType expected class of returned object
 *  @param error if stored value isn't classType
 *  @return object of classType or nil
*/
- (nullable id)sdl_objectForName:(SDLRPCParameterName)name ofClass:(Class)classType error:(NSError * _Nullable *)error;

/**
 *  @param classType expected class of array objects
 *  @param error if array objects value isn't classType or stored objects aren't array
 *  @return return array of classType or nil
*/
- (nullable NSArray *)sdl_objectsForName:(SDLRPCParameterName)name ofClass:(Class)classType error:(NSError * _Nullable *)error;

@end

NS_ASSUME_NONNULL_END