add two patches from Richard Hughes to fix bug in parentdata comparison and update...
[vss2svn.git] / ssphys / SSPhys / PropertiesCommand.cpp
blobf96f98cd991eeed74f07e5e17d857f981aac9434
1 // PropertiesCommand.cpp: implementation of the CPropertiesCommand class.
2 //
3 //////////////////////////////////////////////////////////////////////
5 #include "StdAfx.h"
6 #include "PropertiesCommand.h"
7 #include "Formatter.h"
8 #include <SSPhysLib/SSFiles.h>
9 #include <SSPhysLib/SSItemInfoObject.h>
10 #include <SSPhysLib/SSProjectObject.h>
12 //////////////////////////////////////////////////////////////////////
13 // Construction/Destruction
14 //////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
17 CPropertiesCommand::CPropertiesCommand ()
18 : CMultiArgCommand ("properties", "Shows basic properties about a VSS physical file")
22 void CPropertiesCommand::Execute (po::variables_map const& options, std::string const& arg)
24 std::auto_ptr<SSRecordFile> file (SSRecordFile::MakeFile(arg));
25 if (file.get ())
27 SSHistoryFile* pHistory = dynamic_cast<SSHistoryFile*> (file.get());
28 SSProjectFile* pProject = dynamic_cast<SSProjectFile*> (file.get());
30 if (pHistory)
32 std::auto_ptr<SSItemInfoObject> info (pHistory->GetItemInfo ());
33 if (info.get())
34 GetFormatter()->Format (*info, this);
36 else if (pProject)
38 SSRecordPtr record (pProject->GetFirstRecord());
39 while (record)
41 SSProjectObject project (record);
42 GetFormatter()->Format (project, this);
43 record = pProject->GetNextRecord(record);
47 else
48 throw SSException ("xxx is not a history file, nor a project file");