Skip to content

Commit acacc49

Browse files
committed
plugins types FEATURE add value sorting callback
Unused for now. Refs #1547
1 parent 15549c1 commit acacc49

21 files changed

+39
-0
lines changed

src/plugins_types.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,17 @@ typedef LY_ERR (*lyplg_type_validate_clb)(const struct ly_ctx *ctx, const struct
472472
*/
473473
typedef LY_ERR (*lyplg_type_compare_clb)(const struct lyd_value *val1, const struct lyd_value *val2);
474474

475+
/**
476+
* @brief Unused callback for sorting values.
477+
*
478+
* @param[in] val1 First value to compare.
479+
* @param[in] val2 Second value to compare.
480+
* @return -1 if val1 < val2,
481+
* @return 0 if val1 == val2,
482+
* @return 1 if val1 > val2.
483+
*/
484+
typedef int (*lyplg_type_sort_clb)(const struct lyd_value *val1, const struct lyd_value *val2);
485+
475486
/**
476487
* @brief Callback for getting the value of the data stored in @p value.
477488
*
@@ -530,6 +541,7 @@ struct lyplg_type {
530541
lyplg_type_store_clb store; /**< store and canonize the value in the type-specific way */
531542
lyplg_type_validate_clb validate; /**< optional, validate the value in the type-specific way in data */
532543
lyplg_type_compare_clb compare; /**< comparison callback to compare 2 values of the same type */
544+
lyplg_type_sort_clb sort; /**< unused comparison callback for sorting values */
533545
lyplg_type_print_clb print; /**< printer callback to get string representing the value */
534546
lyplg_type_dup_clb duplicate; /**< data duplication callback */
535547
lyplg_type_free_clb free; /**< optional function to free the type-spceific way stored value */

src/plugins_types/binary.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ const struct lyplg_type_record plugins_binary[] = {
393393
.plugin.store = lyplg_type_store_binary,
394394
.plugin.validate = NULL,
395395
.plugin.compare = lyplg_type_compare_binary,
396+
.plugin.sort = NULL,
396397
.plugin.print = lyplg_type_print_binary,
397398
.plugin.duplicate = lyplg_type_dup_binary,
398399
.plugin.free = lyplg_type_free_binary,

src/plugins_types/bits.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ const struct lyplg_type_record plugins_bits[] = {
501501
.plugin.store = lyplg_type_store_bits,
502502
.plugin.validate = NULL,
503503
.plugin.compare = lyplg_type_compare_bits,
504+
.plugin.sort = NULL,
504505
.plugin.print = lyplg_type_print_bits,
505506
.plugin.duplicate = lyplg_type_dup_bits,
506507
.plugin.free = lyplg_type_free_bits

src/plugins_types/boolean.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ const struct lyplg_type_record plugins_boolean[] = {
157157
.plugin.store = lyplg_type_store_boolean,
158158
.plugin.validate = NULL,
159159
.plugin.compare = lyplg_type_compare_boolean,
160+
.plugin.sort = NULL,
160161
.plugin.print = lyplg_type_print_boolean,
161162
.plugin.duplicate = lyplg_type_dup_simple,
162163
.plugin.free = lyplg_type_free_simple

src/plugins_types/date_and_time.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ const struct lyplg_type_record plugins_date_and_time[] = {
418418
.plugin.store = lyplg_type_store_date_and_time,
419419
.plugin.validate = NULL,
420420
.plugin.compare = lyplg_type_compare_date_and_time,
421+
.plugin.sort = NULL,
421422
.plugin.print = lyplg_type_print_date_and_time,
422423
.plugin.duplicate = lyplg_type_dup_date_and_time,
423424
.plugin.free = lyplg_type_free_date_and_time

src/plugins_types/decimal64.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ const struct lyplg_type_record plugins_decimal64[] = {
212212
.plugin.store = lyplg_type_store_decimal64,
213213
.plugin.validate = NULL,
214214
.plugin.compare = lyplg_type_compare_decimal64,
215+
.plugin.sort = NULL,
215216
.plugin.print = lyplg_type_print_decimal64,
216217
.plugin.duplicate = lyplg_type_dup_simple,
217218
.plugin.free = lyplg_type_free_simple

src/plugins_types/empty.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ const struct lyplg_type_record plugins_empty[] = {
9494
.plugin.store = lyplg_type_store_empty,
9595
.plugin.validate = NULL,
9696
.plugin.compare = lyplg_type_compare_simple,
97+
.plugin.sort = NULL,
9798
.plugin.print = lyplg_type_print_simple,
9899
.plugin.duplicate = lyplg_type_dup_simple,
99100
.plugin.free = lyplg_type_free_simple

src/plugins_types/enumeration.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ const struct lyplg_type_record plugins_enumeration[] = {
155155
.plugin.store = lyplg_type_store_enum,
156156
.plugin.validate = NULL,
157157
.plugin.compare = lyplg_type_compare_simple,
158+
.plugin.sort = NULL,
158159
.plugin.print = lyplg_type_print_enum,
159160
.plugin.duplicate = lyplg_type_dup_simple,
160161
.plugin.free = lyplg_type_free_simple

src/plugins_types/identityref.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ const struct lyplg_type_record plugins_identityref[] = {
310310
.plugin.store = lyplg_type_store_identityref,
311311
.plugin.validate = NULL,
312312
.plugin.compare = lyplg_type_compare_identityref,
313+
.plugin.sort = NULL,
313314
.plugin.print = lyplg_type_print_identityref,
314315
.plugin.duplicate = lyplg_type_dup_simple,
315316
.plugin.free = lyplg_type_free_simple

src/plugins_types/instanceid.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ const struct lyplg_type_record plugins_instanceid[] = {
360360
.plugin.store = lyplg_type_store_instanceid,
361361
.plugin.validate = lyplg_type_validate_instanceid,
362362
.plugin.compare = lyplg_type_compare_instanceid,
363+
.plugin.sort = NULL,
363364
.plugin.print = lyplg_type_print_instanceid,
364365
.plugin.duplicate = lyplg_type_dup_instanceid,
365366
.plugin.free = lyplg_type_free_instanceid

0 commit comments

Comments
 (0)