113#define Foam_argList_1712
129 static bool argsMandatory_;
132 static bool checkProcessorDirectories_;
159 static word optionCompat(
const word& optName);
162 static int optionIgnore(
const word& optName);
167 static void checkITstream(
const ITstream& is,
const label index);
172 static void checkITstream(
const ITstream& is,
const word& optName);
180 void raiseBadInput(
const word& optName)
const;
196 bool regroupArgv(
int& argc,
char**& argv);
199 void printManCompat()
const;
236 static std::string::size_type
usageMin;
239 static std::string::size_type
usageMax;
246 struct initValidTables
266 bool checkOpts =
true,
267 bool initialise =
true
275 bool checkArgs =
true,
276 bool checkOpts =
true,
277 bool initialise =
true
317 const bool caseTag =
false
325 void parse(
bool checkArgs,
bool checkOpts,
bool initialise);
363 const
bool caseTag = false
405 inline
bool found(const
word& optName) const;
411 label
count(std::initializer_list<
word> optionNames) const;
420 inline
T get(const label index) const;
430 template<class
T=
string>
431 inline
T get(const
word& optName) const;
476 template<class
T, class Predicate>
481 const Predicate& pred,
482 bool mandatory = true
493 template<class
T, class Predicate>
498 const Predicate& pred
506 template<class
T, class Predicate>
510 const Predicate& pred
520 template<class
T, class Predicate>
525 const Predicate& pred
534 const
string& argName,
535 const
string& usage = ""
542 const
string& usage = "",
543 bool advanced = false
551 const
string& param = "",
552 const
string& usage = "",
553 bool advanced = false
569 std::pair<const
char*,
int> compat
581 std::pair<const
char*,
int> compat,
594 static
void addNote(const
string& note);
617 bool advanced = false
624 bool advanced = false
651 bool setOption(const
word& optName, const
string& param = "");
689 bool checkOpts = true
701 inline const
string& operator[](const label index) const;
704 inline const
string& operator[](const
word& optName) const;
711 template<class
T=
string>
714 return this->get<T>(optName);
720 T opt(
const word& optName,
const T& deflt)
const
722 return this->getOrDefault<T>(optName, deflt);
728 T get(
const word& optName,
const T& deflt)
const
730 return this->getOrDefault<T>(optName, deflt);
738 return this->getOrDefault<T>(optName, deflt);
747 #ifdef Foam_argList_1712
754 T read(const label index)
const
756 return this->get<T>(index);
766 return this->get<T>(index);
774 return found(optName);
791 return get<T>(optName);
805 return readIfPresent<T>(optName, val);
821 return readIfPresent<T>(optName, val, deflt);
835 return getOrDefault<T>(optName, deflt);
844 return this->getList<T>(optName);
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Non-intrusive singly-linked list.
A HashTable with keys but without contents that is similar to std::unordered_set.
A HashTable similar to std::unordered_map.
An input stream of tokens.
Template class for non-intrusive linked lists.
Helper class for initializing parallel jobs from the command arguments, storing 'dry-run' state etc....
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Extract command arguments and options from the supplied argc and argv parameters.
void parse(bool checkArgs, bool checkOpts, bool initialise)
static word postProcessOptionName
Standard name for the post-processing option.
T get(const label index) const
Get a value from the argument at index.
static HashTable< string, label, Hash< label > > argUsage
Short description for program arguments.
int dryRun() const noexcept
Return the dry-run flag.
static void noBanner()
Disable emitting the banner information.
static std::string::size_type usageMin
Min indentation when displaying usage (default: 20)
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static HashTable< std::pair< word, int > > validOptionsCompat
A list of aliases for options.
static HashTable< string > validParOptions
A list of valid parallel options.
static void removeOption(const word &optName)
Remove option from validOptions and from optionUsage.
const ParRunControl & parRunControl() const
Same as runControl() - v2106 and earlier.
const stringList & args() const noexcept
Return arguments.
bool distributed() const noexcept
static std::string::size_type usageMax
Max screen width when displaying usage (default: 80)
bool unsetOption(const word &optName)
Unset option directly (use with caution)
static bool postProcess(int argc, char *argv[])
Return true if the post-processing option is specified.
bool optionFound(const word &optName) const
Deprecated(2018-01) return true if the named option is found.
const HashTable< string > & options() const noexcept
Return options.
T opt(const word &optName) const
Deprecated(2020-05) identical to get(const word& optName)
int verbose() const noexcept
Return the verbose flag.
const ParRunControl & runControl() const noexcept
Return the run control (parallel, dry-run etc)
const fileName & rootPath() const noexcept
Return root path.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
static bool bannerEnabled()
Banner status (enabled/disabled).
bool readCheck(const word &optName, T &val, const Predicate &pred, bool mandatory=true) const
Read the named option and check its validity.
static fileName envGlobalPath()
Global case (directory) from environment variable.
static void noLibs()
Add the '-no-libs' command line option.
static void noJobInfo()
Suppress JobInfo, overriding controlDict setting.
static void addVerboseOption(const string &usage, bool advanced=false)
Enable a 'verbose' bool option, with usage information.
bool optionReadIfPresent(const word &optName, T &val) const
Deprecated(2018-01) read a value from the named option if present.
void printUsage(bool full=true) const
Print usage.
static void setAdvanced(const word &optName, bool advanced=true)
Set an existing option as being 'advanced' or normal.
List< T > optionReadList(const word &optName) const
Deprecated(2018-01) read a List of values from the named option.
bool check(bool checkArgs=argList::argsMandatory(), bool checkOpts=true) const
virtual ~argList()
Destructor.
fileName relativePath(const fileName &input, const bool caseTag=false) const
bool readListIfPresent(const word &optName, List< T > &list) const
T optionLookupOrDefault(const word &optName, const T &deflt) const
Deprecated(2018-01) read a value from the named option if present.
static HashTable< string > optionUsage
Short description for validOptions.
static fileName envRelativePath(const fileName &input, const bool caseTag=false)
static bool argsMandatory()
Command arguments type (optional/mandatory).
label count(const UList< word > &optionNames) const
Return how many of the specified options were used.
static HashSet< string > advancedOptions
The "advanced" options are shown with -help-full (not with –help)
bool setOption(const word &optName, const string ¶m="")
Set option directly (use with caution)
static void addOptionCompat(const word &optName, std::pair< const char *, int > compat)
Specify an alias for the option name.
T lookupOrDefault(const word &optName, const T &deflt) const
Deprecated(2020-05) identical to getOrDefault(...)
static void addDryRunOption(const string &usage, bool advanced=false)
Enable a 'dry-run' bool option, with usage information.
label size() const noexcept
The number of arguments.
static void noCheckProcessorDirectories()
Remove checking of processor directories.
static SLList< string > notes
General usage notes.
bool checkRootCase() const
Check root path and case path.
void displayDoc(bool source=false) const
Display documentation in browser.
static void noMandatoryArgs()
Flag command arguments as being optional (non-mandatory)
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
ITstream optionLookup(const word &optName) const
Deprecated(2018-01) return an input stream from the named option.
T optionRead(const word &optName) const
Deprecated(2018-01) read a value from the named option.
void printCompat() const
Print option compatibility.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
const fileName & globalCaseName() const noexcept
Return global case name.
static void noParallel()
Remove the parallel options.
static void addUsage(const word &optName, const string &usage)
Add option usage information to optionUsage.
void printMan() const
Print usage as nroff-man format (Experimental)
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
void printNotes() const
Print notes (if any)
fileName path() const
Return the full path to the (processor local) case.
static HashTable< string > validOptions
A list of valid options.
T getCheck(const word &optName, const Predicate &pred) const
Get a value from the named option with additional checking.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
T argRead(const label index) const
Deprecated(2018-01) read a value from the argument at index.
List< T > getList(const label index) const
Get a List of values from the argument at index.
T get(const word &optName, const T &deflt) const
Deprecated(2020-05) identical to getOrDefault(...)
bool readCheckIfPresent(const word &optName, T &val, const Predicate &pred) const
Read the named option if present and check its validity.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
const word & executable() const noexcept
Name of executable without the path.
static word envExecutable()
Name of the executable from environment variable.
const string & commandLine() const noexcept
The command line options and arguments concatenated as a string.
T getCheckOrDefault(const word &optName, const T &deflt, const Predicate &pred) const
static HashTable< std::pair< bool, int > > ignoreOptionsCompat
A list of options to ignore.
static void addNote(const string ¬e)
Add extra notes for the usage information.
static void ignoreOptionCompat(std::pair< const char *, int > compat, bool expectArg)
Specify an option to be ignored.
dlLibraryTable & libs() const noexcept
Mutable access to the loaded dynamic libraries.
T read(const label index) const
Deprecated(2018-08) read a value from the argument at index.
const fileName & caseName() const noexcept
Return case name (parallel run) or global case (serial run)
T opt(const word &optName, const T &deflt) const
Deprecated(2020-05) identical to getOrDefault(...)
fileName globalPath() const
Return the full path to the global case.
A table of dynamically loaded libraries.
A class for handling file names.
Lookup type of boundary radiation properties.
A class for handling words, derived from Foam::string.
static Istream & input(Istream &is, IntRange< T > &range)
#define FOAM_DEPRECATED_FOR(since, replacement)