| 1 |
/* File: layout_order.h; Copyright and License: see below */ |
| 2 |
|
| 3 |
#ifndef LAYOUT_ORDER_H |
| 4 |
#define LAYOUT_ORDER_H |
| 5 |
|
| 6 |
/* public file for the doxygen documentation: */ |
| 7 |
/*! |
| 8 |
* \file |
| 9 |
* \brief Represents an order value for an object, either a list order or an x-/y- order |
| 10 |
*/ |
| 11 |
|
| 12 |
#include <stdint.h> |
| 13 |
|
| 14 |
/*! |
| 15 |
* \brief enumeration of pencil internal order types |
| 16 |
*/ |
| 17 |
enum layout_order_type_enum { |
| 18 |
LAYOUT_ORDER_TYPE_NONE, /*!< there is no order for this type of object in this type of diagram */ |
| 19 |
LAYOUT_ORDER_TYPE_X_Y, /*!< the order is an x/y order pair */ |
| 20 |
LAYOUT_ORDER_TYPE_LIST, /*!< the order is a list order */ |
| 21 |
}; |
| 22 |
|
| 23 |
typedef enum layout_order_type_enum layout_order_type_t; |
| 24 |
|
| 25 |
/*! |
| 26 |
* \brief attributes of the layout_order |
| 27 |
*/ |
| 28 |
struct layout_order_struct { |
| 29 |
layout_order_type_t order_type; /*!< defines the type of order */ |
| 30 |
int32_t first; /*!< list_order if _TYPE_LIST, x_order if _TYPE_X_Y, undefined otherwise */ |
| 31 |
int32_t second; /*!< y_order if _TYPE_X_Y, undefined otherwise */ |
| 32 |
}; |
| 33 |
|
| 34 |
typedef struct layout_order_struct layout_order_t; |
| 35 |
|
| 36 |
/*! |
| 37 |
* \brief initializes the layout_order_t struct |
| 38 |
* |
| 39 |
* \param this_ pointer to own object attributes |
| 40 |
* \param order_type order_type, defines the interpretation of first and second parameter |
| 41 |
* \param first first value of the pair |
| 42 |
* \param second second value of the pair |
| 43 |
*/ |
| 44 |
static inline void layout_order_private_init ( layout_order_t *this_, layout_order_type_t order_type, int32_t first, int32_t second ); |
| 45 |
|
| 46 |
/*! |
| 47 |
* \brief re-initializes the layout_order_t struct |
| 48 |
* |
| 49 |
* \param this_ pointer to own object attributes |
| 50 |
* \param order_type order_type, defines the interpretation of first and second parameter |
| 51 |
* \param first first value of the pair |
| 52 |
* \param second second value of the pair |
| 53 |
*/ |
| 54 |
static inline void layout_order_private_reinit ( layout_order_t *this_, layout_order_type_t order_type, int32_t first, int32_t second ); |
| 55 |
|
| 56 |
/*! |
| 57 |
* \brief initializes the layout_order_t struct to LAYOUT_ORDER_TYPE_X_Y |
| 58 |
* |
| 59 |
* \param this_ pointer to own object attributes |
| 60 |
* \param x_order first value of the pair |
| 61 |
* \param y_order second value of the pair |
| 62 |
*/ |
| 63 |
static inline void layout_order_init_x_y ( layout_order_t *this_, int32_t x_order, int32_t y_order ); |
| 64 |
|
| 65 |
/*! |
| 66 |
* \brief re-initializes the layout_order_t struct to LAYOUT_ORDER_TYPE_X_Y |
| 67 |
* |
| 68 |
* \param this_ pointer to own object attributes |
| 69 |
* \param x_order first value of the pair |
| 70 |
* \param y_order second value of the pair |
| 71 |
*/ |
| 72 |
static inline void layout_order_reinit_x_y ( layout_order_t *this_, int32_t x_order, int32_t y_order ); |
| 73 |
|
| 74 |
/*! |
| 75 |
* \brief initializes the layout_order_t struct to LAYOUT_ORDER_TYPE_LIST |
| 76 |
* |
| 77 |
* \param this_ pointer to own object attributes |
| 78 |
* \param list_order the list_order value |
| 79 |
*/ |
| 80 |
static inline void layout_order_init_list ( layout_order_t *this_, int32_t list_order ); |
| 81 |
|
| 82 |
/*! |
| 83 |
* \brief re-initializes the layout_order_t struct to LAYOUT_ORDER_TYPE_LIST |
| 84 |
* |
| 85 |
* \param this_ pointer to own object attributes |
| 86 |
* \param list_order the list_order value |
| 87 |
*/ |
| 88 |
static inline void layout_order_reinit_list ( layout_order_t *this_, int32_t list_order ); |
| 89 |
|
| 90 |
/*! |
| 91 |
* \brief copies original to this uninitialized layout_order_t struct |
| 92 |
* |
| 93 |
* \param this_ pointer to own object attributes |
| 94 |
* \param original pointer to object attributes that shall be copied |
| 95 |
*/ |
| 96 |
static inline void layout_order_copy ( layout_order_t *this_, const layout_order_t *original ); |
| 97 |
|
| 98 |
/*! |
| 99 |
* \brief replaces the already initialized layout_order_t struct by other data |
| 100 |
* |
| 101 |
* \param this_ pointer to own object attributes |
| 102 |
* \param original pointer to object attributes that shall be copied |
| 103 |
*/ |
| 104 |
static inline void layout_order_replace ( layout_order_t *this_, const layout_order_t *original ); |
| 105 |
|
| 106 |
/*! |
| 107 |
* \brief initializes the layout_order_t struct to a pair of 0,0, LAYOUT_ORDER_TYPE_NONE |
| 108 |
* |
| 109 |
* \param this_ pointer to own object attributes |
| 110 |
*/ |
| 111 |
static inline void layout_order_init_empty ( layout_order_t *this_ ); |
| 112 |
|
| 113 |
/*! |
| 114 |
* \brief re-initializes the layout_order_t struct to a pair of 0,0, LAYOUT_ORDER_TYPE_NONE |
| 115 |
* |
| 116 |
* \param this_ pointer to own object attributes |
| 117 |
*/ |
| 118 |
static inline void layout_order_reinit_empty ( layout_order_t *this_ ); |
| 119 |
|
| 120 |
/*! |
| 121 |
* \brief destroys the layout_order_t struct |
| 122 |
* |
| 123 |
* \param this_ pointer to own object attributes |
| 124 |
*/ |
| 125 |
static inline void layout_order_destroy ( layout_order_t *this_ ); |
| 126 |
|
| 127 |
/*! |
| 128 |
* \brief gets the order type of layout_order_t |
| 129 |
* |
| 130 |
* \param this_ pointer to own object attributes |
| 131 |
* \return order type value of the layout order |
| 132 |
*/ |
| 133 |
static inline layout_order_type_t layout_order_get_order_type ( const layout_order_t *this_ ); |
| 134 |
|
| 135 |
/*! |
| 136 |
* \brief gets the first value of layout_order_t |
| 137 |
* |
| 138 |
* \param this_ pointer to own object attributes |
| 139 |
* \return first value of the layout order pair |
| 140 |
*/ |
| 141 |
static inline int32_t layout_order_get_first ( const layout_order_t *this_ ); |
| 142 |
|
| 143 |
/*! |
| 144 |
* \brief gets the second value of layout_order_t |
| 145 |
* |
| 146 |
* \param this_ pointer to own object attributes |
| 147 |
* \return second value of the layout order pair |
| 148 |
*/ |
| 149 |
static inline int32_t layout_order_get_second ( const layout_order_t *this_ ); |
| 150 |
|
| 151 |
/*! |
| 152 |
* \brief prints the layout_order_t struct to the trace output |
| 153 |
* |
| 154 |
* \param this_ pointer to own object attributes |
| 155 |
*/ |
| 156 |
static inline void layout_order_trace ( const layout_order_t *this_ ); |
| 157 |
|
| 158 |
#include "layout_order.inl" |
| 159 |
|
| 160 |
#endif /* LAYOUT_ORDER_H */ |
| 161 |
|
| 162 |
|
| 163 |
/* |
| 164 |
Copyright 2018-2026 Andreas Warnke |
| 165 |
|
| 166 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 167 |
you may not use this file except in compliance with the License. |
| 168 |
You may obtain a copy of the License at |
| 169 |
|
| 170 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 171 |
|
| 172 |
Unless required by applicable law or agreed to in writing, software |
| 173 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 174 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 175 |
See the License for the specific language governing permissions and |
| 176 |
limitations under the License. |
| 177 |
*/ |