PhoenixPresentation  2.0.0
Set of cmake function to automate presentation generation
get_argument_list.cpp File Reference
+ Include dependency graph for get_argument_list.cpp:

Go to the source code of this file.

Functions

std::list< PStringphoenix_getArgumentList (int argc, char **argv)
 Convert the list of given arguments to the program into a list of string. More...
 
PString phoenix_getProgramCall (const std::list< PString > &listArg)
 Get the program call. More...
 
bool phoenix_isOptionExist (const std::list< PString > &listArg, const PString &arg1)
 Check if one of the two passed arguments are in the list of arguments. More...
 
bool phoenix_isOptionExist (const std::list< PString > &listArg, const PString &arg1, const PString &arg2)
 Check if one of the two passed arguments are in the list of arguments. More...
 
bool phoenix_isOptionExist (const std::list< PString > &listArg, const std::list< PString > &argCheckList)
 Check if one of the two passed arguments are in the list of arguments. More...
 
PString phoenix_listArgToString (const std::list< PString > &listArg)
 Convert the given list of arguement into a string. More...
 
void phoenix_rmProgramCall (std::list< PString > &listArg)
 Remove the program call from the list of argument. More...
 

Function Documentation

◆ phoenix_getArgumentList()

std::list<PString> phoenix_getArgumentList ( int  argc,
char **  argv 
)

Convert the list of given arguments to the program into a list of string.

Parameters
argc: number of arguments passed to the program
argv: table of arguments passed to the program
Returns
corresponding list of string

Definition at line 15 of file get_argument_list.cpp.

15  {
16  std::list<PString> argList;
17  for(int i(0); i < argc; ++i){
18  argList.push_back(PString(argv[i]));
19  }
20  return argList;
21 }
Extends the std::string.
Definition: PString.h:16

Referenced by main().

+ Here is the caller graph for this function:

◆ phoenix_getProgramCall()

PString phoenix_getProgramCall ( const std::list< PString > &  listArg)

Get the program call.

Parameters
listArg: list of argument passed to the program
Returns
program call, or empty string if list of argument is empty

Definition at line 82 of file get_argument_list.cpp.

82  {
83  if(listArg.size() != 0lu){return listArg.front();}
84  else{return "";}
85 }

Referenced by main().

+ Here is the caller graph for this function:

◆ phoenix_isOptionExist() [1/3]

bool phoenix_isOptionExist ( const std::list< PString > &  listArg,
const PString arg1 
)

Check if one of the two passed arguments are in the list of arguments.

Parameters
listArg: list of arguments given to the program
arg1: argument to be searched
Returns
true if arg1 or arg2 is in listArg, false otherwise

Definition at line 47 of file get_argument_list.cpp.

47  {
48  std::list<PString> argCheckList;
49  argCheckList.push_back(arg1);
50  return phoenix_isOptionExist(listArg, argCheckList);
51 }
bool phoenix_isOptionExist(const std::list< PString > &listArg, const std::list< PString > &argCheckList)
Check if one of the two passed arguments are in the list of arguments.

References phoenix_isOptionExist().

+ Here is the call graph for this function:

◆ phoenix_isOptionExist() [2/3]

bool phoenix_isOptionExist ( const std::list< PString > &  listArg,
const PString arg1,
const PString arg2 
)

Check if one of the two passed arguments are in the list of arguments.

Parameters
listArg: list of arguments given to the program
arg1: argument to be searched
arg2: argument to be searched
Returns
true if arg1 or arg2 is in listArg, false otherwise

Definition at line 59 of file get_argument_list.cpp.

59  {
60  std::list<PString> argCheckList;
61  argCheckList.push_back(arg1);
62  argCheckList.push_back(arg2);
63  return phoenix_isOptionExist(listArg, argCheckList);
64 }

References phoenix_isOptionExist().

+ Here is the call graph for this function:

◆ phoenix_isOptionExist() [3/3]

bool phoenix_isOptionExist ( const std::list< PString > &  listArg,
const std::list< PString > &  argCheckList 
)

Check if one of the two passed arguments are in the list of arguments.

Parameters
listArg: list of arguments given to the program
argCheckList: list of argument to be searched
Returns
true if one element of argCheckList has been found in listArg, false otherwise

Definition at line 28 of file get_argument_list.cpp.

28  {
29  bool isSearch(true);
30  std::list<PString>::const_iterator itArg(listArg.begin());
31  while(itArg != listArg.end() && isSearch){
32  std::list<PString>::const_iterator itCheck(argCheckList.begin());
33  while(itCheck != argCheckList.end() && isSearch){
34  isSearch = *itArg != *itCheck;
35  ++itCheck;
36  }
37  ++itArg;
38  }
39  return !isSearch;
40 }

Referenced by main(), and phoenix_isOptionExist().

+ Here is the caller graph for this function:

◆ phoenix_listArgToString()

PString phoenix_listArgToString ( const std::list< PString > &  listArg)

Convert the given list of arguement into a string.

Parameters
listArg: list of argument to be converted into a string
Returns
corresponding string

Definition at line 70 of file get_argument_list.cpp.

70  {
71  PString body("");
72  for(std::list<PString>::const_iterator itArg(listArg.begin()); itArg != listArg.end(); ++itArg){
73  body += itArg->escapeStr(" '\"", "\\") + " ";
74  }
75  return body;
76 }

References PString::escapeStr().

Referenced by main().

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

◆ phoenix_rmProgramCall()

void phoenix_rmProgramCall ( std::list< PString > &  listArg)

Remove the program call from the list of argument.

Parameters
[out]listArg: list or argument to be modified

Definition at line 90 of file get_argument_list.cpp.

90  {
91  if(listArg.size() != 0lu){
92  listArg.pop_front();
93  }
94 }

Referenced by main().

+ Here is the caller graph for this function: