Perforce
From Nocturnal Initiative
This Perforce library is a slim C++ wrapper around the P4API as provided by Perforce (http://www.perforce.com). It currently supports many common operations while abstracting away much of the grunt work necessary to use Perforce's API.
Dependencies
This library depends on the P4API available from: ftp://ftp.perforce.com/perforce/
Examples
This is a very simple and incomplete example, but it gives an indication of how the VersionInfo structure is used and a brief example of the style of the API:
#include "Perforce/Perforce.h" if ( !P4::Initialize() ) { throw Nocturnal::Exception( "Failed to initialize perforce library!" ); } std::string path = "x:/project/some/file.txt"; // could also be a perforce spec, eg: x:/project/some/... P4::V_VersionInfo p4Info; P4::FStat( path, p4Info ); // this will only have one element in our example, but if it had used wildcards, it could have multiple P4::V_VersionInfo::const_iterator vItr = versionInfo.begin(); P4::V_VersionInfo::const_iterator vEnd = versionInfo.end(); for( ; vItr != vEnd; ++vItr ) { if ( (*vItr).m_Operation == P4::Operations::Edit ) { printf( "%s (%s) is opened for edit.\n", (*vItr).m_LocalPath.c_str(), (*vItr).m_DepotPath.c_str() ); } } // sync to the head revision P4::Sync( path, p4info ); P4::Cleanup();
