diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..fe5ea28 --- /dev/null +++ b/.clang-format @@ -0,0 +1,300 @@ +# ***************************************************************************** +# Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * +# * +# This program and the accompanying materials are made available under the * +# terms of the MIT License which is available at * +# https://opensource.org/licenses/MIT. * +# * +# SPDX-License-Identifier: MIT * +# *****************************************************************************/ + +#http://clang.llvm.org/docs/ClangFormatStyleOptions.html + +# The style used for all options not specifically set in the configuration. +# This option is supported only in the clang-format configuration (both within +# -style='{...}' and the .clang-format file). +# LLVM A style complying with the LLVM coding standards +# Google A style complying with Google’s C++ style guide +# Chromium A style complying with Chromium’s style guide +# Mozilla A style complying with Mozilla’s style guide +# WebKit A style complying with WebKit’s style guide +BasedOnStyle: Webkit + +# The extra indent or outdent of access modifiers, e.g. public:. +AccessModifierOffset: -4 + +# If true, horizontally aligns arguments after an open bracket. +# This applies to round brackets (parentheses), angle brackets and square +# brackets. This will result in formattings like code +# someLongFunction(argument1, argument2); endcode +AlignAfterOpenBracket: AlwaysBreak + +# If true, aligns escaped newlines as far left as possible. Otherwise puts them +# into the right-most column. +#AlignEscapedNewlinesLeft + +# If true, horizontally align operands of binary and ternary expressions. +AlignOperands: true + +# If true, aligns trailing comments. +AlignTrailingComments: true + +# Allow putting all parameters of a function declaration onto the next line even +# if BinPackParameters is false. +AllowAllParametersOfDeclarationOnNextLine: true + +# Allows contracting simple braced statements to a single line. +# E.g., this allows if (a) { return; } to be put on a single line. +AllowShortBlocksOnASingleLine: false + +# If true, short case labels will be contracted to a single line. +AllowShortCaseLabelsOnASingleLine: false + +# Dependent on the value, int f() { return 0; } can be put on a single line. +# SFS_None (in configuration: None) Never merge functions into a single line. +# SFS_Inline (in configuration: Inline) Only merge functions defined inside a +# class. +# SFS_Empty (in configuration: Empty) Only merge empty functions. +# SFS_All (in configuration: All) Merge all functions fitting on a single line. +AllowShortFunctionsOnASingleLine: None + +# If true, if (a) return; can be put on a single line. +#AllowShortIfStatementsOnASingleLine: false + +# If true, while (true) continue; can be put on a single line. +AllowShortLoopsOnASingleLine: true + +# If true, always break after function definition return types. +# More truthfully called ‘break before the identifier following the type in a +# function definition’. +# PenaltyReturnTypeOnItsOwnLine becomes irrelevant. +AlwaysBreakAfterDefinitionReturnType: All + +# If true, always break before multiline string literals. +AlwaysBreakBeforeMultilineStrings: false + +# If true, always break after the template<...> of a template declaration. +AlwaysBreakTemplateDeclarations: true + +# If false, a function call’s arguments will either be all on the same line or +# will have one line each. +BinPackArguments: false + +# If false, a function call’s arguments will either be all +# on the same line or will have one line each. +BinPackParameters: false + +# The way to wrap binary operators. +# BOS_None (in configuration: None) Break after operators. +# BOS_NonAssignment (in configuration: NonAssignment) Break before operators +# that aren’t assignments. +# BOS_All (in configuration: All) Break before operators. +#BreakBeforeBinaryOperators: None + +# The brace breaking style to use. +# BS_Attach (in configuration: Attach) Always attach braces to surrounding +# context. +# BS_Linux (in configuration: Linux) Like Attach, but break before braces on +# function, namespace and class definitions. +# BS_Stroustrup (in configuration: Stroustrup) Like Attach, but break before +# function definitions, and ‘else’. +# BS_Allman (in configuration: Allman) Always break before braces. +# BS_GNU (in configuration: GNU) Always break before braces and add an extra +# level of indentation to braces of control statements, not to those of class, +# function or other definitions. +BreakBeforeBraces: Attach + +# If true, ternary operators will be placed after line breaks. +BreakBeforeTernaryOperators: true + +# Always break constructor initializers before commas and align the commas with +# the colon. +BreakConstructorInitializersBeforeComma: true + +# The column limit. +# A column limit of 0 means that there is no column limit. In this case, +# clang-format will respect the input’s line breaking decisions within +# statements unless they contradict other rules. +ColumnLimit: 80 + +# A regular expression that describes comments with special meaning, which +# should not be split into lines or otherwise changed. +CommentPragmas: "\/*(.*)*\/" + +# If the constructor initializers don’t fit on a line, put each initializer on +# its own line. +#ConstructorInitializerAllOnOneLineOrOnePerLine: false + +# The number of characters to use for indentation of constructor initializer +# lists. +ConstructorInitializerIndentWidth: 0 + +# Indent width for line continuations. +#ContinuationIndentWidth: 4 + +# If true, format braced lists as best suited for C++11 braced lists. +# Important differences: - No spaces inside the braced list. - No line break +# before the closing brace. - Indentation with the continuation indent, not with +# the block indent. +# Fundamentally, C++11 braced lists are formatted exactly like function calls +# would be formatted in their place. If the braced list follows a name (e.g. a +# type or variable name), clang-format formats as if the {} were the parentheses +# of a function call with that name. If there is no name, a zero-length name is +# assumed. +Cpp11BracedListStyle: true + +# If true, analyze the formatted file for the most common alignment of & and *. +# Point +#DerivePointerAlignment: false + +# Disables formatting at all. +#DisableFormat: false + +# If true, clang-format detects whether function calls and definitions are +# formatted with one parameter per line. +# Each call can be bin-packed, one-per-line or inconclusive. If it is +# inconclusive, e.g. completely on one line, but a decision needs to be made, +# clang-format analyzes whether there are other bin-packed cases in the input +# file and act accordingly. +# NOTE: This is an experimental flag, that might go away or be renamed. Do not +# use this in config files, etc. Use at your own risk. +ExperimentalAutoDetectBinPacking: false + +# A vector of macros that should be interpreted as foreach loops instead of as +# function calls. +# These are expected to be macros of the form: code +# FOREACH(, ...) endcode +# For example: BOOST_FOREACH. +#ForEachMacros (std::vector) + +# Indent case labels one level from the switch statement. +# When false, use the same indentation level as for the switch statement. Switch +# statement body is always indented one level more than case labels. +IndentCaseLabels: false + +# The number of columns to use for indentation. +IndentWidth: 4 + +# Indent if a function definition or declaration is wrapped after the type. +#IndentWrappedFunctionNames: false + +# If true, empty lines at the start of blocks are kept. +KeepEmptyLinesAtTheStartOfBlocks: false + +# Language, this format style is targeted at. +# LK_None (in configuration: None) Do not use. +# LK_Cpp (in configuration: Cpp) Should be used for C, C++, ObjectiveC, +# ObjectiveC++. +# LK_Java (in configuration: Java) Should be used for Java. +# LK_JavaScript (in configuration: JavaScript) Should be used for JavaScript. +# LK_Proto (in configuration: Proto) Should be used for Protocol Buffers +# (https://developers.google.com/protocol-buffers/). +Language: Cpp + +# The maximum number of consecutive empty lines to keep. +#MaxEmptyLinesToKeep: 0 + +# The indentation used for namespaces. +# NI_None (in configuration: None) Don’t indent in namespaces. +# NI_Inner (in configuration: Inner) Indent only in inner namespaces (nested in +# other namespaces). +# NI_All (in configuration: All) Indent in all namespaces. +NamespaceIndentation: None + +# The number of characters to use for indentation of ObjC blocks. +#ObjCBlockIndentWidth: 4 + +# Add a space after @property in Objective-C, i.e. use \@property (readonly) +# instead of \@property(readonly). +#ObjCSpaceAfterProperty: false + +# Add a space in front of an Objective-C protocol list, i.e. use Foo +# instead of Foo. +#ObjCSpaceBeforeProtocolList: false + +# The penalty for breaking a function call after “call(”. +#PenaltyBreakBeforeFirstCallParameter (unsigned) + +# The penalty for each line break introduced inside a comment. +#PenaltyBreakComment (unsigned) + +# The penalty for breaking before the first <<. +#PenaltyBreakFirstLessLess (unsigned) + +# The penalty for each line break introduced inside a string literal. +#PenaltyBreakString (unsigned) + +# The penalty for each character outside of the column limit. +#PenaltyExcessCharacter (unsigned) + +# Penalty for putting the return type of a function onto its own line. +#PenaltyReturnTypeOnItsOwnLine (unsigned) + +# If true, analyze the formatted file for the most common alignment of & and *. +# PointerAlignment is then used only as fallback. +PointerAlignment: Left + +# If true, a space may be inserted after C style casts. +SpaceAfterCStyleCast: false + +# If false, spaces will be removed before assignment operators. +SpaceBeforeAssignmentOperators: true + +# Defines in which cases to put a space before opening parentheses. +# SBPO_Never (in configuration: Never) Never put a space before opening +# parentheses. +# SBPO_ControlStatements (in configuration: ControlStatements) Put a space +# before opening parentheses only after control statement keywords +# (for/if/while...). +# SBPO_Always (in configuration: Always) Always put a space before opening +# parentheses, except when it’s prohibited by the syntax rules (in function-like +# macro definitions) or when determined by other style rules (after unary +# operators, opening parentheses, etc.) +SpaceBeforeParens: ControlStatements + +# If true, spaces may be inserted into ‘()’. +SpaceInEmptyParentheses: false + +# The number of spaces before trailing line comments (// - comments). +# This does not affect trailing block comments (/**/ - comments) as those +# commonly have different usage patterns and a number of special cases. +SpacesBeforeTrailingComments: 2 + +# If true, spaces will be inserted after ‘<’ and before ‘>’ in template argument +# lists +SpacesInAngles: false + +# If true, spaces may be inserted into C style casts. +SpacesInCStyleCastParentheses: false + +# If true, spaces are inserted inside container literals (e.g. ObjC and +# Javascript array and dict literals). +SpacesInContainerLiterals: false + +# If true, spaces will be inserted after ‘(‘ and before ‘)’. +SpacesInParentheses: false + +# If true, spaces will be inserted after ‘[‘ and before ‘]’. +SpacesInSquareBrackets: false + +# Format compatible with this standard, e.g. use A > instead of A> +# for LS_Cpp03. +# LS_Cpp03 (in configuration: Cpp03) Use C++03-compatible syntax. +# LS_Cpp11 (in configuration: Cpp11) Use features of C++11 (e.g. A> +# instead of A >). +# LS_Auto (in configuration: Auto) Automatic detection based on the input. +Standard: Cpp11 + +# The number of columns used for tab stops. +TabWidth: 4 + +# The way to use tab characters in the resulting file. +# UT_Never (in configuration: Never) Never use tab. +# UT_ForIndentation (in configuration: ForIndentation) Use tabs only for +# indentation. +# UT_Always (in configuration: Always) Use tabs whenever we need to fill +# whitespace that spans at least from one tab stop to the next one. +UseTab: Never + +# Indent code enclosed in an extern block +IndentExternBlock: NoIndent diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..7adfeed --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,14 @@ +# ***************************************************************************** +# Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * +# * +# This program and the accompanying materials are made available under the * +# terms of the MIT License which is available at * +# https://opensource.org/licenses/MIT. * +# * +# SPDX-License-Identifier: MIT * +# *****************************************************************************/ + +Checks: '-checks=-*,clang-analyzer-*,-clang-analyzer-cplusplus*' +WarningsAsErrors: true +HeaderFilterRegex: '.*' +FormatStyle: webkit diff --git a/.cppcheck.suppress b/.cppcheck.suppress new file mode 100644 index 0000000..b2fe9e2 --- /dev/null +++ b/.cppcheck.suppress @@ -0,0 +1,3 @@ +cstyleCast +missingIncludeSystem +missingInclude diff --git a/.github/scripts/check_version.sh b/.github/scripts/check_version.sh index e776a4e..ea0c841 100644 --- a/.github/scripts/check_version.sh +++ b/.github/scripts/check_version.sh @@ -32,4 +32,4 @@ fi echo "PROJECT_VERSION=$version" >> $GITHUB_ENV -echo "Retained PROJECT_VERSION=$version" \ No newline at end of file +echo "Retained PROJECT_VERSION=$version" diff --git a/.github/scripts/patch_doxyfile.sh b/.github/scripts/patch_doxyfile.sh index 65d38f3..a6d5e9f 100644 --- a/.github/scripts/patch_doxyfile.sh +++ b/.github/scripts/patch_doxyfile.sh @@ -6,4 +6,4 @@ sed -i "s/%PROJECT_VERSION%/$project_version/g" ./.github/doxygen/Doxyfile project_name="$(head -n 1 README.md | sed 's/#//')" -sed -i "s/%PROJECT_NAME%/$project_name/g" ./.github/doxygen/Doxyfile \ No newline at end of file +sed -i "s/%PROJECT_NAME%/$project_name/g" ./.github/doxygen/Doxyfile diff --git a/.github/scripts/prepare_doxygen.sh b/.github/scripts/prepare_doxygen.sh index 543d953..f87b122 100644 --- a/.github/scripts/prepare_doxygen.sh +++ b/.github/scripts/prepare_doxygen.sh @@ -36,6 +36,3 @@ sed -i "2s/.*/title: $project_name/" _config.yml cd .. echo "Local docs update finished." - - - diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..73c2a33 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,50 @@ +name: Build and test code + +on: + push: + branches: + - main + pull_request: + +jobs: + build: + + strategy: + matrix: + env: + - toolchain: "toolchain/gcc-linux.cmake" + runner: ubuntu-latest + generator: "" + - toolchain: "toolchain/clang-macos.cmake" + runner: macos-latest + generator: "" + - toolchain: "\"toolchain/clang-windows.cmake\"" + runner: windows-latest + generator: "-G \"Visual Studio 17 2022\"" + + runs-on: ${{ matrix.env.runner }} + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install Linux reqs + if: ${{ matrix.env.runner == 'ubuntu-latest' }} + run: | + sudo apt-get update + sudo apt-get install -y clang cmake cppcheck clang-format clang-tidy gcc pre-commit + + - name: Install macOS reqs + if: ${{ matrix.env.runner == 'macos-latest' }} + run: | + brew install llvm cmake cppcheck clang-format gcc pre-commit + + - name: Build + run: | + cmake ${{ matrix.env.generator }} -B build -S . -DCMAKE_TOOLCHAIN_FILE=${{ matrix.env.toolchain }} + cmake --build build -j8 + + - name: Run Linux/macOS tests + if: ${{ matrix.env.runner == 'ubuntu-latest' || matrix.env.runner == 'macos-latest' }} + run: | + ./build/bin/keyplecommoncppapi_ut diff --git a/.github/workflows/publish-doc-release.yml b/.github/workflows/publish-doc-release.yml index 5c65148..273e332 100644 --- a/.github/workflows/publish-doc-release.yml +++ b/.github/workflows/publish-doc-release.yml @@ -12,22 +12,28 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 + - name: Make scripts executable run: chmod +x ./.github/scripts/*.sh + - name: Check version working-directory: . run: ./.github/scripts/check_version.sh $(echo "${{ github.ref }}" | sed -e "s,^refs/tags/,,") + - name: Patch Doxyfile working-directory: . run: ./.github/scripts/patch_doxyfile.sh ${{ env.PROJECT_VERSION }} - - name: Generate project documentation with Doxygen - uses: mattnotmitt/doxygen-action@v1.9.2 + + - name: Generate and prepare documentation + uses: eclipse-keypop/keypop-actions/doxygen@f012732e75cdda39ba7b988533030493303700a5 with: - working-directory: .github/doxygen/ - doxyfile-path: ./Doxyfile + repo-name: ${{ github.event.repository.name }} + version: ${{ github.event.inputs.version || github.ref_name }} + - name: Prepare Doxygen doc page locally working-directory: . run: ./.github/scripts/prepare_doxygen.sh ${{ env.PROJECT_VERSION }} + - name: Deploy to doc branch run: | git config --global user.name "Eclipse Keypop Bot" @@ -38,4 +44,4 @@ jobs: git commit -m "docs: update ${{ github.event.inputs.version || github.ref_name }} documentation" git push origin doc --force env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish-doc-snapshot.yml b/.github/workflows/publish-doc-snapshot.yml index 55afb9a..7ed3d91 100644 --- a/.github/workflows/publish-doc-snapshot.yml +++ b/.github/workflows/publish-doc-snapshot.yml @@ -15,22 +15,28 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 + - name: Make scripts executable run: chmod +x ./.github/scripts/*.sh + - name: Check version working-directory: . run: ./.github/scripts/check_version.sh + - name: Patch Doxyfile working-directory: . run: ./.github/scripts/patch_doxyfile.sh ${{ env.PROJECT_VERSION }} - - name: Generate project documentation with Doxygen - uses: mattnotmitt/doxygen-action@v1.9.2 + + - name: Generate and prepare documentation + uses: eclipse-keypop/keypop-actions/doxygen@f012732e75cdda39ba7b988533030493303700a5 with: - working-directory: .github/doxygen/ - doxyfile-path: ./Doxyfile + repo-name: ${{ github.event.repository.name }} + version: ${{ github.event.inputs.version || github.ref_name }} + - name: Prepare Doxygen doc page locally working-directory: . run: ./.github/scripts/prepare_doxygen.sh ${{ env.PROJECT_VERSION }} + - name: Deploy to doc branch run: | git config --global user.name "Eclipse Keypop Bot" @@ -41,4 +47,4 @@ jobs: git diff --quiet && git diff --staged --quiet || git commit -m "docs: update snapshot documentation" git push origin doc --force env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d8292a8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,39 @@ +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +# Build directories +build +out + +# IDE files +CMakeSettings.json diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..e0a7e96 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,47 @@ +#************************************************************************************************** +#* Copyright (c) 2024 Calypso Networks Association https://calypsonet.org/ * +#* * +#* This program and the accompanying materials are made available under the * +#* terms of the MIT License which is available at https://opensource.org/licenses/MIT. * +#* * +#* SPDX-License-Identifier: MIT * +#**************************************************************************************************/ + +fail_fast: false + +repos: + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + + - repo: https://github.com/pocc/pre-commit-hooks + rev: master + hooks: + - id: clang-tidy + name: clang-tidy + entry: clang-tidy -p=build + --system-headers + --fix-errors + + # Code formatting (see .clang-format for config used). + - id: clang-format + name: clang-format + args: [-i] + + # Static code analysis (for C++ files). + - id: cppcheck + name: cppcheck + args: [--enable=all, + --error-exitcode=1, + --language=c++, + --suppressions-list=./.cppcheck.suppress] + files: \.(cpp|hpp)$ + + # Coding style analysis. Based on Google C++ code style. + # cpplint configuration can be found in CPPLINT.cfg. + - id: cpplint diff --git a/CMakeLists.txt b/CMakeLists.txt index 092779c..759b6dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,21 +1,19 @@ -# ************************************************************************************************* -# Copyright (c) 2023 Calypso Networks Association https://calypsonet.org/ * -# * -# See the NOTICE file(s) distributed with this work for additional information regarding * -# copyright ownership. * -# * -# This program and the accompanying materials are made available under the terms of the Eclipse * -# Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 * -# * -# SPDX-License-Identifier: EPL-2.0 * -# *************************************************************************************************/ - +# ***************************************************************************** +# Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * +# * +# This program and the accompanying materials are made available under the * +# terms of the MIT License which is available at * +# https://opensource.org/licenses/MIT. * +# * +# SPDX-License-Identifier: MIT * +# *****************************************************************************/ + +CMAKE_MINIMUM_REQUIRED(VERSION 3.5) PROJECT(KeypleCommonCppApi C CXX) -CMAKE_MINIMUM_REQUIRED(VERSION 3.0) SET(CMAKE_PROJECT_VERSION_MAJOR "2") SET(CMAKE_PROJECT_VERSION_MINOR "0") -SET(CMAKE_PROJECT_VERSION_PATCH "2") +SET(CMAKE_PROJECT_VERSION_PATCH "1") SET(CMAKE_PROJECT_VERSION "${CMAKE_PROJECT_VERSION_MAJOR}. ${CMAKE_PROJECT_VERSION_MINOR}. @@ -41,4 +39,5 @@ SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) # Add projects +ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/include) ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index c347b27..33bd8b6 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -90,4 +90,4 @@ The Eclipse Foundation Board of Directors may amend this Code from time to time This Code was inspired by the [Contributor Covenant](https://www.contributor-covenant.org/), version 1.4, available [here](https://www.contributor-covenant.org/version/1/4/code-of-conduct/). -[^1]: Capitalized terms used herein without definition shall have the meanings assigned to them in the Bylaws. \ No newline at end of file +[^1]: Capitalized terms used herein without definition shall have the meanings assigned to them in the Bylaws. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e99c61c..5052fad 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,38 +2,38 @@ **Welcome to the Eclipse Keyple Community!** -We are thrilled to have you onboard and look forward to your contributions. Whether you're a coder, designer, -documenter, or enthusiast, your involvement is invaluable to us. Here's how you can start contributing to Eclipse +We are thrilled to have you onboard and look forward to your contributions. Whether you're a coder, designer, +documenter, or enthusiast, your involvement is invaluable to us. Here's how you can start contributing to Eclipse Keyple: ## Quick Start 1. **Read the Contribution Guidelines**: Before starting, please visit our detailed contributing guide at the -[Eclipse Keyple Contribution Guide](https://keyple.org/community/contributing/). +[Eclipse Keyple Contribution Guide](https://keyple.org/community/contributing/). This guide covers all the necessary information about contributing to the project. -2. **Join the mailing list**: Connect with other contributors on our -[mailing list](https://accounts.eclipse.org/mailing-list/keyple-dev/). +2. **Join the mailing list**: Connect with other contributors on our +[mailing list](https://accounts.eclipse.org/mailing-list/keyple-dev/). It's a great place to ask questions, share ideas, and collaborate. 3. **Explore Open Issues**: Check out the issues tab in our GitHub repository. ## How to Contribute -- **Code**: Submit pull requests with bug fixes, new features, and improvements. Make sure to follow the code style and +- **Code**: Submit pull requests with bug fixes, new features, and improvements. Make sure to follow the code style and testing guidelines. - **Documentation**: Help us improve our documentation by fixing errors, adding examples, or writing tutorials. -- **Feedback**: Share your experience using Eclipse Keyple. Feedback on usability, features, and your overall experience +- **Feedback**: Share your experience using Eclipse Keyple. Feedback on usability, features, and your overall experience is incredibly valuable. -- **Community Support**: Answer questions on the community forums, help with user support, and participate in +- **Community Support**: Answer questions on the community forums, help with user support, and participate in discussions. ## Need Help? -If you have any questions or need assistance, please reach out on the +If you have any questions or need assistance, please reach out on the [mailing list](https://accounts.eclipse.org/mailing-list/keyple-dev/). --- diff --git a/CPPLINT.cfg b/CPPLINT.cfg new file mode 100644 index 0000000..35a93d5 --- /dev/null +++ b/CPPLINT.cfg @@ -0,0 +1,3 @@ +set noparent +filter=-whitespace/indent,-build/c++11,-runtime/references +linelength=80 diff --git a/NOTICE.md b/NOTICE.md index aa49180..e0ca8b7 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -40,4 +40,4 @@ SPDX-License-Identifier: EPL-2.0 ## Third-party Content -Google Mock/Test. \ No newline at end of file +Google Mock/Test. diff --git a/PUBLISHERS.yml b/PUBLISHERS.yml index ad1debc..41595d5 100644 --- a/PUBLISHERS.yml +++ b/PUBLISHERS.yml @@ -15,4 +15,4 @@ scm: url: https://github.com/eclipse/keyple-common-cpp-api ciManagement: system: GitHub Actions - url: https://github.com/eclipse/keyple-common-cpp-api/actions \ No newline at end of file + url: https://github.com/eclipse/keyple-common-cpp-api/actions diff --git a/SECURITY.md b/SECURITY.md index bfb9250..0b90d27 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -6,4 +6,4 @@ This project implements the Eclipse Foundation Security Policy ## Reporting a Vulnerability -Please report vulnerabilities to the Eclipse Foundation Security Team at security@eclipse.org \ No newline at end of file +Please report vulnerabilities to the Eclipse Foundation Security Team at security@eclipse.org diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt new file mode 100644 index 0000000..ebc8189 --- /dev/null +++ b/include/CMakeLists.txt @@ -0,0 +1,37 @@ +# ***************************************************************************** +# Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * +# * +# This program and the accompanying materials are made available under the * +# terms of the MIT License which is available at * +# https://opensource.org/licenses/MIT. * +# * +# SPDX-License-Identifier: MIT * +# *****************************************************************************/ + +SET(LIBRARY_NAME keyplecommon) + +# Declare this library as header only. +ADD_LIBRARY( + + ${LIBRARY_NAME} + + INTERFACE +) + +TARGET_INCLUDE_DIRECTORIES( + + ${LIBRARY_NAME} + + INTERFACE + + ${CMAKE_CURRENT_SOURCE_DIR} +) + +ADD_LIBRARY( + + Keyple::Common + + ALIAS + + ${LIBRARY_NAME} +) diff --git a/include/keyple/core/common/CommonApiProperties.hpp b/include/keyple/core/common/CommonApiProperties.hpp new file mode 100644 index 0000000..0634557 --- /dev/null +++ b/include/keyple/core/common/CommonApiProperties.hpp @@ -0,0 +1,45 @@ +/****************************************************************************** + * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * + * * + * This program and the accompanying materials are made available under the * + * terms of the MIT License which is available at * + * https://opensource.org/licenses/MIT. * + * * + * SPDX-License-Identifier: MIT * + ******************************************************************************/ + +#pragma once + +#include + +namespace keyple { +namespace core { +namespace common { + +/** + * API properties + * + * @since 2.0.0 + */ +// class CommonApiProperties final { +// public: +// /** +// * API version: {@value} +// * +// * @since 2.0.0 +// */ +// static const std::string VERSION; + +// private: +// /** +// * Private constructor +// */ +// CommonApiProperties() {} +// }; + +// const std::string CommonApiProperties::VERSION = "2.0"; +static const char* CommonApiProperties_VERSION = "2.0"; + +} /* namespace common */ +} /* namespace core */ +} /* namespace keyple */ diff --git a/include/keyple/core/common/KeypleCardExtension.hpp b/include/keyple/core/common/KeypleCardExtension.hpp new file mode 100644 index 0000000..1097f69 --- /dev/null +++ b/include/keyple/core/common/KeypleCardExtension.hpp @@ -0,0 +1,53 @@ +/****************************************************************************** + * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * + * * + * This program and the accompanying materials are made available under the * + * terms of the MIT License which is available at * + * https://opensource.org/licenses/MIT. * + * * + * SPDX-License-Identifier: MIT * + ******************************************************************************/ + +#pragma once + +#include + +namespace keyple { +namespace core { +namespace common { + +/** + * Generic type for a Keyple card extension. + * + * @since 2.0.0 + */ +class KeypleCardExtension { +public: + /** + * Gets the Reader API version used at compile time + * + * @return A not empty String. + * @since 2.0.0 + */ + virtual const std::string getReaderApiVersion() const = 0; + + /** + * Gets the Card API version used at compile time + * + * @return A not empty String. + * @since 2.0.0 + */ + virtual const std::string getCardApiVersion() const = 0; + + /** + * Gets the Common API version used at compile time + * + * @return A not empty String. + * @since 2.0.0 + */ + virtual const std::string getCommonApiVersion() const = 0; +}; + +} /* namespace common */ +} /* namespace core */ +} /* namespace keyple */ diff --git a/include/keyple/core/common/KeypleCardResourceProfileExtension.hpp b/include/keyple/core/common/KeypleCardResourceProfileExtension.hpp new file mode 100644 index 0000000..d7a5102 --- /dev/null +++ b/include/keyple/core/common/KeypleCardResourceProfileExtension.hpp @@ -0,0 +1,35 @@ +/****************************************************************************** + * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * + * * + * This program and the accompanying materials are made available under the * + * terms of the MIT License which is available at * + * https://opensource.org/licenses/MIT. * + * * + * SPDX-License-Identifier: MIT * + ******************************************************************************/ + +#pragma once + +namespace keyple { +namespace core { +namespace common { + +/** + * Generic type for a card resource profile extension. + * + *

A Keyple card resource extension is used by the allocation process of the + * card resource service to identify and prepare a card resource. + * + * @since 2.0.0 + */ +class KeypleCardResourceProfileExtension { +public: + /** + * Virtual destructor. + */ + virtual ~KeypleCardResourceProfileExtension() = default; +}; + +} /* namespace common */ +} /* namespace core */ +} /* namespace keyple */ diff --git a/include/keyple/core/common/KeypleCardSelectionResponse.hpp b/include/keyple/core/common/KeypleCardSelectionResponse.hpp new file mode 100644 index 0000000..e8f5304 --- /dev/null +++ b/include/keyple/core/common/KeypleCardSelectionResponse.hpp @@ -0,0 +1,36 @@ +/****************************************************************************** + * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * + * * + * This program and the accompanying materials are made available under the * + * terms of the MIT License which is available at * + * https://opensource.org/licenses/MIT. * + * * + * SPDX-License-Identifier: MIT * + ******************************************************************************/ + +#pragma once + +namespace keyple { +namespace core { +namespace common { + +/** + * Generic type for a POJO used to carry the response of a card selection + * request. + * + *

A card selection response is the result of presenting a card to an + * observable reader in a selection scenario. + * + * @since 2.0.0 + */ +class KeypleCardSelectionResponse { +public: + /** + * Virtual destructor. + */ + virtual ~KeypleCardSelectionResponse() = default; +}; + +} /* namespace common */ +} /* namespace core */ +} /* namespace keyple */ diff --git a/include/keyple/core/common/KeypleCardSelector.hpp b/include/keyple/core/common/KeypleCardSelector.hpp new file mode 100644 index 0000000..8552130 --- /dev/null +++ b/include/keyple/core/common/KeypleCardSelector.hpp @@ -0,0 +1,34 @@ +/****************************************************************************** + * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * + * * + * This program and the accompanying materials are made available under the * + * terms of the MIT License which is available at * + * https://opensource.org/licenses/MIT. * + * * + * SPDX-License-Identifier: MIT * + ******************************************************************************/ + +#pragma once + +namespace keyple { +namespace core { +namespace common { + +/** + * Generic type for a POJO carrying card selection settings. + * + *

A Keyple card selector defines the settings of a card selection case. + * + * @since 2.0.0 + */ +class KeypleCardSelector { +public: + /** + * Virtual destructor. + */ + virtual ~KeypleCardSelector() = default; +}; + +} /* namespace common */ +} /* namespace core */ +} /* namespace keyple */ diff --git a/include/keyple/core/common/KeypleDistributedLocalServiceExtension.hpp b/include/keyple/core/common/KeypleDistributedLocalServiceExtension.hpp new file mode 100644 index 0000000..812ec35 --- /dev/null +++ b/include/keyple/core/common/KeypleDistributedLocalServiceExtension.hpp @@ -0,0 +1,35 @@ +/****************************************************************************** + * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * + * * + * This program and the accompanying materials are made available under the * + * terms of the MIT License which is available at * + * https://opensource.org/licenses/MIT. * + * * + * SPDX-License-Identifier: MIT * + ******************************************************************************/ + +#pragma once + +namespace keyple { +namespace core { +namespace common { + +/** + * Generic type for a Keyple distributed local service extension. + * + *

Any Keyple distributed local extension must provide a factory that + * implements this interface. + * + * @since 2.0.0 + */ +class KeypleDistributedLocalServiceExtension { +public: + /** + * Virtual destructor. + */ + virtual ~KeypleDistributedLocalServiceExtension() = default; +}; + +} /* namespace common */ +} /* namespace core */ +} /* namespace keyple */ diff --git a/include/keyple/core/common/KeyplePluginExtension.hpp b/include/keyple/core/common/KeyplePluginExtension.hpp new file mode 100644 index 0000000..c212eec --- /dev/null +++ b/include/keyple/core/common/KeyplePluginExtension.hpp @@ -0,0 +1,37 @@ +/****************************************************************************** + * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * + * * + * This program and the accompanying materials are made available under the * + * terms of the MIT License which is available at * + * https://opensource.org/licenses/MIT. * + * * + * SPDX-License-Identifier: MIT * + ******************************************************************************/ + +#pragma once + +namespace keyple { +namespace core { +namespace common { + +/** + * Generic type for a Keyple plugin extension. + * + *

A plugin extension brings the specific attributes of a plugin. + * + *

Any Keyple plugin must provide a factory that returns plugins implementing + * this interface. + * + * @since 2.0.0 + */ +class KeyplePluginExtension { +public: + /** + * Virtual destructor. + */ + virtual ~KeyplePluginExtension() = default; +}; + +} /* namespace common */ +} /* namespace core */ +} /* namespace keyple */ diff --git a/include/keyple/core/common/KeyplePluginExtensionFactory.hpp b/include/keyple/core/common/KeyplePluginExtensionFactory.hpp new file mode 100644 index 0000000..a2ef20d --- /dev/null +++ b/include/keyple/core/common/KeyplePluginExtensionFactory.hpp @@ -0,0 +1,34 @@ +/****************************************************************************** + * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * + * * + * This program and the accompanying materials are made available under the * + * terms of the MIT License which is available at * + * https://opensource.org/licenses/MIT. * + * * + * SPDX-License-Identifier: MIT * + ******************************************************************************/ + +#pragma once + +namespace keyple { +namespace core { +namespace common { + +/** + * Generic type for a factory of Keyple plugin extension. + * + *

Any Keyple plugin must provide a factory that implements this interface. + * + * @since 2.0.0 + */ +class KeyplePluginExtensionFactory { +public: + /** + * Virtual destructor. + */ + virtual ~KeyplePluginExtensionFactory() = default; +}; + +} /* namespace common */ +} /* namespace core */ +} /* namespace keyple */ diff --git a/include/keyple/core/common/KeypleReaderExtension.hpp b/include/keyple/core/common/KeypleReaderExtension.hpp new file mode 100644 index 0000000..2280623 --- /dev/null +++ b/include/keyple/core/common/KeypleReaderExtension.hpp @@ -0,0 +1,36 @@ +/****************************************************************************** + * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * + * * + * This program and the accompanying materials are made available under the * + * terms of the MIT License which is available at * + * https://opensource.org/licenses/MIT. * + * * + * SPDX-License-Identifier: MIT * + ******************************************************************************/ + +#pragma once + +namespace keyple { +namespace core { +namespace common { + +/** + * Generic type for a Keyple reader extension. + * + *

A reader extension brings the specific attributes of a reader. + * + *

Any Keyple plugin must provide readers implementing this interface. + * + * @since 2.0.0 + */ +class KeypleReaderExtension { +public: + /** + * Virtual destructor. + */ + virtual ~KeypleReaderExtension() = default; +}; + +} /* namespace common */ +} /* namespace core */ +} /* namespace keyple */ diff --git a/include/keyple/core/common/KeypleSmartCard.hpp b/include/keyple/core/common/KeypleSmartCard.hpp new file mode 100644 index 0000000..02fd50e --- /dev/null +++ b/include/keyple/core/common/KeypleSmartCard.hpp @@ -0,0 +1,32 @@ +/****************************************************************************** + * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * + * * + * This program and the accompanying materials are made available under the * + * terms of the MIT License which is available at * + * https://opensource.org/licenses/MIT. * + * * + * SPDX-License-Identifier: MIT * + ******************************************************************************/ + +#pragma once + +namespace keyple { +namespace core { +namespace common { + +/** + * Generic type for a POJO used to carry the known data content of a smart card. + * + * @since 2.0.0 + */ +class KeypleSmartCard { +public: + /** + * Virtual destructor. + */ + virtual ~KeypleSmartCard() = default; +}; + +} /* namespace common */ +} /* namespace core */ +} /* namespace keyple */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 623979c..fdeb8f0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,16 +1,12 @@ -# ************************************************************************************************* -# Copyright (c) 2021 Calypso Networks Association * -# https://www.calypsonet-asso.org/ * -# * -# See the NOTICE file(s) distributed with this work for additional information regarding * -# copyright ownership. * -# * -# This program and the accompanying materials are made available under the terms of the Eclipse * -# Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 * -# * -# SPDX-License-Identifier: EPL-2.0 * -# *************************************************************************************************/ +# ***************************************************************************** +# Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * +# * +# This program and the accompanying materials are made available under the * +# terms of the MIT License which is available at * +# https://opensource.org/licenses/MIT. * +# * +# SPDX-License-Identifier: MIT * +# *****************************************************************************/ # Add projects -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/main/) -#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test/) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test/) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt deleted file mode 100644 index a10b569..0000000 --- a/src/main/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -# ************************************************************************************************* -# Copyright (c) 2021 Calypso Networks Association http://calypsonet.org/ * -# * -# See the NOTICE file(s) distributed with this work for additional information regarding * -# copyright ownership. * -# * -# This program and the accompanying materials are made available under the terms of the Eclipse * -# Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 * -# * -# SPDX-License-Identifier: EPL-2.0 * -# *************************************************************************************************/ - -SET(LIBRARY_NAME keyplecommoncppapilib) - -# declare this library as header only -ADD_LIBRARY( - ${LIBRARY_NAME} - INTERFACE -) - -TARGET_INCLUDE_DIRECTORIES( - ${LIBRARY_NAME} - INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR} -) - -ADD_LIBRARY(Keyple::CommonApi ALIAS ${LIBRARY_NAME}) diff --git a/src/main/CommonApiProperties.h b/src/main/CommonApiProperties.h deleted file mode 100644 index 85e84d7..0000000 --- a/src/main/CommonApiProperties.h +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************************************** - * Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ * - * * - * See the NOTICE file(s) distributed with this work for additional information regarding * - * copyright ownership. * - * * - * This program and the accompanying materials are made available under the terms of the Eclipse * - * Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 * - * * - * SPDX-License-Identifier: EPL-2.0 * - **************************************************************************************************/ - -#pragma once - -#include - -namespace keyple { -namespace core { -namespace common { - -/** - * API properties - * - * @since 2.0.0 - */ -// class CommonApiProperties final { -// public: -// /** -// * API version: {@value} -// * -// * @since 2.0.0 -// */ -// static const std::string VERSION; - -// private: -// /** -// * Private constructor -// */ -// CommonApiProperties() {} -// }; - -// const std::string CommonApiProperties::VERSION = "2.0"; -static const std::string CommonApiProperties_VERSION = "2.0"; - -} -} -} diff --git a/src/main/KeypleCardExtension.h b/src/main/KeypleCardExtension.h deleted file mode 100644 index da28534..0000000 --- a/src/main/KeypleCardExtension.h +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************************************************** - * Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ * - * * - * See the NOTICE file(s) distributed with this work for additional information regarding * - * copyright ownership. * - * * - * This program and the accompanying materials are made available under the terms of the Eclipse * - * Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 * - * * - * SPDX-License-Identifier: EPL-2.0 * - **************************************************************************************************/ - -#pragma once - -#include - -namespace keyple { -namespace core { -namespace common { - -/** - * Generic type for a Keyple card extension. - * - * @since 2.0.0 - */ -class KeypleCardExtension { -public: - /** - * Gets the Reader API version used at compile time - * - * @return A not empty String. - * @since 2.0.0 - */ - virtual const std::string& getReaderApiVersion() const = 0; - - /** - * Gets the Card API version used at compile time - * - * @return A not empty String. - * @since 2.0.0 - */ - virtual const std::string& getCardApiVersion() const = 0; - - /** - * Gets the Common API version used at compile time - * - * @return A not empty String. - * @since 2.0.0 - */ - virtual const std::string& getCommonApiVersion() const = 0; - }; - -} -} -} diff --git a/src/main/KeypleCardResourceProfileExtension.h b/src/main/KeypleCardResourceProfileExtension.h deleted file mode 100644 index 7243a1e..0000000 --- a/src/main/KeypleCardResourceProfileExtension.h +++ /dev/null @@ -1,31 +0,0 @@ -/************************************************************************************************** - * Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ * - * * - * See the NOTICE file(s) distributed with this work for additional information regarding * - * copyright ownership. * - * * - * This program and the accompanying materials are made available under the terms of the Eclipse * - * Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 * - * * - * SPDX-License-Identifier: EPL-2.0 * - **************************************************************************************************/ - -#pragma once - -namespace keyple { -namespace core { -namespace common { - -/** - * Generic type for a card resource profile extension. - * - *

A Keyple card resource extension is used by the allocation process of the card resource - * service to identify and prepare a card resource. - * - * @since 2.0.0 - */ -class KeypleCardResourceProfileExtension {}; - -} -} -} diff --git a/src/main/KeypleCardSelectionResponse.h b/src/main/KeypleCardSelectionResponse.h deleted file mode 100644 index 4d8f025..0000000 --- a/src/main/KeypleCardSelectionResponse.h +++ /dev/null @@ -1,31 +0,0 @@ -/************************************************************************************************** - * Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ * - * * - * See the NOTICE file(s) distributed with this work for additional information regarding * - * copyright ownership. * - * * - * This program and the accompanying materials are made available under the terms of the Eclipse * - * Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 * - * * - * SPDX-License-Identifier: EPL-2.0 * - **************************************************************************************************/ - -#pragma once - -namespace keyple { -namespace core { -namespace common { - -/** - * Generic type for a POJO used to carry the response of a card selection request. - * - *

A card selection response is the result of presenting a card to an observable reader in a - * selection scenario. - * - * @since 2.0.0 - */ -class KeypleCardSelectionResponse {}; - -} -} -} diff --git a/src/main/KeypleCardSelector.h b/src/main/KeypleCardSelector.h deleted file mode 100644 index a789ccf..0000000 --- a/src/main/KeypleCardSelector.h +++ /dev/null @@ -1,30 +0,0 @@ -/************************************************************************************************** - * Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ * - * * - * See the NOTICE file(s) distributed with this work for additional information regarding * - * copyright ownership. * - * * - * This program and the accompanying materials are made available under the terms of the Eclipse * - * Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 * - * * - * SPDX-License-Identifier: EPL-2.0 * - **************************************************************************************************/ - -#pragma once - -namespace keyple { -namespace core { -namespace common { - -/** - * Generic type for a POJO carrying card selection settings. - * - *

A Keyple card selector defines the settings of a card selection case. - * - * @since 2.0.0 - */ -class KeypleCardSelector {}; - -} -} -} diff --git a/src/main/KeypleDistributedLocalServiceExtension.h b/src/main/KeypleDistributedLocalServiceExtension.h deleted file mode 100644 index 552e340..0000000 --- a/src/main/KeypleDistributedLocalServiceExtension.h +++ /dev/null @@ -1,30 +0,0 @@ -/************************************************************************************************** - * Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ * - * * - * See the NOTICE file(s) distributed with this work for additional information regarding * - * copyright ownership. * - * * - * This program and the accompanying materials are made available under the terms of the Eclipse * - * Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 * - * * - * SPDX-License-Identifier: EPL-2.0 * - **************************************************************************************************/ - -#pragma once - -namespace keyple { -namespace core { -namespace common { - -/** - * Generic type for a Keyple distributed local service extension. - * - *

Any Keyple distributed local extension must provide a factory that implements this interface. - * - * @since 2.0.0 - */ -class KeypleDistributedLocalServiceExtension {}; - -} -} -} diff --git a/src/main/KeyplePluginExtension.h b/src/main/KeyplePluginExtension.h deleted file mode 100644 index 00244c6..0000000 --- a/src/main/KeyplePluginExtension.h +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************************************** - * Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ * - * * - * See the NOTICE file(s) distributed with this work for additional information regarding * - * copyright ownership. * - * * - * This program and the accompanying materials are made available under the terms of the Eclipse * - * Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 * - * * - * SPDX-License-Identifier: EPL-2.0 * - **************************************************************************************************/ - -#pragma once - -namespace keyple { -namespace core { -namespace common { - -/** - * Generic type for a Keyple plugin extension. - * - *

A plugin extension brings the specific attributes of a plugin. - * - *

Any Keyple plugin must provide a factory that returns plugins implementing this interface. - * - * @since 2.0.0 - */ -class KeyplePluginExtension { -public: - /** - * - */ - virtual ~KeyplePluginExtension() = default; -}; - -} -} -} diff --git a/src/main/KeyplePluginExtensionFactory.h b/src/main/KeyplePluginExtensionFactory.h deleted file mode 100644 index b07d128..0000000 --- a/src/main/KeyplePluginExtensionFactory.h +++ /dev/null @@ -1,36 +0,0 @@ -/************************************************************************************************** - * Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ * - * * - * See the NOTICE file(s) distributed with this work for additional information regarding * - * copyright ownership. * - * * - * This program and the accompanying materials are made available under the terms of the Eclipse * - * Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 * - * * - * SPDX-License-Identifier: EPL-2.0 * - **************************************************************************************************/ - -#pragma once - -namespace keyple { -namespace core { -namespace common { - -/** - * Generic type for a factory of Keyple plugin extension. - * - *

Any Keyple plugin must provide a factory that implements this interface. - * - * @since 2.0.0 - */ -class KeyplePluginExtensionFactory { -public: - /** - * /!\ C++: added virtual destructor to make class polymorphic - */ - virtual ~KeyplePluginExtensionFactory() = default; -}; - -} -} -} diff --git a/src/main/KeypleReaderExtension.h b/src/main/KeypleReaderExtension.h deleted file mode 100644 index a424101..0000000 --- a/src/main/KeypleReaderExtension.h +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************************************** - * Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ * - * * - * See the NOTICE file(s) distributed with this work for additional information regarding * - * copyright ownership. * - * * - * This program and the accompanying materials are made available under the terms of the Eclipse * - * Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 * - * * - * SPDX-License-Identifier: EPL-2.0 * - **************************************************************************************************/ - -#pragma once - -namespace keyple { -namespace core { -namespace common { - -/** - * Generic type for a Keyple reader extension. - * - *

A reader extension brings the specific attributes of a reader. - * - *

Any Keyple plugin must provide readers implementing this interface. - * - * @since 2.0.0 - */ -class KeypleReaderExtension { -public: - /** - * - */ - virtual ~KeypleReaderExtension() = default; -}; - -} -} -} diff --git a/src/main/KeypleSmartCard.h b/src/main/KeypleSmartCard.h deleted file mode 100644 index 26441b8..0000000 --- a/src/main/KeypleSmartCard.h +++ /dev/null @@ -1,28 +0,0 @@ -/************************************************************************************************** - * Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ * - * * - * See the NOTICE file(s) distributed with this work for additional information regarding * - * copyright ownership. * - * * - * This program and the accompanying materials are made available under the terms of the Eclipse * - * Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 * - * * - * SPDX-License-Identifier: EPL-2.0 * - **************************************************************************************************/ - -#pragma once - -namespace keyple { -namespace core { -namespace common { - -/** - * Generic type for a POJO used to carry the known data content of a smart card. - * - * @since 2.0.0 - */ -class KeypleSmartCard {}; - -} -} -} diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index e2f8e2d..afcf1f7 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -1,25 +1,23 @@ -# ************************************************************************************************* -# Copyright (c) 2021 Calypso Networks Association * -# https://www.calypsonet-asso.org/ * -# * -# See the NOTICE file(s) distributed with this work for additional information regarding * -# copyright ownership. * -# * -# This program and the accompanying materials are made available under the terms of the Eclipse * -# Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 * -# * -# SPDX-License-Identifier: EPL-2.0 * -# *************************************************************************************************/ +# ***************************************************************************** +# Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * +# * +# This program and the accompanying materials are made available under the * +# terms of the MIT License which is available at * +# https://opensource.org/licenses/MIT. * +# * +# SPDX-License-Identifier: MIT * +# *****************************************************************************/ SET(EXECTUABLE_NAME keyplecommoncppapi_ut) INCLUDE_DIRECTORIES( + + ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/../main - ${CMAKE_CURRENT_SOURCE_DIR}/../main/spi ) ADD_EXECUTABLE( + ${EXECTUABLE_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/MainTest.cpp @@ -27,7 +25,15 @@ ADD_EXECUTABLE( ) # Add Google Test -SET(GOOGLETEST_DIRECTORY ${CMAKE_BINARY_DIR}/bin) INCLUDE(CMakeLists.txt.googletest) -TARGET_LINK_LIBRARIES(${EXECTUABLE_NAME} gtest gmock Keyple::Util) +TARGET_LINK_LIBRARIES( + + ${EXECTUABLE_NAME} + + PRIVATE + + gtest + gmock + Keyple::Common +) diff --git a/src/test/CMakeLists.txt.googletest b/src/test/CMakeLists.txt.googletest index 3b56093..c46dce4 100644 --- a/src/test/CMakeLists.txt.googletest +++ b/src/test/CMakeLists.txt.googletest @@ -1,35 +1,41 @@ -CONFIGURE_FILE(CMakeLists.txt.in ${GOOGLETEST_DIRECTORY}/googletest-download/CMakeLists.txt) -EXECUTE_PROCESS( - COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . - RESULT_VARIABLE result - WORKING_DIRECTORY ${GOOGLETEST_DIRECTORY}/googletest-download -) - -# Prevent overriding the parent project's compiler/linker -# settings on Windows -set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) +# ***************************************************************************** +# Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * +# * +# This program and the accompanying materials are made available under the * +# terms of the MIT License which is available at * +# https://opensource.org/licenses/MIT. * +# * +# SPDX-License-Identifier: MIT * +# *****************************************************************************/ -IF(result) - MESSAGE(FATAL_ERROR "CMake step for googletest failed: ${result}") -ENDIF() +# FetchContent added in CMake 3.11, downloads during the configure step +# FetchContent_MakeAvailable was added in CMake 3.14; simpler usage +INCLUDE(FetchContent) + +IF(NOT EXISTS "${CMAKE_BINARY_DIR}/_deps/googletest-src") + + MESSAGE("-- > Fetching GTest from keyple common") + + FetchContent_Declare( + + googletest -EXECUTE_PROCESS( - COMMAND ${CMAKE_COMMAND} --build . - RESULT_VARIABLE result - WORKING_DIRECTORY ${GOOGLETEST_DIRECTORY}/googletest-download -) + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG v1.14.0 + ) + +ELSE() + + FetchContent_Declare( + + googletest + + SOURCE_DIR ${CMAKE_BINARY_DIR}/_deps/googletest-src + ) -IF(result) - MESSAGE(FATAL_ERROR "Build step for googletest failed: ${result}") ENDIF() -# Prevent overriding the parent project's compiler/linker -# settings on Windows -#SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE) +# For Windows: Prevent overriding the parent project's compiler/linker settings +set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) -# Add googletest directly to our build. This defines -# the gtest and gtest_main targets. -ADD_SUBDIRECTORY(${GOOGLETEST_DIRECTORY}/googletest-src - ${GOOGLETEST_DIRECTORY}/googletest-build - EXCLUDE_FROM_ALL -) \ No newline at end of file +FetchContent_MakeAvailable(googletest) diff --git a/src/test/CMakeLists.txt.in b/src/test/CMakeLists.txt.in deleted file mode 100644 index 5f1bbe5..0000000 --- a/src/test/CMakeLists.txt.in +++ /dev/null @@ -1,28 +0,0 @@ -# ************************************************************************************************* -# Copyright (c) 2021 Calypso Networks Association * -# https://www.calypsonet-asso.org/ * -# * -# See the NOTICE file(s) distributed with this work for additional information regarding * -# copyright ownership. * -# * -# This program and the accompanying materials are made available under the terms of the Eclipse * -# Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 * -# * -# SPDX-License-Identifier: EPL-2.0 * -# *************************************************************************************************/ - -cmake_minimum_required(VERSION 2.8.2) - -project(googletest-download NONE) - -include(ExternalProject) -ExternalProject_Add(googletest - GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG release-1.11.0 - SOURCE_DIR "${GOOGLETEST_DIRECTORY}/googletest-src" - BINARY_DIR "${GOOGLETEST_DIRECTORY}/googletest-build" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" -) diff --git a/src/test/CommonApiPropertiesTest.cpp b/src/test/CommonApiPropertiesTest.cpp index 89f1e85..6b54a83 100644 --- a/src/test/CommonApiPropertiesTest.cpp +++ b/src/test/CommonApiPropertiesTest.cpp @@ -1,31 +1,24 @@ -/************************************************************************************************** - * Copyright (c) 2021 Calypso Networks Association * - * https://www.calypsonet-asso.org/ * - * * - * See the NOTICE file(s) distributed with this work for additional information regarding * - * copyright ownership. * - * * - * This program and the accompanying materials are made available under the terms of the Eclipse * - * Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 * - * * - * SPDX-License-Identifier: EPL-2.0 * - **************************************************************************************************/ +/****************************************************************************** + * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * + * * + * This program and the accompanying materials are made available under the * + * terms of the MIT License which is available at * + * https://opensource.org/licenses/MIT. * + * * + * SPDX-License-Identifier: MIT * + ******************************************************************************/ #include #include "gmock/gmock.h" #include "gtest/gtest.h" -/* Keyple Common */ -#include "CommonApiProperties.h" +#include "keyple/core/common/CommonApiProperties.hpp" -using namespace testing; +using keyple::core::common::CommonApiProperties_VERSION; -using namespace keyple::core::common; - -TEST(CommonApiPropertiesTest, versionIsCorrectlyWritten) -{ - const std::string& apiVersion = CommonApiProperties::VERSION; +TEST(CommonApiPropertiesTest, versionIsCorrectlyWritten) { + const std::string& apiVersion = CommonApiProperties_VERSION; const std::regex r("\\d+\\.\\d+"); ASSERT_TRUE(std::regex_match(apiVersion, r)); diff --git a/src/test/MainTest.cpp b/src/test/MainTest.cpp index 008dbcc..c3bc772 100644 --- a/src/test/MainTest.cpp +++ b/src/test/MainTest.cpp @@ -1,32 +1,20 @@ -/************************************************************************************************** - * Copyright (c) 2021 Calypso Networks Association * - * https://www.calypsonet-asso.org/ * - * * - * See the NOTICE file(s) distributed with this work for additional information regarding * - * copyright ownership. * - * * - * This program and the accompanying materials are made available under the terms of the Eclipse * - * Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 * - * * - * SPDX-License-Identifier: EPL-2.0 * - **************************************************************************************************/ +/****************************************************************************** + * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ * + * * + * This program and the accompanying materials are made available under the * + * terms of the MIT License which is available at * + * https://opensource.org/licenses/MIT. * + * * + * SPDX-License-Identifier: MIT * + ******************************************************************************/ #include "gtest/gtest.h" -/* Util */ -#include "Logger.h" - -using namespace testing; - -using namespace keyple::core::util::cpp; - -int main(int argc, char **argv) -{ +int +main(int argc, char** argv) { /* Initialize GTest */ ::testing::InitGoogleTest(&argc, argv); - Logger::setLoggerLevel(Logger::Level::logError); - /* Run */ return RUN_ALL_TESTS(); -} \ No newline at end of file +} diff --git a/toolchain/arm-unknown-gnueabi-linux.cmake b/toolchain/arm-unknown-gnueabi-linux.cmake index c7c68bc..3683870 100644 --- a/toolchain/arm-unknown-gnueabi-linux.cmake +++ b/toolchain/arm-unknown-gnueabi-linux.cmake @@ -9,10 +9,10 @@ SET(ARM_SYSROOT_DIR ${ARM_TOOLCHAIN_DIR}/arm-unknown-linux-gnueabi/sysroot) # Which C and C++ compiler to use SET(CMAKE_C_COMPILER ${ARM_COMPILER_DIR}/arm-unknown-linux-gnueabi-gcc) -SET(CMAKE_CXX_COMPILER ${ARM_COMPILER_DIR}/arm-unknown-linux-gnueabi-g++) +SET(CMAKE_CXX_COMPILER ${ARM_COMPILER_DIR}/arm-unknown-linux-gnueabi-g++) # Here is the target environment located -SET(CMAKE_FIND_ROOT_PATH ${ARM_SYSROOT_DIR}) +SET(CMAKE_FIND_ROOT_PATH ${ARM_SYSROOT_DIR}) # Adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, @@ -24,4 +24,3 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) # Linker SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} --sysroot=${ARM_SYSROOT_DIR}") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS} --sysroot=${ARM_SYSROOT_DIR} -L${ARM_SYSROOT_DIR}") - diff --git a/toolchain/clang-8-linux.cmake b/toolchain/clang-8-linux.cmake index 1a932d1..93222ef 100644 --- a/toolchain/clang-8-linux.cmake +++ b/toolchain/clang-8-linux.cmake @@ -42,4 +42,3 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") # Libraries type SET(LIBRARY_TYPE SHARED) - diff --git a/toolchain/clang-9-linux.cmake b/toolchain/clang-9-linux.cmake index ac30418..4c13b7f 100644 --- a/toolchain/clang-9-linux.cmake +++ b/toolchain/clang-9-linux.cmake @@ -42,4 +42,3 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") # Libraries type SET(LIBRARY_TYPE SHARED) - diff --git a/toolchain/clang-linux.cmake b/toolchain/clang-linux.cmake index 31cea4d..6282777 100644 --- a/toolchain/clang-linux.cmake +++ b/toolchain/clang-linux.cmake @@ -42,4 +42,3 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") # Libraries type SET(LIBRARY_TYPE SHARED) - diff --git a/toolchain/clang-macos.cmake b/toolchain/clang-macos.cmake index f965786..29a03d5 100644 --- a/toolchain/clang-macos.cmake +++ b/toolchain/clang-macos.cmake @@ -42,4 +42,3 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") # Libraries type SET(LIBRARY_TYPE SHARED) - diff --git a/toolchain/clang-windows.cmake b/toolchain/clang-windows.cmake index 606fe65..85be998 100644 --- a/toolchain/clang-windows.cmake +++ b/toolchain/clang-windows.cmake @@ -45,8 +45,8 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MDd") # debug multi thread dll SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GS") # buffers security check SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise") # floating point SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:wchar_t") # standard behaviour -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:forScope") # -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:inline") # +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:forScope") # +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:inline") # SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR") # enables RTTI SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Gd") # uses __cdecl convention SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /TP") # all sources are C++ @@ -67,4 +67,3 @@ SET(LIBRARY_TYPE SHARED) # Special tricks INCLUDE(GenerateExportHeader) - diff --git a/toolchain/gcc-10-linux.cmake b/toolchain/gcc-10-linux.cmake index 3fbe78b..3282cd6 100644 --- a/toolchain/gcc-10-linux.cmake +++ b/toolchain/gcc-10-linux.cmake @@ -43,4 +43,3 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmax-errors=10") # Libraries type SET(LIBRARY_TYPE SHARED) - diff --git a/toolchain/gcc-4.8.3-linux.cmake b/toolchain/gcc-4.8.3-linux.cmake index f6af177..e6d3df0 100644 --- a/toolchain/gcc-4.8.3-linux.cmake +++ b/toolchain/gcc-4.8.3-linux.cmake @@ -27,4 +27,3 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) # Linker #SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} --sysroot=${GCC_SYSROOT_DIR}") #SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS} --sysroot=${GCC_SYSROOT_DIR} -L${GCC_SYSROOT_DIR}") - diff --git a/toolchain/gcc-8-linux.cmake b/toolchain/gcc-8-linux.cmake index 6272eb1..db27a7b 100644 --- a/toolchain/gcc-8-linux.cmake +++ b/toolchain/gcc-8-linux.cmake @@ -43,4 +43,3 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmax-errors=10") # Libraries type SET(LIBRARY_TYPE SHARED) - diff --git a/toolchain/gcc-9-linux.cmake b/toolchain/gcc-9-linux.cmake index 21685b2..a6e923d 100644 --- a/toolchain/gcc-9-linux.cmake +++ b/toolchain/gcc-9-linux.cmake @@ -43,4 +43,3 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmax-errors=10") # Libraries type SET(LIBRARY_TYPE SHARED) - diff --git a/toolchain/gcc-linux.cmake b/toolchain/gcc-linux.cmake index a62432d..ff67b6e 100644 --- a/toolchain/gcc-linux.cmake +++ b/toolchain/gcc-linux.cmake @@ -43,4 +43,3 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmax-errors=10") # Libraries type SET(LIBRARY_TYPE SHARED) - diff --git a/toolchain/ios-macos.cmake b/toolchain/ios-macos.cmake index 990470f..3407d82 100644 --- a/toolchain/ios-macos.cmake +++ b/toolchain/ios-macos.cmake @@ -92,4 +92,3 @@ SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,-search_paths_first") # Libraries type SET(LIBRARY_TYPE STATIC) -