1 // CommandFactory.cpp: implementation of the CCommandFactory class.
3 //////////////////////////////////////////////////////////////////////
6 #include "CommandFactory.h"
8 #include "GlobalOptions.h"
9 #include "HelpCommand.h"
10 #include "HistoryCommand.h"
11 #include "InfoCommand.h"
12 #include "ValidateCommand.h"
13 #include "GetCommand.h"
14 #include "FileTypeCommand.h"
15 #include "PropertiesCommand.h"
17 //////////////////////////////////////////////////////////////////////
18 // Construction/Destruction
19 //////////////////////////////////////////////////////////////////////
21 CCommandFactory::CCommandFactory()
25 CCommandFactory::~CCommandFactory()
29 CCommand
* CCommandFactory::MakeCommand (std::string command
)
31 CCommand
* pCommand
= NULL
;
32 if (command
== "help")
33 pCommand
= new CHelpCommand (this);
34 else if (command
== "info")
35 pCommand
= new CInfoCommand ();
36 else if (command
== "history")
37 pCommand
= new CHistoryCommand ();
38 else if (command
== "validate")
39 pCommand
= new CValidateCommand ();
40 else if (command
== "get")
41 pCommand
= new CGetCommand ();
42 else if (command
== "filetype")
43 pCommand
= new CFileTypeCommand ();
44 else if (command
== "properties")
45 pCommand
= new CPropertiesCommand ();
47 throw SSException ("unknown command");
52 void CCommandFactory::PrintUsage () const
55 CHelpCommand helpCommand
;
56 helpCommand
.PrintUsage ();
58 CHistoryCommand historyCommand
;
59 historyCommand
.PrintUsage ();
61 CInfoCommand infoCommand
;
62 infoCommand
.PrintUsage ();
64 CValidateCommand validateCommand
;
65 validateCommand
.PrintUsage ();
67 CGetCommand getCommand
;
68 getCommand
.PrintUsage ();