| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE.md file. | |
| 4 | |
| 5 #import <Foundation/Foundation.h> | |
| 6 #import <UIKit/UIKit.h> | |
| 7 | |
| 8 #include "immi_service.h" | |
| 9 | |
| 10 @protocol Node <NSObject> | |
| 11 @end | |
| 12 | |
| 13 @protocol Patch <NSObject> | |
| 14 @property (readonly) bool changed; | |
| 15 @end | |
| 16 | |
| 17 @protocol NodePatch <Patch> | |
| 18 @property (readonly) bool replaced; | |
| 19 @property (readonly) bool updated; | |
| 20 @property (readonly) id <Node> previous; | |
| 21 @property (readonly) id <Node> current; | |
| 22 @end | |
| 23 | |
| 24 @interface Node : NSObject <Node> | |
| 25 - (bool)is:(Class)klass; | |
| 26 - (id)as:(Class)klass; | |
| 27 @end | |
| 28 | |
| 29 @class NodePatch; | |
| 30 | |
| 31 @protocol NodePresenter <NSObject> | |
| 32 - (void)presentNode:(Node*)node; | |
| 33 - (void)patchNode:(NodePatch*)patch; | |
| 34 @end | |
| 35 | |
| 36 @interface NodePatch : NSObject <NodePatch> | |
| 37 @property (readonly) bool changed; | |
| 38 @property (readonly) Node* previous; | |
| 39 @property (readonly) Node* current; | |
| 40 - (void)applyTo:(id <NodePresenter>)presenter; | |
| 41 - (bool)is:(Class)klass; | |
| 42 - (id)as:(Class)klass; | |
| 43 @end | |
| 44 | |
| 45 @interface BoolPatch : NSObject <Patch> | |
| 46 @property (readonly) bool changed; | |
| 47 @property (readonly) bool previous; | |
| 48 @property (readonly) bool current; | |
| 49 @end | |
| 50 | |
| 51 @interface Uint8Patch : NSObject <Patch> | |
| 52 @property (readonly) bool changed; | |
| 53 @property (readonly) uint8_t previous; | |
| 54 @property (readonly) uint8_t current; | |
| 55 @end | |
| 56 | |
| 57 @interface Uint16Patch : NSObject <Patch> | |
| 58 @property (readonly) bool changed; | |
| 59 @property (readonly) uint16_t previous; | |
| 60 @property (readonly) uint16_t current; | |
| 61 @end | |
| 62 | |
| 63 @interface Int8Patch : NSObject <Patch> | |
| 64 @property (readonly) bool changed; | |
| 65 @property (readonly) int8_t previous; | |
| 66 @property (readonly) int8_t current; | |
| 67 @end | |
| 68 | |
| 69 @interface Int16Patch : NSObject <Patch> | |
| 70 @property (readonly) bool changed; | |
| 71 @property (readonly) int16_t previous; | |
| 72 @property (readonly) int16_t current; | |
| 73 @end | |
| 74 | |
| 75 @interface Int32Patch : NSObject <Patch> | |
| 76 @property (readonly) bool changed; | |
| 77 @property (readonly) int32_t previous; | |
| 78 @property (readonly) int32_t current; | |
| 79 @end | |
| 80 | |
| 81 @interface Int64Patch : NSObject <Patch> | |
| 82 @property (readonly) bool changed; | |
| 83 @property (readonly) int64_t previous; | |
| 84 @property (readonly) int64_t current; | |
| 85 @end | |
| 86 | |
| 87 @interface Float32Patch : NSObject <Patch> | |
| 88 @property (readonly) bool changed; | |
| 89 @property (readonly) float previous; | |
| 90 @property (readonly) float current; | |
| 91 @end | |
| 92 | |
| 93 @interface Float64Patch : NSObject <Patch> | |
| 94 @property (readonly) bool changed; | |
| 95 @property (readonly) double previous; | |
| 96 @property (readonly) double current; | |
| 97 @end | |
| 98 | |
| 99 @interface StringPatch : NSObject <Patch> | |
| 100 @property (readonly) bool changed; | |
| 101 @property (readonly) NSString* previous; | |
| 102 @property (readonly) NSString* current; | |
| 103 @end | |
| 104 | |
| 105 @interface ListRegionPatch : NSObject | |
| 106 @property (readonly) bool isRemove; | |
| 107 @property (readonly) bool isInsert; | |
| 108 @property (readonly) bool isUpdate; | |
| 109 @property (readonly) int index; | |
| 110 @end | |
| 111 | |
| 112 @interface ListRegionRemovePatch : ListRegionPatch | |
| 113 @property (readonly) int count; | |
| 114 @end | |
| 115 | |
| 116 @interface ListRegionInsertPatch : ListRegionPatch | |
| 117 @property (readonly) NSArray* nodes; | |
| 118 @end | |
| 119 | |
| 120 @interface ListRegionUpdatePatch : ListRegionPatch | |
| 121 @property (readonly) NSArray* updates; | |
| 122 @end | |
| 123 | |
| 124 @interface ListPatch : NSObject <Patch> | |
| 125 @property (readonly) bool changed; | |
| 126 @property (readonly) NSArray* regions; | |
| 127 @property (readonly) NSArray* previous; | |
| 128 @property (readonly) NSArray* current; | |
| 129 @end | |
| 130 | |
| 131 typedef void (^ImmiDispatchBlock)(); | |
| 132 | |
| 133 @interface ImmiRoot : NSObject | |
| 134 - (void)refresh; | |
| 135 - (void)reset; | |
| 136 - (void)dispatch:(ImmiDispatchBlock)block; | |
| 137 @end | |
| 138 | |
| 139 @interface ImmiService : NSObject | |
| 140 - (ImmiRoot*)registerPresenter:(id <NodePresenter>)presenter | |
| 141 forName:(NSString*)name; | |
| 142 - (void)registerStoryboard:(UIStoryboard*)storyboard; | |
| 143 - (ImmiRoot*)getRootByName:(NSString*)name; | |
| 144 - (id <NodePresenter>)getPresenterByName:(NSString*)name; | |
| 145 @end | |
| OLD | NEW |