Pol  Revision:3cfda13
ProgramMain.h
Go to the documentation of this file.
1 #ifndef CLIB_PROGRAM_MAIN_H
2 #define CLIB_PROGRAM_MAIN_H
3 
4 #include <string>
5 #include <vector>
6 
7 namespace Pol
8 {
9 namespace Clib
10 {
12 {
13 public:
14  ProgramMain();
15  virtual ~ProgramMain();
16 
17  void start( int argc, char* argv[] );
18 
19 protected:
20  virtual int main() = 0;
21  virtual void showHelp() = 0;
22 
23  const std::vector<std::string>& programArgs() const;
24  bool programArgsFind( const std::string& filter, std::string* rest = nullptr ) const;
25  std::string programArgsFindEquals( const std::string& filter, std::string defaultVal ) const;
26  int programArgsFindEquals( const std::string& filter, int defaultVal, bool hexVal ) const;
27 
28 private:
29  std::vector<std::string> m_programArguments;
30 };
31 }
32 } // namespaces
33 
34 #define PROG_MAIN Pol::Clib::ProgramMain
35 
36 #endif // CLIB_PROGRAM_MAIN_H
bool programArgsFind(const std::string &filter, std::string *rest=nullptr) const
const std::vector< std::string > & programArgs() const
void start(int argc, char *argv[])
Definition: ProgramMain.cpp:42
virtual void showHelp()=0
virtual int main()=0
std::string programArgsFindEquals(const std::string &filter, std::string defaultVal) const
std::vector< std::string > m_programArguments
Definition: ProgramMain.h:29
Definition: berror.cpp:12