![]() |
PhoenixInkscape
2.0.0
Generate multiple png files with svg inkscape files
|
Describes an option passed to a program. More...
#include <Option.h>
Public Member Functions | |
bool | checkArgument () const |
Check the argument of the parser. More... | |
PString & | getDocString () |
Get the documentation string of the Option. More... | |
const PString & | getDocString () const |
Get the documentation string of the Option. More... | |
PString & | getLongName () |
Get the long name of the Option. More... | |
const PString & | getLongName () const |
Get the long name of the Option. More... | |
void | getPossibleOption (PString &possibleOption, const PString &cursorOption) const |
Get the possible options for the bash completion. More... | |
void | getPossibleValue (PString &possibleValue, const PString &cursorOption) const |
Complete the possible values of the Option. More... | |
PString & | getShortName () |
Get the short name of the Option. More... | |
const PString & | getShortName () const |
Get the short name of the Option. More... | |
OptionValue & | getValue () |
Get the value of the Option. More... | |
const OptionValue & | getValue () const |
Get the value of the Option. More... | |
bool & | isAllowEmpty () |
Get if the option value can be empty. More... | |
bool | isAllowEmpty () const |
Get if the option value can be empty. More... | |
bool & | isParsed () |
Say if the Option has been parsed or not. More... | |
bool | isParsed () const |
Say if the Option has been parsed or not. More... | |
bool & | isRequired () |
Get if the option is required. More... | |
bool | isRequired () const |
Get if the option is required. More... | |
Option & | operator= (const Option &other) |
Definition of equal operator of Option. More... | |
Option () | |
Default constructor of Option. More... | |
Option (const Option &other) | |
Copy constructor of Option. More... | |
Option (const PString &longName, const PString &shortName, bool isRequired, const PString &docString) | |
Constructor of Option. More... | |
Option (const PString &longName, const PString &shortName, const OptionValue &value, bool isRequired, const PString &docString) | |
Constructor of Option. More... | |
Option (const PString &longName, const PString &shortName, const OptionValue &value, const PString &docString) | |
Constructor of Option. More... | |
Option (const PString &longName, const PString &shortName, const PString &docString) | |
Default constructor of Option. More... | |
bool | parseOption (ArgParser &parser) |
Parse the current option with the given parser. More... | |
void | print (const PString &indentation="") const |
Print an option. More... | |
void | setDocString (const PString &docString) |
Set the documentation string of the Option. More... | |
void | setIsAllowEmpty (bool isAllowEmpty) |
Say if the option can be empty or not. More... | |
void | setIsParsed (bool isParsed) |
Say if the Option has been parsed or not. More... | |
void | setIsRequired (bool isRequired) |
Set if the option is required. More... | |
void | setLongName (const PString &longName) |
Set the long name of the option. More... | |
void | setShortName (const PString &shortName) |
Set the short name of the option. More... | |
void | setValue (const OptionValue &value) |
Set the value of the option. More... | |
virtual | ~Option () |
Destructeur of Option. More... | |
Protected Member Functions | |
void | copyOption (const Option &other) |
Copy function of Option. More... | |
Private Member Functions | |
void | checkAlreadyParsed (const PString &longOption) |
Check if the Option has been already parsed. More... | |
void | initialisationOption () |
Initialisation function of the class Option. More... | |
bool | parsePartOption (ArgParser &parser, const PString &prefix, const PString &optionName) |
Parse the given option with the parser. More... | |
Private Attributes | |
PString | p_docString |
Documentation string of the current Option. More... | |
PString | p_firstPartParsedOption |
First paet of parsed option (needed for bash completion) More... | |
bool | p_isAllowEmpty |
The option can be empty and can have a value. More... | |
bool | p_isParsed |
Say if the option has been parsed or not. More... | |
bool | p_isRequired |
True if the option is required, false if it is optionnal. More... | |
PString | p_longName |
Long name of the Option. More... | |
PString | p_shortName |
Short name of the Option. More... | |
OptionValue | p_value |
Value of the Option. More... | |
Option::Option | ( | ) |
Default constructor of Option.
Definition at line 11 of file Option.cpp.
References initialisationOption().
Default constructor of Option.
longName | : long name of the option |
shortName | : long name of the option |
docString | : documentation string of the Option |
Definition at line 22 of file Option.cpp.
References initialisationOption().
Option::Option | ( | const PString & | longName, |
const PString & | shortName, | ||
const OptionValue & | value, | ||
const PString & | docString | ||
) |
Constructor of Option.
longName | : long name of the option |
shortName | : long name of the option |
value | : value of the Option |
docString | : documentation string of the Option |
Definition at line 34 of file Option.cpp.
References initialisationOption().
Option::Option | ( | const PString & | longName, |
const PString & | shortName, | ||
const OptionValue & | value, | ||
bool | isRequired, | ||
const PString & | docString | ||
) |
Constructor of Option.
longName | : long name of the option |
shortName | : long name of the option |
value | : value of the Option |
isRequired | : true if the option is required, false if it is optionnal |
docString | : documentation string of the Option |
Definition at line 47 of file Option.cpp.
References initialisationOption().
Option::Option | ( | const PString & | longName, |
const PString & | shortName, | ||
bool | isRequired, | ||
const PString & | docString | ||
) |
Constructor of Option.
longName | : long name of the option |
shortName | : long name of the option |
isRequired | : true if the option is required, false if it is optionnal |
docString | : documentation string of the Option |
Definition at line 59 of file Option.cpp.
References initialisationOption().
Option::Option | ( | const Option & | other | ) |
Copy constructor of Option.
other | : class to copy |
Definition at line 68 of file Option.cpp.
References copyOption().
|
virtual |
|
private |
Check if the Option has been already parsed.
longOption | : used option |
Definition at line 414 of file Option.cpp.
References p_isParsed.
Referenced by parsePartOption().
bool Option::checkArgument | ( | ) | const |
Check the argument of the parser.
Definition at line 259 of file Option.cpp.
References convertOptionTypeToString(), OptionValue::getType(), OptionType::NONE, p_isParsed, p_isRequired, p_longName, p_shortName, p_value, termDefault(), and termRed().
|
protected |
Copy function of Option.
other | : class to copy |
Definition at line 322 of file Option.cpp.
References p_docString, p_firstPartParsedOption, p_isAllowEmpty, p_isParsed, p_isRequired, p_longName, p_shortName, and p_value.
Referenced by operator=(), and Option().
PString & Option::getDocString | ( | ) |
Get the documentation string of the Option.
Definition at line 244 of file Option.cpp.
References p_docString.
const PString & Option::getDocString | ( | ) | const |
Get the documentation string of the Option.
Definition at line 239 of file Option.cpp.
References p_docString.
Referenced by printValueOfOpt(), and printValueOfOptConst().
PString & Option::getLongName | ( | ) |
Get the long name of the Option.
Definition at line 194 of file Option.cpp.
References p_longName.
const PString & Option::getLongName | ( | ) | const |
Get the long name of the Option.
Definition at line 189 of file Option.cpp.
References p_longName.
Referenced by printValueOfOpt(), and printValueOfOptConst().
Get the possible options for the bash completion.
[out] | possibleOption | : possible options for the bash completion |
cursorOption | : option of the cursor which is currently completed |
Definition at line 287 of file Option.cpp.
References PString::isSameBegining(), p_isParsed, p_longName, and p_shortName.
Complete the possible values of the Option.
[out] | possibleValue | : possible value of the option |
cursorOption | : option of the cursor which is currently completed |
Definition at line 315 of file Option.cpp.
References OptionValue::bashCompletionValue(), and p_value.
Referenced by OptionParser::completeOptionValue().
PString & Option::getShortName | ( | ) |
Get the short name of the Option.
Definition at line 204 of file Option.cpp.
References p_shortName.
const PString & Option::getShortName | ( | ) | const |
Get the short name of the Option.
Definition at line 199 of file Option.cpp.
References p_shortName.
Referenced by printValueOfOpt(), and printValueOfOptConst().
OptionValue & Option::getValue | ( | ) |
const OptionValue & Option::getValue | ( | ) | const |
Get the value of the Option.
Definition at line 209 of file Option.cpp.
References p_value.
Referenced by OptionMode::getValue(), printValueOfOpt(), and printValueOfOptConst().
|
private |
Initialisation function of the class Option.
Definition at line 334 of file Option.cpp.
References p_firstPartParsedOption, p_isAllowEmpty, and p_isParsed.
Referenced by Option().
bool & Option::isAllowEmpty | ( | ) |
Get if the option value can be empty.
Definition at line 234 of file Option.cpp.
References p_isAllowEmpty.
bool Option::isAllowEmpty | ( | ) | const |
Get if the option value can be empty.
Definition at line 229 of file Option.cpp.
References p_isAllowEmpty.
Referenced by printValueOfOpt(), printValueOfOptConst(), and setIsAllowEmpty().
bool & Option::isParsed | ( | ) |
Say if the Option has been parsed or not.
Definition at line 254 of file Option.cpp.
References p_isParsed.
bool Option::isParsed | ( | ) | const |
Say if the Option has been parsed or not.
Definition at line 249 of file Option.cpp.
References p_isParsed.
Referenced by OptionMode::getValue(), and setIsParsed().
bool & Option::isRequired | ( | ) |
Get if the option is required.
Definition at line 224 of file Option.cpp.
References p_isRequired.
bool Option::isRequired | ( | ) | const |
Get if the option is required.
Definition at line 219 of file Option.cpp.
References p_isRequired.
Referenced by OptionMode::getValue(), printValueOfOpt(), printValueOfOptConst(), and setIsRequired().
Definition of equal operator of Option.
other | : class to copy |
Definition at line 81 of file Option.cpp.
References copyOption().
bool Option::parseOption | ( | ArgParser & | parser | ) |
Parse the current option with the given parser.
[out] | parser | : parser of the given arguments to the program |
Definition at line 90 of file Option.cpp.
References p_longName, p_shortName, and parsePartOption().
|
private |
Parse the given option with the parser.
[out] | parser | : parser to be used |
prefix | : option prefix (- or – or nothing) | |
optionName | : name of hte option to be parsed |
Definition at line 346 of file Option.cpp.
References OptionValue::addValue(), checkAlreadyParsed(), ArgParser::getCurrentOption(), ArgParser::getNextOption(), OptionValue::getType(), ArgParser::isEndOfOption(), PString::isSameBegining(), OptionType::NONE, p_firstPartParsedOption, p_isAllowEmpty, p_isParsed, p_value, and OptionType::STRING.
Referenced by parseOption().
void Option::print | ( | const PString & | indentation = "" | ) | const |
Print an option.
indentation | : indentation to print the option |
Definition at line 113 of file Option.cpp.
References convertOptionTypeToString(), OptionValue::getDefaultValue(), OptionValue::getPossibleValue(), OptionValue::getType(), OptionType::NONE, p_docString, p_isAllowEmpty, p_isRequired, p_longName, p_shortName, p_value, and printVecString().
void Option::setDocString | ( | const PString & | docString | ) |
Set the documentation string of the Option.
docString | : documentation string of the Option |
Definition at line 174 of file Option.cpp.
References p_docString.
Referenced by testOption().
void Option::setIsAllowEmpty | ( | bool | isAllowEmpty | ) |
Say if the option can be empty or not.
isAllowEmpty | : true if the option can be empty, false otherwise |
Definition at line 184 of file Option.cpp.
References isAllowEmpty(), and p_isAllowEmpty.
Referenced by OptionParser::addOption(), and testOption().
void Option::setIsParsed | ( | bool | isParsed | ) |
Say if the Option has been parsed or not.
isParsed | : true if the Option has been parsed, false if not |
Definition at line 179 of file Option.cpp.
References isParsed(), and p_isParsed.
Referenced by testOption().
void Option::setIsRequired | ( | bool | isRequired | ) |
Set if the option is required.
isRequired | : true if the Option is required, false if it is optionnal |
Definition at line 169 of file Option.cpp.
References isRequired(), and p_isRequired.
Referenced by testOption().
void Option::setLongName | ( | const PString & | longName | ) |
Set the long name of the option.
longName | : long name of the option |
Definition at line 154 of file Option.cpp.
References p_longName.
Referenced by testOption().
void Option::setShortName | ( | const PString & | shortName | ) |
Set the short name of the option.
shortName | : short name of the option |
Definition at line 159 of file Option.cpp.
References p_shortName.
Referenced by testOption().
void Option::setValue | ( | const OptionValue & | value | ) |
Set the value of the option.
value | : value name of the option |
Definition at line 164 of file Option.cpp.
References p_value.
Referenced by testOption().
|
private |
Documentation string of the current Option.
Definition at line 80 of file Option.h.
Referenced by copyOption(), getDocString(), print(), and setDocString().
|
private |
First paet of parsed option (needed for bash completion)
Definition at line 84 of file Option.h.
Referenced by copyOption(), initialisationOption(), and parsePartOption().
|
private |
The option can be empty and can have a value.
Definition at line 86 of file Option.h.
Referenced by copyOption(), initialisationOption(), isAllowEmpty(), parsePartOption(), print(), and setIsAllowEmpty().
|
private |
Say if the option has been parsed or not.
Definition at line 82 of file Option.h.
Referenced by checkAlreadyParsed(), checkArgument(), copyOption(), getPossibleOption(), initialisationOption(), isParsed(), parsePartOption(), and setIsParsed().
|
private |
True if the option is required, false if it is optionnal.
Definition at line 78 of file Option.h.
Referenced by checkArgument(), copyOption(), isRequired(), print(), and setIsRequired().
|
private |
Long name of the Option.
Definition at line 72 of file Option.h.
Referenced by checkArgument(), copyOption(), getLongName(), getPossibleOption(), parseOption(), print(), and setLongName().
|
private |
Short name of the Option.
Definition at line 74 of file Option.h.
Referenced by checkArgument(), copyOption(), getPossibleOption(), getShortName(), parseOption(), print(), and setShortName().
|
private |
Value of the Option.
Definition at line 76 of file Option.h.
Referenced by checkArgument(), copyOption(), getPossibleValue(), getValue(), parsePartOption(), print(), and setValue().