From ca0b9aa56bbc0e30bfef5ffe0ec80b941df888b6 Mon Sep 17 00:00:00 2001 From: Steffen Olszewski Date: Tue, 28 May 2024 19:40:23 +0200 Subject: [PATCH] Convert #define's to constant values These #define's model unrelated values. --- src/model/database.cpp | 42 +++++++++++++++---------------- src/rad/about.cpp | 2 +- src/rad/menueditor.cpp | 2 +- src/rad/xrcpreview/xrcpreview.cpp | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/model/database.cpp b/src/model/database.cpp index 49d4b66f9..4aedc0e0d 100644 --- a/src/model/database.cpp +++ b/src/model/database.cpp @@ -39,26 +39,26 @@ #include "utils/wxfbexception.h" -#define OBJINFO_TAG "objectinfo" -#define CODEGEN_TAG "codegen" -#define TEMPLATE_TAG "template" -#define NAME_TAG "name" -#define DESCRIPTION_TAG "help" -#define CUSTOM_EDITOR_TAG "editor" -#define PROPERTY_TAG "property" -#define CHILD_TAG "child" -#define EVENT_TAG "event" -#define EVENT_CLASS_TAG "class" -#define CATEGORY_TAG "category" -#define OBJECT_TAG "object" -#define CLASS_TAG "class" -#define PACKAGE_TAG "package" -#define PKGDESC_TAG "desc" -#define PRGLANG_TAG "language" -#define ICON_TAG "icon" -#define SMALL_ICON_TAG "smallIcon" -#define EXPANDED_TAG "expanded" -#define WXVERSION_TAG "wxversion" +static constexpr const char* OBJINFO_TAG = "objectinfo"; +static constexpr const char* CODEGEN_TAG = "codegen"; +static constexpr const char* TEMPLATE_TAG = "template"; +static constexpr const char* NAME_TAG = "name"; +static constexpr const char* DESCRIPTION_TAG = "help"; +static constexpr const char* CUSTOM_EDITOR_TAG = "editor"; +static constexpr const char* PROPERTY_TAG = "property"; +static constexpr const char* CHILD_TAG = "child"; +static constexpr const char* EVENT_TAG = "event"; +static constexpr const char* EVENT_CLASS_TAG = "class"; +static constexpr const char* CATEGORY_TAG = "category"; +static constexpr const char* OBJECT_TAG = "object"; +static constexpr const char* CLASS_TAG = "class"; +static constexpr const char* PACKAGE_TAG = "package"; +static constexpr const char* PKGDESC_TAG = "desc"; +static constexpr const char* PRGLANG_TAG = "language"; +static constexpr const char* ICON_TAG = "icon"; +static constexpr const char* SMALL_ICON_TAG = "smallIcon"; +static constexpr const char* EXPANDED_TAG = "expanded"; +static constexpr const char* WXVERSION_TAG = "wxversion"; ObjectPackage::ObjectPackage(wxString name, wxString desc, wxBitmap icon) @@ -181,7 +181,7 @@ PObjectBase ObjectDatabase::NewObject(PObjectInfo obj_info) obj_info->IncrementInstanceCount(); unsigned int ins = obj_info->GetInstanceCount(); - PProperty pname = object->GetProperty(wxT(NAME_TAG)); + PProperty pname = object->GetProperty(NAME_TAG); if (pname) pname->SetValue(pname->GetValue() + StringUtils::IntToStr(ins)); diff --git a/src/rad/about.cpp b/src/rad/about.cpp index 53d7cf15a..fc2ebb70f 100644 --- a/src/rad/about.cpp +++ b/src/rad/about.cpp @@ -32,7 +32,7 @@ #if 0 - #define ID_OK 1000 +static constexpr int ID_OK = 1000; BEGIN_EVENT_TABLE(AboutDialog,wxDialog) EVT_BUTTON(ID_OK,AboutDialog::OnButtonEvent) diff --git a/src/rad/menueditor.cpp b/src/rad/menueditor.cpp index 77c239a42..608530be5 100644 --- a/src/rad/menueditor.cpp +++ b/src/rad/menueditor.cpp @@ -40,7 +40,7 @@ enum { ID_MODIFYMENUITEM, }; -#define IDENTATION 4 +static constexpr int IDENTATION = 4; BEGIN_EVENT_TABLE(MenuEditor, wxDialog) EVT_BUTTON(ID_ADDMENUITEM, MenuEditor::OnAddMenuItem) diff --git a/src/rad/xrcpreview/xrcpreview.cpp b/src/rad/xrcpreview/xrcpreview.cpp index 55b5f94e5..e5134ae6a 100644 --- a/src/rad/xrcpreview/xrcpreview.cpp +++ b/src/rad/xrcpreview/xrcpreview.cpp @@ -36,7 +36,7 @@ #include "utils/wxfbexception.h" -#define MENU_DELETE 109 +static constexpr int MENU_DELETE = 109; class XrcPreviewPopupMenu : public wxMenu