index.html #2

  • //
  • guest/
  • robert_cowham/
  • perforce/
  • API/
  • p4api/
  • main/
  • index.html
  • View
  • Commits
  • Open Download .zip Download (3 KB)
<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-2007.3-vs2003_dyn_vsdebug (see .vcproj file). Will test with 2008.1 
	API shortly !</p>
	</li>
</ul>
<h2>Examples</h2>
<p>See <a href="P4APITest/P4APITest.cpp">P4APITest/P4APITest.cpp</a></p>
<pre>StrBuf errMsg;
P4Connection p4;
InitP4(p4);
p4.ParseForms();
WIN_ASSERT_ZERO(p4.Connect(errMsg), _T(&quot;Connect should work&quot;));
p4.Run(&quot;info&quot;, 0, NULL);
WIN_ASSERT_TRUE(p4.InfoArray()-&gt;Count() &gt; 0, _T(&quot;Some info returned.&quot;));
TraceResults(p4);

{
char *args[] = {&quot;-s&quot;};
p4.Run(&quot;login&quot;, 1, args);
TraceResults(p4);
}

p4.SetInput((LPCSTR) &quot;brunopass&quot;);
p4.Run(&quot;login&quot;, 0, NULL);
TraceResults(p4);</pre>

<h3>Credits</h3>
<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>

<h3>Changes</h3>
<p>See changes.txt</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.