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 2 : 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 2 : data_change_notifier_enable_stealth_mode( data_database_get_notifier_ptr( (*this_).database ) ); 17 : 18 2 : return data_database_transaction_begin( (*this_).database ); 19 : } 20 : 21 2 : static inline u8_error_t ctrl_controller_transaction_commit ( ctrl_controller_t *this_ ) 22 : { 23 2 : const u8_error_t result = data_database_transaction_commit( (*this_).database ); 24 : 25 : /* do sent notifications when committing an explicitly requested transaction */ 26 2 : data_change_notifier_disable_stealth_mode( data_database_get_notifier_ptr( (*this_).database ) ); 27 : 28 2 : 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_statistics ( ctrl_controller_t *this_, data_stat_t *io_stat ) 46 : { 47 3 : assert ( NULL != io_stat ); 48 3 : return ctrl_undo_redo_list_get_last_statistics( &((*this_).undo_redo_list), io_stat ); 49 : } 50 : 51 : /* ================================ interface for database file ================================ */ 52 : 53 30 : static inline u8_error_t ctrl_controller_repair_database ( ctrl_controller_t *this_, 54 : bool modify_db, 55 : uint32_t *out_err, 56 : uint32_t *out_fix, 57 : utf8stream_writer_t *out_english_report ) 58 : { 59 : const u8_error_t result 60 30 : = ctrl_consistency_checker_repair_database( &((*this_).consistency_checker), 61 : modify_db, 62 : out_err, 63 : out_fix, 64 : out_english_report 65 : ); 66 30 : return result; 67 : } 68 : 69 : /* 70 : Copyright 2016-2024 Andreas Warnke 71 : 72 : Licensed under the Apache License, Version 2.0 (the "License"); 73 : you may not use this file except in compliance with the License. 74 : You may obtain a copy of the License at 75 : 76 : http://www.apache.org/licenses/LICENSE-2.0 77 : 78 : Unless required by applicable law or agreed to in writing, software 79 : distributed under the License is distributed on an "AS IS" BASIS, 80 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 81 : See the License for the specific language governing permissions and 82 : limitations under the License. 83 : */