[p4] Some questions to the C++ API ...
xtc777 at freenet.de
xtc777 at freenet.de
Mon Nov 30 02:49:45 PST 2009
Hello Robert,
this is exactly what I did look for. Thanks a lot for both providing p4api and the additional usage
information.
Today I will take a closer look to the p4api && implement my first little application with direct p4 access.
. .. currently a big challenge for me ...
Regards,
the newbie.
> -----Ursprüngliche Nachricht-----
> Von: \"Robert Cowham\"
> Gesendet: Do. 26.11.09 (19:20)
> An: xtc777 at freenet.de, \"Jeff A. Bowles\"
> Kopie: perforce-user at perforce.com
> Betreff: RE: [p4] Some questions to the C++ API ...
>
> > The good news is: did find some interesting stuff on the
> > site of Robert Cowham. With a little luck and some further
> > investigations I should be able to solve my little C++ API problem.
>
> That would hopefully be:
>
> http://public.perforce.com/guest/robert_cowham/perforce/API/p4api/main/index
> .html
>
> (I used this request as a reminder to update - tested with 2009.1
> API)
>
> Usage is given here (some excerpts below).
>
> http://public.perforce.com/guest/robert_cowham/perforce/API/p4api/main/P4API
> Test/TestP4API.cpp
>
> Note test output:
>
> http://public.perforce.com/guest/robert_cowham/perforce/API/p4api/main/P4API
> Test/TEST_OUTPUT.txt
>
> p4.SetPort(\"1666\");
> p4.SetUser(\"bruno\");
> p4.SetClient(\"bruno_ws\");
> p4.ParseForms();
>
> {
> WIN_TRACE(\"Running SYNCn\");
> char *args[] = {\"//depot/Jam/MAIN/src/jam.c\"};
> p4.Run(\"sync\", 1, args);
> TraceResults(p4);
> }
>
> {
> WIN_TRACE(\"Submit changelistn\");
> // First we fetch the client
> char *args[] = {\"-o\"};
> p4.Run(\"change\", 1, args);
> TraceResults(p4);
>
> StrArray *sba = p4.GetArrayVar(\"Files\");
> TraceArray(\"Files\", sba);
> delete sba;
>
> p4.SetVar(\"Description\", \"Dummy submit\");
>
> args[0] = \"-i\";
> p4.Run(\"submit\", 1, args);
> TraceResults(p4);
> }
>
> {
> WIN_TRACE(\"Checking client spec manipulationn\");
> // First we fetch the client
> char *args[] = {\"-o\", \"bruno_ws\"};
> p4.Run(\"client\", 2, args);
> TraceResults(p4);
>
> // Output the View element (which we know to be an array)
> StrArray *sba = p4.GetArrayVar(\"View\");
> TraceArray(\"View\", sba);
> int len = sba->Count();
>
> // Create a new view and update the client workspace
> StrBuf new_view(\"//depot/new/... //bruno_ws/new/...\");
> sba->Put()->Set(new_view);
> p4.SetArrayVar(\"View\", sba);
> delete sba;
> sba = p4.GetArrayVar(\"View\");
> WIN_ASSERT_EQUAL(sba->Count(), len + 1, _T(\"Check we can add
> to View\"));
> delete sba;
>
> args[0] = \"-i\";
> p4.Run(\"client\", 1, args);
> TraceResults(p4);
>
> // Check that the updated View is correct with what we put
> in
> args[0] = \"-o\";
> p4.Run(\"client\", 2, args);
> TraceResults(p4);
> sba = p4.GetArrayVar(\"View\");
> WIN_ASSERT_EQUAL(sba->Count(), len + 1, _T(\"Check View is
> stored\"));
> TraceArray(\"View\", sba);
> WIN_ASSERT_STRING_EQUAL(sba->Get(sba->Count() - 1)->Text(),
> new_view.Text(), _T(\"Check View line is the same\"));
> delete sba;
> }
>
>
>
> -----Ursprüngliche Nachricht Ende-----
Heute schon ge"freeMail"t?
Jetzt kostenlose E-Mail-Adresse sichern!
http://email.freenet.de/dienste/emailoffice/produktuebersicht/basic/mail/index.html?pid=6831
More information about the perforce-user
mailing list