Line data Source code
1 : /* File: pos_search_result.inl; Copyright and License: see below */
2 :
3 : #include <assert.h>
4 :
5 0 : static inline void pos_search_result_init ( pos_search_result_t *this_,
6 : const data_search_result_t *search_result_data )
7 : {
8 0 : assert ( NULL != search_result_data );
9 :
10 0 : shape_int_rectangle_init_empty( &((*this_).icon_box) );
11 0 : shape_int_rectangle_init_empty( &((*this_).label_box) );
12 0 : (*this_).data = search_result_data;
13 0 : }
14 :
15 0 : static inline void pos_search_result_destroy ( pos_search_result_t *this_ )
16 : {
17 0 : shape_int_rectangle_destroy( &((*this_).icon_box) );
18 0 : shape_int_rectangle_destroy( &((*this_).label_box) );
19 0 : (*this_).data = NULL;
20 0 : }
21 :
22 : static inline bool pos_search_result_is_valid ( const pos_search_result_t *this_ )
23 : {
24 : bool result;
25 : if (( (*this_).data == NULL ))
26 : {
27 : assert(false);
28 : result = false; /* cannot happen on initialized objects */
29 : }
30 : else
31 : {
32 : const data_id_t data_id = data_search_result_get_match_id( (*this_).data );
33 : result = data_id_is_valid( &data_id );
34 : }
35 : return result;
36 : }
37 :
38 0 : static inline const shape_int_rectangle_t *pos_search_result_get_icon_box_const ( const pos_search_result_t *this_ )
39 : {
40 0 : return &((*this_).icon_box);
41 : }
42 :
43 0 : static inline void pos_search_result_set_icon_box ( pos_search_result_t *this_, const shape_int_rectangle_t *icon_box )
44 : {
45 0 : shape_int_rectangle_replace( &((*this_).icon_box), icon_box );
46 0 : }
47 :
48 0 : static inline const shape_int_rectangle_t *pos_search_result_get_label_box_const ( const pos_search_result_t *this_ )
49 : {
50 0 : return &((*this_).label_box);
51 : }
52 :
53 0 : static inline void pos_search_result_set_label_box ( pos_search_result_t *this_, const shape_int_rectangle_t *label_box )
54 : {
55 0 : shape_int_rectangle_replace( &((*this_).label_box), label_box );
56 0 : }
57 :
58 0 : static inline const data_search_result_t *pos_search_result_get_data_const ( const pos_search_result_t *this_ )
59 : {
60 0 : return (*this_).data;
61 : }
62 :
63 : static inline data_id_t pos_search_result_get_data_id ( const pos_search_result_t *this_ )
64 : {
65 : return data_search_result_get_match_id( (*this_).data );
66 : }
67 :
68 :
69 : /*
70 : Copyright 2021-2025 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 : */
|