Home | Develop | Download | Contact
CmdHelp.hpp
1 /*
2  * CmdHelp.hpp
3  *
4  * Copyright 2021 Fernando Pujaico Rivera <fernando.pujaico.rivera@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  *
21  */
22 
32 #ifndef __PDS_CMDHELP_HPP__
33 #define __PDS_CMDHELP_HPP__
34 
35 
45 #include <sstream> // std::ostringstream
46 #include <vector>
47 #include <string>
48 
49 
50 namespace Pds{
51 
52 typedef struct
53 {
54  unsigned int param_type;
55  std::string param_long;
56  std::string param_short;
57  std::string description;
58  std::string bydefault;
60 
68 class CmdHelp
69 {
70 private:
72  std::string program;
73 
75  std::string version;
76 
78  std::string commandexample;
79 
81  std::vector<Pds::HelpParamRow> data;
82 private:
83  std::string titleprogram;
84  std::string titleversion;
85  std::string titlecommand;
86  std::string titleparameters;
87  std::string titlelong;
88  std::string titleshort;
89  std::string titledescription;
90  std::string titledata;
91  std::string titledefault;
92  std::string textdata;
93 
94 public:
95 
105  CmdHelp(void);
106 
113  CmdHelp(const std::string &program,const std::string &version);
114 
115 
117 
122 public:
123 
139  bool AddParam(const unsigned int &ptype,
140  const std::string &plong,
141  const std::string &pshort,
142  const std::string &description,
143  const std::string &bydefault="");
144 
151  bool SetCommandExample(const std::string &commandexample);
152 
158  bool IsEmpty(void) const;
159 
165  bool Print(void) const;
166 
172 }; // Class CmdHelp
173 
174 } // namespace Pds
175 
176 
181 #endif
182 
La estructura tipo Pds::CmdHelp . Esta estructura genera una posicion. Para usar incluir <Pds/CmdHelp...
Definition: CmdHelp.hpp:69
std::string titleversion
Definition: CmdHelp.hpp:84
std::string titledefault
Definition: CmdHelp.hpp:91
std::vector< Pds::HelpParamRow > data
Definition: CmdHelp.hpp:81
std::string version
Definition: CmdHelp.hpp:75
std::string titleprogram
Definition: CmdHelp.hpp:83
std::string titlelong
Definition: CmdHelp.hpp:87
std::string commandexample
Definition: CmdHelp.hpp:78
std::string titledescription
Definition: CmdHelp.hpp:89
std::string program
Definition: CmdHelp.hpp:72
std::string titledata
Definition: CmdHelp.hpp:90
std::string textdata
Definition: CmdHelp.hpp:92
std::string titleshort
Definition: CmdHelp.hpp:88
std::string titlecommand
Definition: CmdHelp.hpp:85
std::string titleparameters
Definition: CmdHelp.hpp:86
CmdHelp(void)
Crea un objeto de tipo Pds::CmdHelp.
CmdHelp(const std::string &program, const std::string &version)
Crea un objeto de tipo Pds::CmdHelp.
bool IsEmpty(void) const
Retorna true si el objeto está inicializado o false si no.
bool Print(void) const
Imprime por consola el help del programa.
bool SetCommandExample(const std::string &commandexample)
Coloca un exemplo de uso del programa.
bool AddParam(const unsigned int &ptype, const std::string &plong, const std::string &pshort, const std::string &description, const std::string &bydefault="")
Agrega datos de parámetros del programa.
Nombre de espacion para PDS (Procesamiento Digital de Senales)
Definition: RaFile.hpp:47
std::string description
Definition: CmdHelp.hpp:57
unsigned int param_type
Definition: CmdHelp.hpp:54
std::string param_long
Definition: CmdHelp.hpp:55
std::string bydefault
Definition: CmdHelp.hpp:58
std::string param_short
Definition: CmdHelp.hpp:56

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed