Line data Source code
1 : /* File: ctrl_controller.inl; Copyright and License: see below */
2 :
3 55 : static inline ctrl_classifier_controller_t *ctrl_controller_get_classifier_control_ptr ( ctrl_controller_t *this_ )
4 : {
5 55 : return &( (*this_).classifiers );
6 : }
7 :
8 61 : static inline ctrl_diagram_controller_t *ctrl_controller_get_diagram_control_ptr ( ctrl_controller_t *this_ )
9 : {
10 61 : return &( (*this_).diagrams );
11 : }
12 :
13 3 : static inline u8_error_t ctrl_controller_transaction_begin ( ctrl_controller_t *this_ )
14 : {
15 : /* do not sent notifications while an explicitly requested transaction is active */
16 3 : data_change_notifier_enable_stealth_mode( data_database_get_notifier_ptr( (*this_).database ) );
17 :
18 3 : return data_database_transaction_begin( (*this_).database );
19 : }
20 :
21 3 : static inline u8_error_t ctrl_controller_transaction_commit ( ctrl_controller_t *this_ )
22 : {
23 3 : const u8_error_t result = data_database_transaction_commit( (*this_).database );
24 :
25 : /* do sent notifications when committing an explicitly requested transaction */
26 3 : data_change_notifier_disable_stealth_mode( data_database_get_notifier_ptr( (*this_).database ) );
27 :
28 3 : return result;
29 : }
30 :
31 : /* ================================ interface for undo redo ================================ */
32 :
33 146 : static inline u8_error_t ctrl_controller_undo ( ctrl_controller_t *this_, data_stat_t *io_stat )
34 : {
35 146 : assert ( NULL != io_stat );
36 146 : return ctrl_undo_redo_list_undo( &((*this_).undo_redo_list), io_stat );
37 : }
38 :
39 16 : static inline u8_error_t ctrl_controller_redo ( ctrl_controller_t *this_, data_stat_t *io_stat )
40 : {
41 16 : assert ( NULL != io_stat );
42 16 : return ctrl_undo_redo_list_redo( &((*this_).undo_redo_list), io_stat );
43 : }
44 :
45 3 : static inline u8_error_t ctrl_controller_get_undo_iterator ( const ctrl_controller_t *this_,
46 : ctrl_undo_redo_iterator_t *out_undo_iterator )
47 : {
48 3 : assert ( NULL != out_undo_iterator );
49 3 : return ctrl_undo_redo_list_get_undo_iterator( &((*this_).undo_redo_list), out_undo_iterator );
50 : }
51 :
52 0 : static inline u8_error_t ctrl_controller_get_redo_iterator ( const ctrl_controller_t *this_,
53 : ctrl_undo_redo_iterator_t *out_redo_iterator )
54 : {
55 0 : assert ( NULL != out_redo_iterator );
56 0 : return ctrl_undo_redo_list_get_redo_iterator( &((*this_).undo_redo_list), out_redo_iterator );
57 : }
58 :
59 2 : static inline void ctrl_controller_reset_undo_redo_list ( ctrl_controller_t *this_ )
60 : {
61 2 : ctrl_undo_redo_list_clear ( &((*this_).undo_redo_list) );
62 2 : }
63 :
64 : /* ================================ interface for database file ================================ */
65 :
66 30 : static inline u8_error_t ctrl_controller_repair_database ( ctrl_controller_t *this_,
67 : bool modify_db,
68 : uint32_t *out_err,
69 : uint32_t *out_fix,
70 : utf8stream_writer_t *out_english_report )
71 : {
72 : const u8_error_t result
73 30 : = ctrl_consistency_checker_repair_database( &((*this_).consistency_checker),
74 : modify_db,
75 : out_err,
76 : out_fix,
77 : out_english_report
78 : );
79 30 : return result;
80 : }
81 :
82 : /*
83 : Copyright 2016-2025 Andreas Warnke
84 :
85 : Licensed under the Apache License, Version 2.0 (the "License");
86 : you may not use this file except in compliance with the License.
87 : You may obtain a copy of the License at
88 :
89 : http://www.apache.org/licenses/LICENSE-2.0
90 :
91 : Unless required by applicable law or agreed to in writing, software
92 : distributed under the License is distributed on an "AS IS" BASIS,
93 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
94 : See the License for the specific language governing permissions and
95 : limitations under the License.
96 : */
|