Add Dirk Luetjen's ssphys libraries and command-line tool
[vss2svn.git] / ssphys / SSPhys / FileTypeCommand.cpp
blob7f02a5144deb8c6d7e1091d95f45ee9700882e33
1 // FileTypeCommand.cpp: implementation of the CFileTypeCommand class.
2 //
3 //////////////////////////////////////////////////////////////////////
5 #include "stdafx.h"
6 #include "FileTypeCommand.h"
7 #include "Formatter.h"
8 #include <SSPhysLib\SSFiles.h>
9 #include <SSPhysLib\SSItemInfoObject.h>
11 //////////////////////////////////////////////////////////////////////
12 // Construction/Destruction
13 //////////////////////////////////////////////////////////////////////
15 //---------------------------------------------------------------------------
16 CFileTypeCommand::CFileTypeCommand ()
17 : CCommand ("filetype")
21 COptionInfoList CFileTypeCommand::GetOptionsInfo () const
23 COptionInfoList options = CCommand::GetOptionsInfo();
24 return options;
27 bool CFileTypeCommand::SetOption (const COption& option)
29 return false;
32 bool CFileTypeCommand::SetArguments (CArguments& args)
34 if (args.empty ())
35 throw SSException ("no argument");
37 m_PhysFile = args.front ();
38 args.pop ();
39 return true;
42 void CFileTypeCommand::Execute ()
44 SSHistoryFile file (m_PhysFile);
45 std::auto_ptr<SSItemInfoObject> info (file.GetItemInfo ());
46 if (info.get())
47 g_pFormatter->Format (*info);