From 43858ce9ba2d8984c09f4c7cd2c49b72aba0f229 Mon Sep 17 00:00:00 2001 From: Ajinkya Dahale Date: Wed, 15 Mar 2023 15:32:38 +0530 Subject: [PATCH] [Core] Create `ElementMap` and tests Test is a dummy for now. `ElementMap.h` only contains const values. --- src/App/CMakeLists.txt | 1 + src/App/ElementMap.h | 48 ++++++++++++++++++++++++++++++++++++ tests/src/App/CMakeLists.txt | 3 ++- tests/src/App/ElementMap.cpp | 17 +++++++++++++ 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/App/ElementMap.h create mode 100644 tests/src/App/ElementMap.cpp diff --git a/src/App/CMakeLists.txt b/src/App/CMakeLists.txt index e4b096aedd..424c55f7fe 100644 --- a/src/App/CMakeLists.txt +++ b/src/App/CMakeLists.txt @@ -278,6 +278,7 @@ SET(FreeCADApp_HPP_SRCS Color.h ColorModel.h ComplexGeoData.h + ElementMap.h Enumeration.h IndexedName.h MappedName.h diff --git a/src/App/ElementMap.h b/src/App/ElementMap.h new file mode 100644 index 0000000000..e49de60048 --- /dev/null +++ b/src/App/ElementMap.h @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later + +/**************************************************************************** + * Copyright (c) 2018-2022 Zheng, Lei (realthunder) * + * * + * Copyright (c) 2023 FreeCAD Project Association * + * * + * This file is part of FreeCAD. * + * * + * FreeCAD is free software: you can redistribute it and/or modify it * + * under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 2.1 of the * + * License, or (at your option) any later version. * + * * + * FreeCAD is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with FreeCAD. If not, see * + * . * + * * + ***************************************************************************/ + +#ifndef DATA_ELEMENTMAP_H +#define DATA_ELEMENTMAP_H + +#include "FCGlobal.h" +#include "IndexedName.h" + +namespace Data { + +static constexpr const char *POSTFIX_TAG = ";:H"; +static constexpr const char *POSTFIX_DECIMAL_TAG = ";:T"; +static constexpr const char *POSTFIX_EXTERNAL_TAG = ";:X"; +static constexpr const char *POSTFIX_CHILD = ";:C"; +static constexpr const char *POSTFIX_INDEX = ";:I"; +static constexpr const char *POSTFIX_UPPER = ";:U"; +static constexpr const char *POSTFIX_LOWER = ";:L"; +static constexpr const char *POSTFIX_MOD = ";:M"; +static constexpr const char *POSTFIX_GEN = ";:G"; +static constexpr const char *POSTFIX_MODGEN = ";:MG"; +static constexpr const char *POSTFIX_DUPLICATE = ";D"; + +} // namespace data + +#endif // DATA_ELEMENTMAP_H diff --git a/tests/src/App/CMakeLists.txt b/tests/src/App/CMakeLists.txt index c64ae328f5..ac4f46bc81 100644 --- a/tests/src/App/CMakeLists.txt +++ b/tests/src/App/CMakeLists.txt @@ -3,7 +3,8 @@ target_sources( PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Branding.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Expression.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/IndexedName.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ElementMap.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/IndexedName.cpp ${CMAKE_CURRENT_SOURCE_DIR}/License.cpp ${CMAKE_CURRENT_SOURCE_DIR}/MappedName.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Metadata.cpp diff --git a/tests/src/App/ElementMap.cpp b/tests/src/App/ElementMap.cpp new file mode 100644 index 0000000000..1fe683637b --- /dev/null +++ b/tests/src/App/ElementMap.cpp @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later + +#include "gtest/gtest.h" + +#include "App/ElementMap.h" + +#include + +class ElementMapTest : public ::testing::Test { +}; + +TEST_F(ElementMapTest, defaultConstruction) +{ + // Act + + // Assert +}