46 #define THROW_ProgArgException(X) throw ProgArgException(__FUNCTION__,(X)) 52 friend ICLUtils_API const std::string &pa_subarg_internal(
const ProgArgData &
pa);
53 friend ICLUtils_API bool pa_defined_internal(
const ProgArgData &
pa);
57 inline ProgArgData(
const std::string &
id,
int subargidx):
58 id(
id),subargidx((
int)subargidx){
60 inline ProgArgData(
unsigned int idx,
bool danglingOnly):
61 subargidx(idx),danglingOnly(danglingOnly){
69 ICLUtils_API void pa_explain_internal(
const std::string &
pa,
const std::string &ex);
72 ICLUtils_API const std::string &pa_subarg_internal(
const ProgArgData &
pa);
85 inline ProgArg(
const std::string &
id,
unsigned int subargidx):
86 ProgArgData(id,subargidx){
89 inline ProgArg(
unsigned int idx,
bool danglingOnly):
90 ProgArgData(idx,danglingOnly){
100 friend ICLUtils_API bool pa_defined_internal(
const ProgArgData &
pa);
114 inline operator T()
const{
115 return parse<T>(pa_subarg_internal(*
this));
120 return !pa_defined_internal(*
this);
126 return parse<T>(pa_subarg_internal(*
this));
133 return pa_subarg_internal(*
this);
137 inline const std::string &
getID()
const {
144 return s <<
pa.
as<std::string>();
150 inline ProgArg::operator bool()
const {
151 return pa_defined_internal(*
this);
157 return pa_defined_internal(*
this);
171 return a.
as<
bool>() && b.
as<
bool>();
181 return b && a.
as<
bool>();
191 return b && a.
as<
bool>();
203 return a.
as<
bool>() || b.
as<
bool>();
212 return b || a.
as<
bool>();
222 return b || a.
as<
bool>();
304 inline const ProgArg pa(
const std::string &
id,
unsigned int subargidx = 0){
311 inline const ProgArg pa(
unsigned int idx,
bool danglingOnly =
true){
312 return ProgArg(idx,danglingOnly);
318 inline const T
pa_def(
const std::string &
id,
unsigned int subargidx,
const T &def){
320 return p ? parse<T>(p) : def;
325 inline const T
pa_def(
const std::string &
id,
const T &def){
351 PAEX operator()(
const std::string &
pa,
const std::string &ex);
366 pa_explain_internal(
pa,ex);
372 inline PAEX PAEX::operator()(
const std::string &
pa,
const std::string &ex){
466 ICLUtils_API void pa_init(
int n,
char **ppc,
const std::string &init,
bool allowDanglingArgs =
false);
bool operator||(const ProgArg &a, const ProgArg &b)
this allows to check if either of two progargs are defined
Definition: ProgArg.h:202
undocument this line if you encounter any issues!
Definition: Any.h:37
ICLUtils_API void pa_show_usage(const std::string &msg="")
shows current available programm arguments
ICLUtils_API Any operator[](int subArgIdx) const
returns the given sub-argument in shape of an utils::Any
ICLUtils_API void pa_show()
shows all given program arguments
bool operator!() const
negation operator
Definition: ProgArg.h:119
ICLUtils_API std::string pa_get_license()
returns the current license text
#define ICLUtils_API
this macros are important for creating dll's
Definition: CompatMacros.h:171
#define THROW_ProgArgException(X)
Definition: ProgArg.h:46
ProgArg(const std::string &id, unsigned int subargidx)
private constructor
Definition: ProgArg.h:85
ProgArgException(const std::string &func, const std::string &what)
Definition: ProgArg.h:43
ICLUtils_API std::string pa_get_help_text()
returns the current help text (which is empty, if it was not set)
ICLUtils_API void pa_set_license(const std::string &newLicenseText)
Sets a license text, that is used when applications are run with –version or -v.
ICLUtils_API void pa_set_help_text(const std::string &newHelpText)
Sets a applications help text that is used when applications are run with –help or with unknown argum...
ICLUtils_API unsigned int pa_get_count(bool danglingOnly=true)
returns number of actually given args given
const ProgArg pa(const std::string &id, unsigned int subargidx=0)
returns given program argument
Definition: ProgArg.h:304
ICLUtils_API std::ostream & operator<<(std::ostream &s, const ConfigFile &cf)
Default ostream operator to put a ConfigFile into a stream.
Programm argument utility class.
Definition: ProgArg.h:80
const T pa_def(const std::string &id, unsigned int subargidx, const T &def)
utility function that allows to use a default value, if given argument was not defined
Definition: ProgArg.h:318
const std::string & getID() const
returns the prog-arg id
Definition: ProgArg.h:137
ICLUtils_API const std::string & pa_get_progname(bool fullpath=false)
returns application name (full command line)
PAEX pa_explain(const std::string &pa, const std::string &ex)
This function can be used to provide additional information for certain program arguments.
Definition: ProgArg.h:365
ProgArg(unsigned int idx, bool danglingOnly)
Definition: ProgArg.h:89
Base class for Exception handling in the ICL.
Definition: Exception.h:42
bool operator &&(const ProgArg &a, const ProgArg &b)
this allows to check if two progargs are defined
Definition: ProgArg.h:170
ICLUtils_API int n() const
returns the count of actually given sub arguments
Simple generic data type implementation that uses a string based data representation.
Definition: Any.h:109
std::string operator *() const
important convenience operator for using a ProgArg instance as string
Definition: ProgArg.h:132
ICLUtils_API void pa_init(int n, char **ppc, const std::string &init, bool allowDanglingArgs=false)
initialization function for ICL's program argument evaluation framework
T as() const
this template function can be used to explicitly cast a program argument into a given type
Definition: ProgArg.h:125
Programm argument environment exception type .
Definition: ProgArg.h:42