PhoenixInkscape  2.0.0
Generate multiple png files with svg inkscape files
Option Class Reference

Describes an option passed to a program. More...

#include <Option.h>

+ Collaboration diagram for Option:

Public Member Functions

bool checkArgument () const
 Check the argument of the parser. More...
 
PStringgetDocString ()
 Get the documentation string of the Option. More...
 
const PStringgetDocString () const
 Get the documentation string of the Option. More...
 
PStringgetLongName ()
 Get the long name of the Option. More...
 
const PStringgetLongName () 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...
 
PStringgetShortName ()
 Get the short name of the Option. More...
 
const PStringgetShortName () const
 Get the short name of the Option. More...
 
OptionValuegetValue ()
 Get the value of the Option. More...
 
const OptionValuegetValue () 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...
 
Optionoperator= (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...
 

Detailed Description

Describes an option passed to a program.

Definition at line 14 of file Option.h.

Constructor & Destructor Documentation

◆ Option() [1/6]

Option::Option ( )

Default constructor of Option.

Definition at line 11 of file Option.cpp.

12  :p_longName(""), p_shortName(""), p_value(""), p_isRequired(false), p_docString("")
13 {
15 }
void initialisationOption()
Initialisation function of the class Option.
Definition: Option.cpp:334
PString p_shortName
Short name of the Option.
Definition: Option.h:74
bool p_isRequired
True if the option is required, false if it is optionnal.
Definition: Option.h:78
OptionValue p_value
Value of the Option.
Definition: Option.h:76
PString p_longName
Long name of the Option.
Definition: Option.h:72
PString p_docString
Documentation string of the current Option.
Definition: Option.h:80

References initialisationOption().

+ Here is the call graph for this function:

◆ Option() [2/6]

Option::Option ( const PString longName,
const PString shortName,
const PString docString 
)

Default constructor of Option.

Parameters
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.

23  :p_longName(longName), p_shortName(shortName), p_value(""), p_isRequired(false), p_docString(docString)
24 {
26 }

References initialisationOption().

+ Here is the call graph for this function:

◆ Option() [3/6]

Option::Option ( const PString longName,
const PString shortName,
const OptionValue value,
const PString docString 
)

Constructor of Option.

Parameters
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.

35  :p_longName(longName), p_shortName(shortName), p_value(value), p_isRequired(false), p_docString(docString)
36 {
38 }

References initialisationOption().

+ Here is the call graph for this function:

◆ Option() [4/6]

Option::Option ( const PString longName,
const PString shortName,
const OptionValue value,
bool  isRequired,
const PString docString 
)

Constructor of Option.

Parameters
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.

48  :p_longName(longName), p_shortName(shortName), p_value(value), p_isRequired(isRequired), p_docString(docString)
49 {
51 }
bool isRequired() const
Get if the option is required.
Definition: Option.cpp:219

References initialisationOption().

+ Here is the call graph for this function:

◆ Option() [5/6]

Option::Option ( const PString longName,
const PString shortName,
bool  isRequired,
const PString docString 
)

Constructor of Option.

Parameters
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.

60  :p_longName(longName), p_shortName(shortName), p_isRequired(isRequired), p_docString(docString)
61 {
63 }

References initialisationOption().

+ Here is the call graph for this function:

◆ Option() [6/6]

Option::Option ( const Option other)

Copy constructor of Option.

Parameters
other: class to copy

Definition at line 68 of file Option.cpp.

68  {
69  copyOption(other);
70 }
void copyOption(const Option &other)
Copy function of Option.
Definition: Option.cpp:322

References copyOption().

+ Here is the call graph for this function:

◆ ~Option()

Option::~Option ( )
virtual

Destructeur of Option.

Definition at line 73 of file Option.cpp.

73  {
74 
75 }

Member Function Documentation

◆ checkAlreadyParsed()

void Option::checkAlreadyParsed ( const PString longOption)
private

Check if the Option has been already parsed.

Parameters
longOption: used option

Definition at line 414 of file Option.cpp.

414  {
415  if(p_isParsed){ //The option has already been parsed, there is a mistake
416  throw std::runtime_error("Option::checkAlreadyParsed : option '" + longOption + "' already exists");
417  }
418 }
bool p_isParsed
Say if the option has been parsed or not.
Definition: Option.h:82

References p_isParsed.

Referenced by parsePartOption().

+ Here is the caller graph for this function:

◆ checkArgument()

bool Option::checkArgument ( ) const

Check the argument of the parser.

Returns
true if the arguments is required and is set, false otherwise

Definition at line 259 of file Option.cpp.

259  {
260  if(p_isRequired){
261  if(!p_isParsed){
263  std::cerr << termRed() << "Missing arguement ";
264  if(p_longName != ""){
265  std::cerr << "--" << p_longName;
266  if(type != OptionType::NONE){
267  std::cout << "=" << convertOptionTypeToString(type);
268  }
269  }
270  if(p_shortName != ""){
271  if(p_longName != ""){std::cerr << " , ";}
272  std::cerr << "-" << p_shortName;
273  if(type != OptionType::NONE){
274  std::cout << " " << convertOptionTypeToString(type);
275  }
276  }
277  std::cerr << termDefault() << std::endl;
278  }
279  return p_isParsed;
280  }else{return true;}
281 }
PString convertOptionTypeToString(OptionType::OptionType type)
Convert the OptionType into PString.
Definition: OptionType.cpp:69
OptionType::OptionType getType() const
Get the type of the OptionValue.
std::string termDefault()
affiche le terminal par défaut
std::string termRed()
affiche le terminal rouge

References convertOptionTypeToString(), OptionValue::getType(), OptionType::NONE, p_isParsed, p_isRequired, p_longName, p_shortName, p_value, termDefault(), and termRed().

+ Here is the call graph for this function:

◆ copyOption()

void Option::copyOption ( const Option other)
protected

Copy function of Option.

Parameters
other: class to copy

Definition at line 322 of file Option.cpp.

322  {
323  p_longName = other.p_longName;
324  p_shortName = other.p_shortName;
325  p_value = other.p_value;
326  p_isRequired = other.p_isRequired;
327  p_docString = other.p_docString;
328  p_isParsed = other.p_isParsed;
331 }
bool p_isAllowEmpty
The option can be empty and can have a value.
Definition: Option.h:86
PString p_firstPartParsedOption
First paet of parsed option (needed for bash completion)
Definition: Option.h:84

References p_docString, p_firstPartParsedOption, p_isAllowEmpty, p_isParsed, p_isRequired, p_longName, p_shortName, and p_value.

Referenced by operator=(), and Option().

+ Here is the caller graph for this function:

◆ getDocString() [1/2]

PString & Option::getDocString ( )

Get the documentation string of the Option.

Returns
documentation string of the Option

Definition at line 244 of file Option.cpp.

244 {return p_docString;}

References p_docString.

◆ getDocString() [2/2]

const PString & Option::getDocString ( ) const

Get the documentation string of the Option.

Returns
documentation string of the Option

Definition at line 239 of file Option.cpp.

239 {return p_docString;}

References p_docString.

Referenced by printValueOfOpt(), and printValueOfOptConst().

+ Here is the caller graph for this function:

◆ getLongName() [1/2]

PString & Option::getLongName ( )

Get the long name of the Option.

Returns
long name of the Option

Definition at line 194 of file Option.cpp.

194 {return p_longName;}

References p_longName.

◆ getLongName() [2/2]

const PString & Option::getLongName ( ) const

Get the long name of the Option.

Returns
long name of the Option

Definition at line 189 of file Option.cpp.

189 {return p_longName;}

References p_longName.

Referenced by printValueOfOpt(), and printValueOfOptConst().

+ Here is the caller graph for this function:

◆ getPossibleOption()

void Option::getPossibleOption ( PString possibleOption,
const PString cursorOption 
) const

Get the possible options for the bash completion.

Parameters
[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.

287  {
288  if(p_isParsed){return;}
289  if(p_longName != ""){
290  PString longOption("--" + p_longName);
291  if(cursorOption == ""){
292  possibleOption += longOption + " ";
293  }else{
294  if(longOption.isSameBegining(cursorOption)){
295  possibleOption += longOption + " ";
296  }
297  }
298  }
299  if(p_shortName != ""){
300  PString shortOption("-" + p_shortName);
301  if(cursorOption == ""){
302  possibleOption += shortOption + " ";
303  }else{
304  if(shortOption.isSameBegining(cursorOption)){
305  possibleOption += shortOption + " ";
306  }
307  }
308  }
309 }
Extends the std::string.
Definition: PString.h:16

References PString::isSameBegining(), p_isParsed, p_longName, and p_shortName.

+ Here is the call graph for this function:

◆ getPossibleValue()

void Option::getPossibleValue ( PString possibleValue,
const PString cursorOption 
) const

Complete the possible values of the Option.

Parameters
[out]possibleValue: possible value of the option
cursorOption: option of the cursor which is currently completed

Definition at line 315 of file Option.cpp.

315  {
316  p_value.bashCompletionValue(possibleValue, cursorOption);
317 }
void bashCompletionValue(PString &strBashCompletion, const PString &cursorOption) const
Print the possible value to the bash completion.

References OptionValue::bashCompletionValue(), and p_value.

Referenced by OptionParser::completeOptionValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getShortName() [1/2]

PString & Option::getShortName ( )

Get the short name of the Option.

Returns
short name of the Option

Definition at line 204 of file Option.cpp.

204 {return p_shortName;}

References p_shortName.

◆ getShortName() [2/2]

const PString & Option::getShortName ( ) const

Get the short name of the Option.

Returns
short name of the Option

Definition at line 199 of file Option.cpp.

199 {return p_shortName;}

References p_shortName.

Referenced by printValueOfOpt(), and printValueOfOptConst().

+ Here is the caller graph for this function:

◆ getValue() [1/2]

OptionValue & Option::getValue ( )

Get the value of the Option.

Returns
value of the Option

Definition at line 214 of file Option.cpp.

214 {return p_value;}

References p_value.

◆ getValue() [2/2]

const OptionValue & Option::getValue ( ) const

Get the value of the Option.

Returns
value of the Option

Definition at line 209 of file Option.cpp.

209 {return p_value;}

References p_value.

Referenced by OptionMode::getValue(), printValueOfOpt(), and printValueOfOptConst().

+ Here is the caller graph for this function:

◆ initialisationOption()

void Option::initialisationOption ( )
private

Initialisation function of the class Option.

Definition at line 334 of file Option.cpp.

334  {
335  p_isParsed = false;
337  p_isAllowEmpty = false;
338 }

References p_firstPartParsedOption, p_isAllowEmpty, and p_isParsed.

Referenced by Option().

+ Here is the caller graph for this function:

◆ isAllowEmpty() [1/2]

bool & Option::isAllowEmpty ( )

Get if the option value can be empty.

Returns
true if the option value can be empty, false otherwise

Definition at line 234 of file Option.cpp.

234 {return p_isAllowEmpty;}

References p_isAllowEmpty.

◆ isAllowEmpty() [2/2]

bool Option::isAllowEmpty ( ) const

Get if the option value can be empty.

Returns
true if the option value can be empty, false otherwise

Definition at line 229 of file Option.cpp.

229 {return p_isAllowEmpty;}

References p_isAllowEmpty.

Referenced by printValueOfOpt(), printValueOfOptConst(), and setIsAllowEmpty().

+ Here is the caller graph for this function:

◆ isParsed() [1/2]

bool & Option::isParsed ( )

Say if the Option has been parsed or not.

Returns
true if the Option has been parsed, false if not

Definition at line 254 of file Option.cpp.

254 {return p_isParsed;}

References p_isParsed.

◆ isParsed() [2/2]

bool Option::isParsed ( ) const

Say if the Option has been parsed or not.

Returns
true if the Option has been parsed, false if not

Definition at line 249 of file Option.cpp.

249 {return p_isParsed;}

References p_isParsed.

Referenced by OptionMode::getValue(), and setIsParsed().

+ Here is the caller graph for this function:

◆ isRequired() [1/2]

bool & Option::isRequired ( )

Get if the option is required.

Returns
true if the Option is required, false if it is optionnal

Definition at line 224 of file Option.cpp.

224 {return p_isRequired;}

References p_isRequired.

◆ isRequired() [2/2]

bool Option::isRequired ( ) const

Get if the option is required.

Returns
true if the Option is required, false if it is optionnal

Definition at line 219 of file Option.cpp.

219 {return p_isRequired;}

References p_isRequired.

Referenced by OptionMode::getValue(), printValueOfOpt(), printValueOfOptConst(), and setIsRequired().

+ Here is the caller graph for this function:

◆ operator=()

Option & Option::operator= ( const Option other)

Definition of equal operator of Option.

Parameters
other: class to copy
Returns
copied class

Definition at line 81 of file Option.cpp.

81  {
82  copyOption(other);
83  return *this;
84 }

References copyOption().

+ Here is the call graph for this function:

◆ parseOption()

bool Option::parseOption ( ArgParser parser)

Parse the current option with the given parser.

Parameters
[out]parser: parser of the given arguments to the program
Returns
true on success, false otherwise

Definition at line 90 of file Option.cpp.

90  {
91  if(parsePartOption(parser, "--", p_longName)){return true;}
92  else if(parsePartOption(parser, "-", p_shortName)){return true;}
93  return false;
94 }
bool parsePartOption(ArgParser &parser, const PString &prefix, const PString &optionName)
Parse the given option with the parser.
Definition: Option.cpp:346

References p_longName, p_shortName, and parsePartOption().

+ Here is the call graph for this function:

◆ parsePartOption()

bool Option::parsePartOption ( ArgParser parser,
const PString prefix,
const PString optionName 
)
private

Parse the given option with the parser.

Parameters
[out]parser: parser to be used
prefix: option prefix (- or – or nothing)
optionName: name of hte option to be parsed
Returns
true on success, false otherwise

Definition at line 346 of file Option.cpp.

346  {
347  if(parser.isEndOfOption()){return true;}
348  if(optionName == ""){return false;}
349  PString & currentOption = parser.getCurrentOption();
350  PString longOption(prefix + optionName);
351  size_t sizeLongOption(longOption.size());
352  OptionType::OptionType optionType = p_value.getType();
353  if(currentOption == longOption){
354  checkAlreadyParsed(longOption);
355  p_isParsed = true;
356  if(optionType == OptionType::NONE){ //No value expected
357  parser.getNextOption();
358  return true; //Option found
359  }
360  bool valueOk(true), isInitialised(false);
361  parser.getNextOption();
362  while(!parser.isEndOfOption() && valueOk){
363  PString & currentOption = parser.getCurrentOption();
364  if(currentOption == ""){
365  if(optionType == OptionType::STRING){
366  p_value.addValue("");
367  parser.getNextOption();
368  valueOk = true;
369  isInitialised = true;
370  }else{
371  throw std::runtime_error("Option::parsePartOption : pass empty value to option '" + longOption + "' which does not expect STRING");
372  }
373  }else{
374  if(currentOption[0] == '-'){
375  valueOk = false;
376  }else{
377  p_value.addValue(currentOption);
378  parser.getNextOption();
379  valueOk = true;
380  isInitialised = true;
381  }
382  }
383  }
384  if(!isInitialised && !p_isAllowEmpty){
385  throw std::runtime_error("Option::parsePartOption : expect value after option '" + longOption + "'");
386  }
387  return isInitialised || p_isAllowEmpty;
388  }else if(currentOption.isSameBegining(longOption)){
389  if(currentOption[sizeLongOption] == '='){
390  if(optionType == OptionType::NONE){ //No value expected
391  throw std::runtime_error("Option::parsePartOption : the option '"+currentOption+"' does not have value");
392  }
393  if(currentOption.size() == sizeLongOption + 1lu){
394  p_firstPartParsedOption = longOption + "=";
395  throw std::runtime_error("Option::parsePartOption : problem with the option '"+currentOption+"' because it ends with a '=' and not a value");
396  //Ici il faut un mode qui renvoie quand même les valeurs possibles quand on a --option=...
397  }
398  checkAlreadyParsed(longOption);
399  PString value(currentOption.substr(sizeLongOption + 1lu));
400  p_value.addValue(value);
401  p_isParsed = true;
402  parser.getNextOption();
403  return true;
404  }else{
405  return false; //It is an option with a longer name
406  }
407  }
408  return false;
409 }
const PString & getCurrentOption() const
Get the current option.
Definition: ArgParser.cpp:91
void getNextOption()
Move to the next option.
Definition: ArgParser.cpp:77
bool isEndOfOption() const
Say if is it the end of the options.
Definition: ArgParser.cpp:84
void addValue(const PString &value)
Add value of the OptionValue.
void checkAlreadyParsed(const PString &longOption)
Check if the Option has been already parsed.
Definition: Option.cpp:414
bool isSameBegining(const PString &beginStr) const
Say if the current PString has the same begining of beginStr.
Definition: PString.cpp:306

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print()

void Option::print ( const PString indentation = "") const

Print an option.

Parameters
indentation: indentation to print the option

Definition at line 113 of file Option.cpp.

113  {
115  std::cout << indentation;
116  if(p_shortName != ""){
117  std::cout << "-" << p_shortName;
118  if(type != OptionType::NONE){
119  std::cout << " " << convertOptionTypeToString(type);
120  }
121  }
122  if(p_longName != ""){
123  if(p_shortName != ""){std::cout << " , ";}
124  std::cout << "--" << p_longName;
125  if(type != OptionType::NONE){
126  std::cout << "=" << convertOptionTypeToString(type);
127  }
128  }
129  if(p_docString != ""){
130  std::cout << " : " << p_docString;
131  }
132  std::cout << std::endl;
133  const PVecString & vecDefaultValue = p_value.getDefaultValue();
134  if(vecDefaultValue.size()){
135  std::cout << indentation << "\tDefault value : '";
136  printVecString(vecDefaultValue);
137  std::cout << "'" << std::endl;
138  }
139  const PVecString & vecPossibleValue = p_value.getPossibleValue();
140  if(vecPossibleValue.size()){
141  std::cout << indentation << "\tPossible values : ";
142  printVecString(vecPossibleValue);
143  std::cout << std::endl;
144  }
145  if(p_isRequired){std::cout << indentation << "\tThis argument has to be set" << std::endl;}
146  else{std::cout << indentation << "\tThis argument is optional" << std::endl;}
147  if(p_isAllowEmpty){std::cout << indentation << "\tThis argument can have an empty value" << std::endl;}
148  else{std::cout << indentation << "\tThis argument cannot have an empty value" << std::endl;}
149 }
void printVecString(const PVecString &vecValue)
Print a vector of value.
Definition: Option.cpp:99
std::vector< PString > PVecString
Definition: PString.h:96
const PVecString & getDefaultValue() const
Get the default value of the OptionValue.
const PVecString & getPossibleValue() const
Get the possible values of the OptionValue.

References convertOptionTypeToString(), OptionValue::getDefaultValue(), OptionValue::getPossibleValue(), OptionValue::getType(), OptionType::NONE, p_docString, p_isAllowEmpty, p_isRequired, p_longName, p_shortName, p_value, and printVecString().

+ Here is the call graph for this function:

◆ setDocString()

void Option::setDocString ( const PString docString)

Set the documentation string of the Option.

Parameters
docString: documentation string of the Option

Definition at line 174 of file Option.cpp.

174 {p_docString = docString;}

References p_docString.

Referenced by testOption().

+ Here is the caller graph for this function:

◆ setIsAllowEmpty()

void Option::setIsAllowEmpty ( bool  isAllowEmpty)

Say if the option can be empty or not.

Parameters
isAllowEmpty: true if the option can be empty, false otherwise

Definition at line 184 of file Option.cpp.

bool isAllowEmpty() const
Get if the option value can be empty.
Definition: Option.cpp:229

References isAllowEmpty(), and p_isAllowEmpty.

Referenced by OptionParser::addOption(), and testOption().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setIsParsed()

void Option::setIsParsed ( bool  isParsed)

Say if the Option has been parsed or not.

Parameters
isParsed: true if the Option has been parsed, false if not

Definition at line 179 of file Option.cpp.

179 {p_isParsed = isParsed;}
bool isParsed() const
Say if the Option has been parsed or not.
Definition: Option.cpp:249

References isParsed(), and p_isParsed.

Referenced by testOption().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setIsRequired()

void Option::setIsRequired ( bool  isRequired)

Set if the option is required.

Parameters
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLongName()

void Option::setLongName ( const PString longName)

Set the long name of the option.

Parameters
longName: long name of the option

Definition at line 154 of file Option.cpp.

154 {p_longName = longName;}

References p_longName.

Referenced by testOption().

+ Here is the caller graph for this function:

◆ setShortName()

void Option::setShortName ( const PString shortName)

Set the short name of the option.

Parameters
shortName: short name of the option

Definition at line 159 of file Option.cpp.

159 {p_shortName = shortName;}

References p_shortName.

Referenced by testOption().

+ Here is the caller graph for this function:

◆ setValue()

void Option::setValue ( const OptionValue value)

Set the value of the option.

Parameters
value: value name of the option

Definition at line 164 of file Option.cpp.

164 {p_value = value;}

References p_value.

Referenced by testOption().

+ Here is the caller graph for this function:

Member Data Documentation

◆ p_docString

PString Option::p_docString
private

Documentation string of the current Option.

Definition at line 80 of file Option.h.

Referenced by copyOption(), getDocString(), print(), and setDocString().

◆ p_firstPartParsedOption

PString Option::p_firstPartParsedOption
private

First paet of parsed option (needed for bash completion)

Definition at line 84 of file Option.h.

Referenced by copyOption(), initialisationOption(), and parsePartOption().

◆ p_isAllowEmpty

bool Option::p_isAllowEmpty
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().

◆ p_isParsed

bool Option::p_isParsed
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().

◆ p_isRequired

bool Option::p_isRequired
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().

◆ p_longName

PString Option::p_longName
private

Long name of the Option.

Definition at line 72 of file Option.h.

Referenced by checkArgument(), copyOption(), getLongName(), getPossibleOption(), parseOption(), print(), and setLongName().

◆ p_shortName

PString Option::p_shortName
private

Short name of the Option.

Definition at line 74 of file Option.h.

Referenced by checkArgument(), copyOption(), getPossibleOption(), getShortName(), parseOption(), print(), and setShortName().

◆ p_value

OptionValue Option::p_value
private

Value of the Option.

Definition at line 76 of file Option.h.

Referenced by checkArgument(), copyOption(), getPossibleValue(), getValue(), parsePartOption(), print(), and setValue().


The documentation for this class was generated from the following files: