| 1 |
/* File: layout_subelement_id.h; Copyright and License: see below */ |
| 2 |
|
| 3 |
#ifndef LAYOUT_SUBELEMENT_ID_H |
| 4 |
#define LAYOUT_SUBELEMENT_ID_H |
| 5 |
|
| 6 |
/* public file for the doxygen documentation: */ |
| 7 |
/*! |
| 8 |
* \file |
| 9 |
* \brief Describes the thing at a location. |
| 10 |
* |
| 11 |
* This may be a classifier with a lifeline, a space within a container, |
| 12 |
* a label or border or symbol. |
| 13 |
* layout_subelement_id_t stores the type and the id of an element and if needed their parent classifier. |
| 14 |
*/ |
| 15 |
|
| 16 |
#include "layout/layout_subelement_kind.h" |
| 17 |
#include "gui_marked_set.h" |
| 18 |
#include "shape/shape_int_rectangle.h" |
| 19 |
#include "pencil_marker.h" |
| 20 |
#include "entity/data_id.h" |
| 21 |
#include "set/data_full_id.h" |
| 22 |
#include <stdint.h> |
| 23 |
|
| 24 |
#define LAYOUT_SUBELEMENT_ID_VOID ((layout_subelement_id_t){.kind=LAYOUT_SUBELEMENT_KIND_VOID,.id=DATA_FULL_ID_VOID}) |
| 25 |
|
| 26 |
/*! |
| 27 |
* \brief attributes of the thing |
| 28 |
*/ |
| 29 |
struct layout_subelement_id_struct { |
| 30 |
layout_subelement_kind_t kind; |
| 31 |
data_full_id_t id; |
| 32 |
}; |
| 33 |
|
| 34 |
typedef struct layout_subelement_id_struct layout_subelement_id_t; |
| 35 |
|
| 36 |
/*! |
| 37 |
* \brief initializes the layout_subelement_id_t |
| 38 |
* |
| 39 |
* \param this_ pointer to own object attributes |
| 40 |
* \param kind type of the location_thing |
| 41 |
* \param id pointer to element and possibly parent classifier (if applicable) |
| 42 |
*/ |
| 43 |
static inline void layout_subelement_id_init( layout_subelement_id_t *this_, |
| 44 |
layout_subelement_kind_t kind, |
| 45 |
const data_full_id_t *id |
| 46 |
); |
| 47 |
|
| 48 |
/*! |
| 49 |
* \brief initializes the layout_subelement_id_t |
| 50 |
* |
| 51 |
* \param this_ pointer to own object attributes |
| 52 |
*/ |
| 53 |
static inline void layout_subelement_id_init_void( layout_subelement_id_t *this_ ); |
| 54 |
|
| 55 |
/*! |
| 56 |
* \brief re-initializes the layout_subelement_id_t |
| 57 |
* |
| 58 |
* \param this_ pointer to own object attributes |
| 59 |
* \param kind type of the location_thing |
| 60 |
* \param id pointer to element and possibly parent classifier (if applicable) |
| 61 |
*/ |
| 62 |
static inline void layout_subelement_id_reinit( layout_subelement_id_t *this_, |
| 63 |
layout_subelement_kind_t kind, |
| 64 |
const data_full_id_t *id |
| 65 |
); |
| 66 |
|
| 67 |
/*! |
| 68 |
* \brief initializes the layout_subelement_id_t by a single data_id |
| 69 |
* |
| 70 |
* \param this_ pointer to own object attributes |
| 71 |
* \param kind type of the location_thing |
| 72 |
* \param id pointer to element |
| 73 |
*/ |
| 74 |
static inline void layout_subelement_id_init_solo( layout_subelement_id_t *this_, |
| 75 |
layout_subelement_kind_t kind, |
| 76 |
const data_id_t *id |
| 77 |
); |
| 78 |
|
| 79 |
/*! |
| 80 |
* \brief re-initializes the layout_subelement_id_t by a single data_id |
| 81 |
* |
| 82 |
* \param this_ pointer to own object attributes |
| 83 |
* \param kind type of the location_thing |
| 84 |
* \param id pointer to element |
| 85 |
*/ |
| 86 |
static inline void layout_subelement_id_reinit_solo( layout_subelement_id_t *this_, |
| 87 |
layout_subelement_kind_t kind, |
| 88 |
const data_id_t *id |
| 89 |
); |
| 90 |
|
| 91 |
/*! |
| 92 |
* \brief copies the layout_subelement_id_t |
| 93 |
* |
| 94 |
* \param this_ pointer to own object attributes |
| 95 |
* \param that pointer to other object to be copied |
| 96 |
*/ |
| 97 |
static inline void layout_subelement_id_copy( layout_subelement_id_t *this_, const layout_subelement_id_t *that ); |
| 98 |
|
| 99 |
/*! |
| 100 |
* \brief replaces the already initialized layout_subelement_id_t |
| 101 |
* |
| 102 |
* \param this_ pointer to own object attributes |
| 103 |
* \param that pointer to other object to be copied |
| 104 |
*/ |
| 105 |
static inline void layout_subelement_id_replace( layout_subelement_id_t *this_, const layout_subelement_id_t *that ); |
| 106 |
|
| 107 |
/*! |
| 108 |
* \brief destroys the layout_subelement_id_t |
| 109 |
* |
| 110 |
* \param this_ pointer to own object attributes |
| 111 |
*/ |
| 112 |
static inline void layout_subelement_id_destroy( layout_subelement_id_t *this_ ); |
| 113 |
|
| 114 |
/*! |
| 115 |
* \brief returns if object refering to a valid location_thing |
| 116 |
* |
| 117 |
* \param this_ pointer to own object attributes |
| 118 |
* \return true if kind and id are not void |
| 119 |
*/ |
| 120 |
static inline bool layout_subelement_id_is_valid( const layout_subelement_id_t *this_ ); |
| 121 |
|
| 122 |
/*! |
| 123 |
* \brief gets the attribute of layout_subelement_id_t: kind |
| 124 |
* |
| 125 |
* \param this_ pointer to own object attributes |
| 126 |
* \return type of the location_thing |
| 127 |
*/ |
| 128 |
static inline layout_subelement_kind_t layout_subelement_id_get_kind( const layout_subelement_id_t *this_ ); |
| 129 |
|
| 130 |
/*! |
| 131 |
* \brief gets the attribute of layout_subelement_id_t: id |
| 132 |
* |
| 133 |
* \param this_ pointer to own object attributes |
| 134 |
* \return id of the location_thing |
| 135 |
*/ |
| 136 |
static inline const data_full_id_t *layout_subelement_id_get_id_const( const layout_subelement_id_t *this_ ); |
| 137 |
|
| 138 |
#include "layout_subelement_id.inl" |
| 139 |
|
| 140 |
#endif /* LAYOUT_SUBELEMENT_ID_H */ |
| 141 |
|
| 142 |
|
| 143 |
/* |
| 144 |
Copyright 2024-2026 Andreas Warnke |
| 145 |
|
| 146 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 147 |
you may not use this file except in compliance with the License. |
| 148 |
You may obtain a copy of the License at |
| 149 |
|
| 150 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 151 |
|
| 152 |
Unless required by applicable law or agreed to in writing, software |
| 153 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 154 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 155 |
See the License for the specific language governing permissions and |
| 156 |
limitations under the License. |
| 157 |
*/ |