<html> <head> <title>P4Connection - Wrapper around Perforce C++ API</title> <style TYPE="text/css"> <!-- BODY {font: 12px/16px verdana, arial, sans-serif !important; text-align: left; margin-left: 2cm; color:#000000 !important;} .cell {font: 12px/16px verdana, arial, sans-serif !important; text-align: left; color:#000000 !important;} TD {font: 12px/16px verdana, arial, sans-serif !important; text-align: left; color:#000000 !important;} H1 {font: 18px/18px verdana, arial, sans-serif !important; text-align: left; color:#333333 !important;} H2 {font: 18px/18px verdana, arial, sans-serif !important; text-align: left; color:#333333 !important; font-weight: bold; margin-bottom: 14px} H3 {font: 14px/14px verdana, arial, sans-serif !important; text-align: left; color:#333333 !important; font-weight: bold; margin-bottom: 14px} pre { border-right: #646464 1px solid; padding-right: 0.5em; border-top: #646464 1px solid; padding-top: 0.5em; border-left: #646464 1px solid; padding-left: 0.5em; border-bottom: #646464 1px solid; padding-bottom: 0.5em; white-space: pre; background-color: #f6e6e6; color: black; margin-left: 1em; width: 90%; display: table; font-size: 100%; } --> </style> </head> <body> <h1><a name="top"></a>P4API - Wrapper around Perforce C++ API on Windows</h1> <p>Contributed by Robert Cowham of Vizim Worldwide. Robert is a <a href="http://public.perforce.com/guest/robert_cowham/pcp.html">Perforce Consulting Partner and Trainer</a>.</p> <h3 ALIGN="LEFT">Introduction</h3> <p ALIGN="LEFT">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.</p> <p ALIGN="LEFT">Requirements:</p> <ul> <li> <p ALIGN="LEFT">Initally provided for Visual Studio 2008</p> </li> <li> <p ALIGN="LEFT">Tested using <a href="http://www.wintellect.com/cs/blogs/jrobbins/archive/2008/01/17/winunit-an-outstanding-native-c-unit-testing-tool.aspx">WinUnit</a> (you need to install).</p> </li> <li> <p ALIGN="LEFT">Requires you to download P4API and currently install in p4api-2009.1.209442-vs2008_static (see .vcproj file).</p> </li> </ul> <h2>Download</h2> <p>See <a href="p4api.zip">p4api.zip</a> for full sources.</p> <p>Alternatively just navigate to this area of the Perforce Public Depot and sync as usual (requires a login from support@perforce.com).</p> <h2>Examples</h2> <p>See <a href="P4APITest/TestP4API.cpp">P4APITest/TestP4API.cpp</a> for full examples.</p> <pre>StrBuf errMsg; P4Connection p4; InitP4(p4); // Just sets Port/Client/User 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);</pre> <p> Outputs from test harness: </p> <p>See <a href="P4APITest/TEST_OUTPUT.txt">P4APITest/TEST_OUTPUT.txt</a>.</p> <h2>Credits</h2> <p>Thanks to Tony Smith who helped along the way, and whose <a href="http://public.perforce.com/guest/tony_smith/perforce/API/Ruby/main/doc/index.html"> Ruby API</a> provided inspiration.</p> <h2>Changes</h2> <p>See <a href="CHANGES.txt">CHANGES.txt</a></p> <p> <a href="#top">Top</a> </p> </body> </html>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#8 | 7508 | Robert Cowham | Make zip file | ||
#7 | 7505 | Robert Cowham | Remove blank lines | ||
#6 | 7504 | Robert Cowham | Back out revision 5 from //guest/robert_cowham/perforce/API/p4api/main/index.html | ||
#5 | 7502 | Robert Cowham |
- Updated for 2009.1 API - use static version (/MT rather than /MD) - Fixed SetProg/SetVersion calls - ensures they are called at correct moment. - Add SetProtocol - Added some more tests/examples |
||
#4 | 7501 | Robert Cowham | Updated with ref to test output and changes | ||
#3 | 6470 | Robert Cowham | Fix links again! | ||
#2 | 6469 | Robert Cowham | Add link | ||
#1 | 6468 | Robert Cowham | Draft version. |