-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectNode.h
More file actions
59 lines (48 loc) · 1.85 KB
/
ObjectNode.h
File metadata and controls
59 lines (48 loc) · 1.85 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// ObjectNode.h
// CommonViewControllers
//
// Created by Lessica <82flex@gmail.com> on 2022/1/20.
// Copyright © 2022 Zheng Wu. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef NS_ENUM (NSUInteger, ObjectNodeType) {
ObjectNodeTypeUnknown,
ObjectNodeTypeNull,
ObjectNodeTypeArray,
ObjectNodeTypeDictionary,
ObjectNodeTypeBoolean,
ObjectNodeTypeDate,
ObjectNodeTypeData,
ObjectNodeTypeNumber,
ObjectNodeTypeString,
};
@interface ObjectNode : NSObject <NSCopying, NSSecureCoding>
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithPropertyList:(id)obj;
@property (nonatomic, copy) NSString *key;
@property (nonatomic) ObjectNodeType type;
@property (nonatomic, strong) NSObject <NSCopying, NSSecureCoding> *value;
@property (nonatomic, strong) NSMutableArray <ObjectNode *> *children;
- (ObjectNode *)childNodeContainingDescendantNode:(ObjectNode *)descendantNode;
- (ObjectNode *)childNodeForKey:(NSString *)key;
- (ObjectNode *)childNodeForVisibleKey:(NSString *)key;
@property (nonatomic, weak) ObjectNode *parent;
@property (nonatomic, strong, readonly) id propertyList;
#pragma mark - Outline View Related
@property (nonatomic, assign, getter=isExpanded) BOOL expanded;
- (void)setExpanded:(BOOL)expanded recursively:(BOOL)recursively;
- (BOOL)isContainerNode;
- (BOOL)isLeafNode;
- (BOOL)isNodeOfArray;
- (BOOL)isVisible;
- (NSInteger)levelOfDescendants;
- (NSInteger)numberOfDescendants;
- (ObjectNode *)descendantNodeAtIndex:(NSInteger)index;
- (NSInteger)indexOfDescendantNode:(ObjectNode *)descendantNode;
#pragma mark - Search Related
@property (nonatomic, copy, readonly) NSString *visibleKey;
- (ObjectNode *)descendantNodeForVisibleKey:(NSString *)visibleKey;
- (void)updateVisibleStateWithPredicate:(NSPredicate *)predicate;
- (void)expandToDescendantNode:(ObjectNode *)descendantNode;
@end