OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COURGETTE_COURGETTE_FLOW_H_ | 5 #ifndef COURGETTE_COURGETTE_FLOW_H_ |
6 #define COURGETTE_COURGETTE_FLOW_H_ | 6 #define COURGETTE_COURGETTE_FLOW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 private: | 118 private: |
119 // Utilities to process return values from Courgette functions, and assign | 119 // Utilities to process return values from Courgette functions, and assign |
120 // |status_| and |message_|. Usage: | 120 // |status_| and |message_|. Usage: |
121 // if (!check(some_courgette_function(param1, ...))) | 121 // if (!check(some_courgette_function(param1, ...))) |
122 // setMessage("format string %s...", value1, ...); | 122 // setMessage("format string %s...", value1, ...); |
123 | 123 |
124 // Reassigns |status_|, and returns true if |C_OK|. | 124 // Reassigns |status_|, and returns true if |C_OK|. |
125 bool check(Status new_status); | 125 bool check(Status new_status); |
126 | 126 |
127 // check() alternative for functions that return true on succes. On failure | 127 // check() alternative for functions that return true on success. On failure |
128 // assigns |status_| to |failure_mode|. | 128 // assigns |status_| to |failure_mode|. |
129 bool check(bool success, Status failure_mode); | 129 bool check(bool success, Status failure_mode); |
130 | 130 |
131 void setMessage(const char* format, ...); | 131 void setMessage(const char* format, ...); |
132 | 132 |
133 Status status_ = C_OK; | 133 Status status_ = C_OK; |
134 std::string message_; | 134 std::string message_; |
135 Data data_only_; | 135 Data data_only_; |
136 Data data_old_; | 136 Data data_old_; |
137 Data data_new_; | 137 Data data_new_; |
138 | 138 |
139 DISALLOW_COPY_AND_ASSIGN(CourgetteFlow); | 139 DISALLOW_COPY_AND_ASSIGN(CourgetteFlow); |
140 }; | 140 }; |
141 | 141 |
142 } // namespace courgette | 142 } // namespace courgette |
143 | 143 |
144 #endif // COURGETTE_COURGETTE_FLOW_H_ | 144 #endif // COURGETTE_COURGETTE_FLOW_H_ |
OLD | NEW |