/******************************************************************************** * Copyright (c) 2025-2026 ZF Friedrichshafen AG * * This program and the accompanying materials are made available under the * terms of the Apache License Version 2.0 which is available at * https://www.apache.org/licenses/LICENSE-2.0 * * SPDX-License-Identifier: Apache-2.0 * * Contributors: * Erik Verhoeven - initial API and implementation ********************************************************************************/ #ifndef CONTEXT_H #define CONTEXT_H #include #include #include #include /** * @brief SDV context */ struct SContext { bool bSilent = false; ///< Silence flag bool bVerbose = false; ///< Verbose flag bool bServerSilent = false; ///< Silence flag of server bool bServerVerbose = false; ///< Verbose flag of server uint32_t uiInstanceID = 1000; ///< Instance ID bool bListNoHdr = false; ///< Do not print a header with the listing table. bool bListShort = false; ///< Print only a shortened list with one column. sdv::sequence seqCmdLine; ///< The commands provided on the command line. std::filesystem::path pathInstallDir; ///< Optional installation directory. }; #include // std::tolower #include // std::equal /** * @brief Compare whether two characters are identical when both are converted to lower case. * @remarks Cannot deal with Unicode letters comprising of more than one characters. * @param[in] cLeft First character * @param[in] cRight Second character * @return The case independent equality of the characters. */ inline bool ichar_equals(char cLeft, char cRight) { return std::tolower(static_cast(cLeft)) == std::tolower(static_cast(cRight)); } /** * @brief Compare for case-independent equality. * @param[in] rssLeft Reference to the left string. * @param[in] rssRight Reference to the right string. * @return The case-independent equality of the strings. */ inline bool iequals(const std::string& rssLeft, const std::string& rssRight) { return std::equal(rssLeft.begin(), rssLeft.end(), rssRight.begin(), rssRight.end(), ichar_equals); } #endif // !defined CONTEXT_H