From c39cae79f9b1c0765cc4420d85e6d8d067cbc172 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Fri, 2 Apr 2021 18:59:44 +0200 Subject: [PATCH] Add some assertions --- plugins/editor/src/editor/EditIds.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/plugins/editor/src/editor/EditIds.h b/plugins/editor/src/editor/EditIds.h index 5696e27d..facb6a13 100644 --- a/plugins/editor/src/editor/EditIds.h +++ b/plugins/editor/src/editor/EditIds.h @@ -60,18 +60,21 @@ struct EditRange { }; #define DEFINE_EDIT_ID_RANGE_HELPERS(type, Type, IdPrefix) \ - inline EditId editIdFor##Type(int value) \ - { \ - return EditId(int(EditId::IdPrefix##0) + value); \ - } \ - inline int type##ForEditId(EditId id) \ - { \ - return int(id) - int(EditId::IdPrefix##0); \ - } \ inline bool editIdIs##Type(EditId id) \ { \ return int(id) >= int(EditId::IdPrefix##0) && \ int(id) <= int(EditId::IdPrefix##Last); \ + } \ + inline EditId editIdFor##Type(int value) \ + { \ + EditId id = EditId(int(EditId::IdPrefix##0) + value); \ + assert(editIdIs##Type(id)); \ + return id; \ + } \ + inline int type##ForEditId(EditId id) \ + { \ + assert(editIdIs##Type(id)); \ + return int(id) - int(EditId::IdPrefix##0); \ } // defines editIdForCC, ccForEditId, editIdIsCC, etc..