Contributed by Robert Cowham of Vizim Worldwide. Robert is a Perforce Consulting Partner and Trainer.
This is a simple wrapper around the P4API to make it slightly easier to use from C++, and to make it similar in function to P4Ruby, P4Python etc.
Requirements:
Initally provided for Visual Studio 2008
Tested using WinUnit
Requires you to download P4API and currently install in p4api-2007.3-vs2003_dyn_vsdebug (see .vcproj file)
StrBuf errMsg;
P4Connection p4;
InitP4(p4);
p4.ParseForms();
WIN_ASSERT_ZERO(p4.Connect(errMsg), _T("Connect should work"));
p4.Run("info", 0, NULL);
WIN_ASSERT_TRUE(p4.InfoArray()->Count() > 0, _T("Some info returned."));
TraceResults(p4);
{
char *args[] = {"-s"};
p4.Run("login", 1, args);
TraceResults(p4);
}
p4.SetInput((LPCSTR) "brunopass");
p4.Run("login", 0, NULL);
TraceResults(p4);
Thanks to Tony Smith who helped along the way, and whose Ruby API provided inspiration.
See changes.txt