Geometrize  1.0
An application for geometrizing images into geometric primitives
Functions
geometrize::cli Namespace Reference

Functions

bool shouldRunInSelfTestMode (const QStringList &arguments)
 shouldRunInSelfTestMode Checks whether the application should run in automated self-test/functional testing mode. More...
 
std::vector< std::string > getSelfTestModeScriptDirectories (const QStringList &arguments)
 getSelfTestModeScriptDirectories Gets a vector of the directories containing scripts to run in self-test mode More...
 
bool shouldRunInConsoleMode (const QStringList &arguments)
 shouldRunInConsoleMode Checks whether the application should run in console mode for the given arguments. More...
 
std::string getOverrideLocaleCode (const QStringList &arguments)
 getOverrideLocaleCode Gets the override locale code that the application should start up with. More...
 
int runApp (QApplication &app)
 runApp Runs the application in console mode. Note that since Windows does not support dual-mode applications, this isn't "true" console mode - we just don't create a main window/GUI. More...
 

Function Documentation

◆ getOverrideLocaleCode()

std::string geometrize::cli::getOverrideLocaleCode ( const QStringList &  arguments)

getOverrideLocaleCode Gets the override locale code that the application should start up with.

Parameters
argumentsThe console arguments.
Returns
The override locale code, or an empty string if no override was specified.
100 {
101  QCommandLineParser parser;
102  setupCommandLineParser(parser, arguments);
103 
104  if(!parser.isSet(localeOverrideFlag)) {
105  return "";
106  }
107  return parser.value(localeOverrideFlag).toStdString();
108 }

◆ getSelfTestModeScriptDirectories()

std::vector< std::string > geometrize::cli::getSelfTestModeScriptDirectories ( const QStringList &  arguments)

getSelfTestModeScriptDirectories Gets a vector of the directories containing scripts to run in self-test mode

Parameters
argumentsThe console arguments.
Returns
A vector of paths to directories containing scripts to run in self-test mode, empty if there are no tests to run.
86 {
87  QCommandLineParser parser;
88  setupCommandLineParser(parser, arguments);
89  return std::vector<std::string>{parser.value(selfTestsFlag).toStdString()};
90 }

◆ runApp()

int geometrize::cli::runApp ( QApplication &  app)

runApp Runs the application in console mode. Note that since Windows does not support dual-mode applications, this isn't "true" console mode - we just don't create a main window/GUI.

Parameters
appThe application.
Returns
0 on success, any other return code if there was an error.
111 {
112  const QStringList arguments{app.arguments()};
113 
114  QCommandLineParser parser;
115  setupCommandLineParser(parser, arguments);
116  handleCommandLineArguments(parser);
117 
118  return 0;
119 }

◆ shouldRunInConsoleMode()

bool geometrize::cli::shouldRunInConsoleMode ( const QStringList &  arguments)

shouldRunInConsoleMode Checks whether the application should run in console mode for the given arguments.

Parameters
argumentsThe console arguments.
Returns
True if the application should run in console mode, else false.
93 {
94  QCommandLineParser parser;
95  setupCommandLineParser(parser, arguments);
96  return parser.isSet(scriptFileFlag) || parser.isSet(scriptSourceFlag);
97 }

◆ shouldRunInSelfTestMode()

bool geometrize::cli::shouldRunInSelfTestMode ( const QStringList &  arguments)

shouldRunInSelfTestMode Checks whether the application should run in automated self-test/functional testing mode.

Parameters
argumentsThe console arguments.
Returns
True if the application should run in self-test mode, else false.
79 {
80  QCommandLineParser parser;
81  setupCommandLineParser(parser, arguments);
82  return parser.isSet(selfTestsFlag) || parser.isSet(selfTestsFlag);
83 }