Line data Source code
1 : /* File: gui_type_resource_list.inl; Copyright and License: see below */ 2 : 3 : #include <assert.h> 4 : 5 0 : static inline gui_type_resource_t * gui_type_resource_list_get_diagram_type ( gui_type_resource_list_t *this_, 6 : data_diagram_type_t diag_type ) 7 : { 8 0 : gui_type_resource_t *result = &((*this_).type_undef); 9 0 : for ( unsigned int idx = 0; idx < (*this_).diagram_types_length; idx ++ ) 10 : { 11 0 : gui_type_resource_t * const current = &((*this_).type_name_icon_list[(*this_).diagram_types_start+idx]); 12 0 : if ( data_type_get_diagram_type( gui_type_resource_get_type_id( current ) ) == diag_type ) 13 : { 14 0 : result = current; 15 : } 16 : } 17 0 : return result; 18 : } 19 : 20 0 : static inline gui_type_resource_t * gui_type_resource_list_get_classifier_type ( gui_type_resource_list_t *this_, 21 : data_classifier_type_t clas_type ) 22 : { 23 0 : gui_type_resource_t *result = &((*this_).type_undef); 24 0 : for ( unsigned int idx = 0; idx < (*this_).classifier_types_length; idx ++ ) 25 : { 26 0 : gui_type_resource_t * const current = &((*this_).type_name_icon_list[(*this_).classifier_types_start+idx]); 27 0 : if ( data_type_get_classifier_type( gui_type_resource_get_type_id( current ) ) == clas_type ) 28 : { 29 0 : result = current; 30 : } 31 : } 32 0 : return result; 33 : } 34 : 35 0 : static inline gui_type_resource_t * gui_type_resource_list_get_feature_type ( gui_type_resource_list_t *this_, 36 : data_feature_type_t feat_type ) 37 : { 38 0 : gui_type_resource_t *result = &((*this_).type_undef); 39 0 : for ( unsigned int idx = 0; idx < (*this_).feature_types_length; idx ++ ) 40 : { 41 0 : gui_type_resource_t * const current = &((*this_).type_name_icon_list[(*this_).feature_types_start+idx]); 42 0 : if ( data_type_get_feature_type( gui_type_resource_get_type_id( current ) ) == feat_type ) 43 : { 44 0 : result = current; 45 : } 46 : } 47 0 : return result; 48 : } 49 : 50 0 : static inline gui_type_resource_t * gui_type_resource_list_get_relationship_type ( gui_type_resource_list_t *this_, 51 : data_relationship_type_t rel_type ) 52 : { 53 0 : gui_type_resource_t *result = &((*this_).type_undef); 54 0 : for ( unsigned int idx = 0; idx < (*this_).relationship_types_length; idx ++ ) 55 : { 56 0 : gui_type_resource_t * const current = &((*this_).type_name_icon_list[(*this_).relationship_types_start+idx]); 57 0 : if ( data_type_get_relationship_type( gui_type_resource_get_type_id( current ) ) == rel_type ) 58 : { 59 0 : result = current; 60 : } 61 : } 62 0 : return result; 63 : } 64 : 65 0 : static inline void gui_type_resource_list_get_all_diagram_types ( const gui_type_resource_list_t *this_, 66 : const gui_type_resource_t (**out_types)[], 67 : unsigned int *out_length ) 68 : { 69 0 : assert( out_types != NULL ); 70 0 : assert( out_length != NULL ); 71 0 : const gui_type_resource_t *start_element_ptr = &((*this_).type_name_icon_list[(*this_).diagram_types_start]); 72 0 : *out_types = (const gui_type_resource_t((*)[])) start_element_ptr; 73 0 : *out_length = (*this_).diagram_types_length; 74 0 : } 75 : 76 0 : static inline void gui_type_resource_list_get_all_classifier_types ( const gui_type_resource_list_t *this_, 77 : const gui_type_resource_t (**out_types)[], 78 : unsigned int *out_length ) 79 : { 80 0 : assert( out_types != NULL ); 81 0 : assert( out_length != NULL ); 82 0 : const gui_type_resource_t *start_element_ptr = &((*this_).type_name_icon_list[(*this_).classifier_types_start]); 83 0 : *out_types = (const gui_type_resource_t((*)[])) start_element_ptr; 84 0 : *out_length = (*this_).classifier_types_length; 85 0 : } 86 : 87 : static inline void gui_type_resource_list_get_all_feature_types ( const gui_type_resource_list_t *this_, 88 : const gui_type_resource_t (**out_types)[], 89 : unsigned int *out_length ) 90 : { 91 : assert( out_types != NULL ); 92 : assert( out_length != NULL ); 93 : const gui_type_resource_t *start_element_ptr = &((*this_).type_name_icon_list[(*this_).feature_types_start]); 94 : *out_types = (const gui_type_resource_t((*)[])) start_element_ptr; 95 : *out_length = (*this_).feature_types_length; 96 : } 97 : 98 0 : static inline void gui_type_resource_list_get_invariant_feature_types ( const gui_type_resource_list_t *this_, 99 : const gui_type_resource_t (**out_types)[], 100 : unsigned int *out_length ) 101 : { 102 0 : assert( out_types != NULL ); 103 0 : assert( out_length != NULL ); 104 : #ifndef NDEBUG 105 : /* ensure that the DATA_FEATURE_TYPE_LIFELINE is excluded - this should follow 1 list entry after the result list: */ 106 0 : const gui_type_resource_t *const first_after_result 107 0 : = &(((*this_).type_name_icon_list[ (*this_).feature_types_start + (*this_).feature_types_length - 1 ])); 108 0 : assert( data_type_get_feature_type( gui_type_resource_get_type_id( first_after_result ) ) == DATA_FEATURE_TYPE_LIFELINE ); 109 : #endif 110 0 : const gui_type_resource_t *start_element_ptr = &((*this_).type_name_icon_list[(*this_).feature_types_start]); 111 0 : *out_types = (const gui_type_resource_t((*)[])) start_element_ptr; 112 0 : *out_length = (*this_).feature_types_length - 1; 113 0 : } 114 : 115 0 : static inline void gui_type_resource_list_get_all_relationship_types ( const gui_type_resource_list_t *this_, 116 : const gui_type_resource_t (**out_types)[], 117 : unsigned int *out_length ) 118 : { 119 0 : assert( out_types != NULL ); 120 0 : assert( out_length != NULL ); 121 0 : const gui_type_resource_t *start_element_ptr = &((*this_).type_name_icon_list[(*this_).relationship_types_start]); 122 0 : *out_types = (const gui_type_resource_t((*)[])) start_element_ptr; 123 0 : *out_length = (*this_).relationship_types_length; 124 0 : } 125 : 126 0 : static inline GListStore* gui_type_resource_list_get_undef ( const gui_type_resource_list_t *this_ ) 127 : { 128 0 : return (*this_).no_types; 129 : } 130 : 131 0 : static inline GListStore* gui_type_resource_list_get_diagrams ( const gui_type_resource_list_t *this_ ) 132 : { 133 0 : return (*this_).diagram_types; 134 : } 135 : 136 0 : static inline GListStore* gui_type_resource_list_get_classifiers ( const gui_type_resource_list_t *this_ ) 137 : { 138 0 : return (*this_).classifier_types; 139 : } 140 : 141 0 : static inline GListStore* gui_type_resource_list_get_relationships ( const gui_type_resource_list_t *this_ ) 142 : { 143 0 : return (*this_).relationship_types; 144 : } 145 : 146 0 : static inline GListStore* gui_type_resource_list_get_features ( const gui_type_resource_list_t *this_ ) 147 : { 148 0 : return (*this_).feature_types; 149 : } 150 : 151 0 : static inline GListStore* gui_type_resource_list_get_feature_lifeline ( const gui_type_resource_list_t *this_ ) 152 : { 153 0 : return (*this_).feature_lifeline_type; 154 : } 155 : 156 : /* 157 : Copyright 2020-2024 Andreas Warnke 158 : 159 : Licensed under the Apache License, Version 2.0 (the "License"); 160 : you may not use this file except in compliance with the License. 161 : You may obtain a copy of the License at 162 : 163 : http://www.apache.org/licenses/LICENSE-2.0 164 : 165 : Unless required by applicable law or agreed to in writing, software 166 : distributed under the License is distributed on an "AS IS" BASIS, 167 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 168 : See the License for the specific language governing permissions and 169 : limitations under the License. 170 : */