diff --git a/src/clistats.cpp b/src/clistats.cpp index 8a0d233..55ffcc6 100644 --- a/src/clistats.cpp +++ b/src/clistats.cpp @@ -43,16 +43,30 @@ */ struct ApplicationProperties { + /** + * Application version + * @returns Version string + */ + static + std::string + version() + { + return ApplicationProperties::VERSION_MAJOR + "." + + ApplicationProperties::VERSION_MINOR + "." + + ApplicationProperties::VERSION_PATCH; + } static std::string NAME; static std::string AUTHOR; static std::string VERSION_MAJOR; static std::string VERSION_MINOR; + static std::string VERSION_PATCH; }; std::string ApplicationProperties::NAME = "clistats"; std::string ApplicationProperties::AUTHOR = "dpmcmlxxvi@gmail.com"; -std::string ApplicationProperties::VERSION_MAJOR = "0"; -std::string ApplicationProperties::VERSION_MINOR = "1"; +std::string ApplicationProperties::VERSION_MAJOR = "1"; +std::string ApplicationProperties::VERSION_MINOR = "0"; +std::string ApplicationProperties::VERSION_PATCH = "0"; /** * @struct Logger @@ -1655,8 +1669,9 @@ class CommandLineParser /** * Print software usage */ + static void - printUsage() const + printUsage() { std::cout << std::endl; std::cout << "NAME" << std::endl; @@ -1888,10 +1903,11 @@ class CommandLineParser /** * Print software version */ + static void - printVersion() const + printVersion() { - std::cout << ApplicationProperties::VERSION_MAJOR << "." << ApplicationProperties::VERSION_MINOR << std::endl; + std::cout << ApplicationProperties::version() << std::endl; } /** @@ -4009,12 +4025,12 @@ pdrv(int argc, CommandLineParser parser(argc, argv); if (parser.showUsage()) { - parser.printUsage(); + CommandLineParser::printUsage(); return AppStatus::SUCCESS; } else if (parser.showVersion()) { - parser.printVersion(); + CommandLineParser::printVersion(); return AppStatus::SUCCESS; } options = parser.options; diff --git a/test/clistatstest.cpp b/test/clistatstest.cpp index 0cded1e..de8504b 100644 --- a/test/clistatstest.cpp +++ b/test/clistatstest.cpp @@ -594,7 +594,7 @@ main(int argc, // Display header // ---------------------------------------------------------------------- std::cout << std::endl; - std::cout << " Testing " << ApplicationProperties::NAME << " " << ApplicationProperties::VERSION_MAJOR << "." << ApplicationProperties::VERSION_MINOR << std::endl; + std::cout << " Testing " << ApplicationProperties::NAME << " " << ApplicationProperties::version() << std::endl; std::cout << std::endl; std::cout << header << std::endl;