| 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 #ifndef TODOMVC_PRESENTER_H_ | |
| 6 #define TODOMVC_PRESENTER_H_ | |
| 7 | |
| 8 #include <inttypes.h> | |
| 9 | |
| 10 #include "todomvc_service.h" | |
| 11 | |
| 12 typedef uint16_t event; | |
| 13 | |
| 14 const uint8_t TAG_CONS_FST = 0; | |
| 15 const uint8_t TAG_CONS_SND = 1; | |
| 16 const uint8_t TAG_CONS_DELETE_EVENT = 2; | |
| 17 const uint8_t TAG_CONS_COMPLETE_EVENT = 3; | |
| 18 const uint8_t TAG_CONS_UNCOMPLETE_EVENT = 4; | |
| 19 | |
| 20 void VoidCallback(void*); | |
| 21 | |
| 22 class TodoMVCPresenter { | |
| 23 public: | |
| 24 // Async forwarding of commands to the Dart presenter. | |
| 25 void createItem(char* title); | |
| 26 void clearItems(); | |
| 27 | |
| 28 static void dispatch(event id); | |
| 29 | |
| 30 // Synchronize with the Dart presentation model. | |
| 31 void sync(); | |
| 32 | |
| 33 protected: | |
| 34 // Patch apply callbacks. | |
| 35 virtual void enterPatch() = 0; | |
| 36 virtual void enterConsFst() = 0; | |
| 37 virtual void enterConsSnd() = 0; | |
| 38 virtual void enterConsDeleteEvent() = 0; | |
| 39 virtual void enterConsCompleteEvent() = 0; | |
| 40 virtual void enterConsUncompleteEvent() = 0; | |
| 41 virtual void updateNode(const Node&) = 0; | |
| 42 | |
| 43 // Default patch apply procedure. | |
| 44 virtual void applyPatches(const PatchSet&); | |
| 45 virtual void applyPatch(const Patch&); | |
| 46 }; | |
| 47 | |
| 48 #endif // TODOMVC_PRESENTER_H_ | |
| OLD | NEW |