1 // Command.h: interface for the CCommand class.
3 //////////////////////////////////////////////////////////////////////
5 #if !defined(AFX_COMMAND_H__A42CF41F_0E40_40BA_A36B_CAAEC8A6D34E__INCLUDED_)
6 #define AFX_COMMAND_H__A42CF41F_0E40_40BA_A36B_CAAEC8A6D34E__INCLUDED_
10 #endif // _MSC_VER > 1000
13 #include "Arguments.h"
14 #include "CommandLine.h"
15 #include "Formatter.h"
17 //---------------------------------------------------------------------------
21 CCommand (std::string commandName
, std::string description
);
26 std::string
GetCommandName () const { return m_CommandName
; }
27 std::string
GetCommandDescription () const { return m_CommandDescription
; }
29 virtual po::options_description
GetOptionsDescription () const;
30 virtual po::options_description
GetHiddenDescription () const;
31 virtual po::positional_options_description
GetPositionalOptionsDescription () const;
33 int Execute (std::vector
<std::string
> const& args
);
34 virtual void Execute (po::variables_map
const & options
, std::vector
<po::option
> const & args
) = 0;
36 void PrintUsage () const;
38 std::string m_CommandName
;
39 std::string m_CommandDescription
;
40 po::variables_map m_VariablesMap
;
41 // po::options_description m_OptionsDescription;
42 // po::options_description m_HiddenDescription;
44 std::auto_ptr
<CFormatter
>& GetFormatter ();
46 std::auto_ptr
<CFormatter
> m_pFormatter
;
49 //---------------------------------------------------------------------------
50 class CMultiArgCommand
: public CCommand
53 CMultiArgCommand (std::string commandName
, std::string description
);
55 virtual po::positional_options_description
GetPositionalOptionsDescription () const;
56 virtual po::options_description
GetHiddenDescription () const;
58 virtual void Execute (po::variables_map
const& options
, std::vector
<po::option
> const& args
);
59 virtual void Execute (po::variables_map
const& options
, std::string
const& arg
) = 0;
66 #endif // !defined(AFX_COMMAND_H__A42CF41F_0E40_40BA_A36B_CAAEC8A6D34E__INCLUDED_)