// ClientDepotUser.cpp: interface and implementation of the ClientDepotUser class.
//
/////////////////////////////////////////////////////////////////////////////////
//this I/O class is designed to be used in conjunction with the commands "p4 depots" and "p4 depot -o" ONLY.
#include "clientapi.h"
#include "listnode.h"
#include "clientdiruser.h"
#include "clientfileuser.h"
#include "changesorter.h"
#include "filehead.h"
#include "filelogcache.h"
#include "p4objects.h"
#include "clientdepotuser.h"
/* This function is the one that gets called by Perforce - by default, it handles the
* "p4 depots" case, but if specflag is set it calls OutputSpec() instead. */
void
ClientDepotUser::OutputInfo( char level, const_char *data )
{
if (results > MAXRESULTS) return; //If we have >MAXRESULTS depots, don't add any more!
if (specflag == TRUE) //Is this a depot spec we're looking at? If so, this flag should be set.
{
OutputSpec(data); //Assume that "p4 depot -o" was called and act accordingly.
return;
}
/* If we've reached this point we should be looking at a line of output from "p4 depots". It should
* look sort of like this:
* Depot mydepot 1999/07/15 local subdir mydepot/... 'Created by samwise. '
* The only thing we care about is the depot name, which starts on the six character of the line,
* and is followed by a space. */
StrBuf depot = StrBuf(); //We're going to hold the depot name in a StrBuf.
char* ptr = data+6; //This pointer is now pointing at the first letter of the depot name.
while (*ptr != ' ') //Until we hit a space:
{
depot.Append(ptr, 1); //Add this character to the StrBuf.
ptr++; //and increment the pointer to the next character.
}
/* All done - the StrBuf now holds the name of the depot. */
depots.Append(depot); //Add it to the list.
results++; //Increment this counter so we'll know if we exceed MAXRESULTS.
}
/* This function is pretty simple - it just dumps the spec into the "spec" StrBuf.
* Comments aren't that important, so we omit those lines. */
void
ClientDepotUser::OutputSpec( const_char *data)
{
char* ptr = data;
while (*ptr == '#') { //This loop just skips over any lines beginning with '#'.
while (*ptr != '\n') {
ptr++;
}
ptr++;
}
/* After this point, the pointer is looking at the first relevant character.*/
spec.Append((const char*) ptr); //Poink. All done.
}
ClientDepotUser::ClientDepotUser()
{
results = 0;
}
ClientDepotUser::~ClientDepotUser()
{
}
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #1 | 7292 | Andrew McDonald | initial submittal | ||
| //guest/sam_stafford/p4hl/src/dlls/ClientDepotUser.cpp | |||||
| #2 | 1689 | Sam Stafford |
Integrate 02.1 API and code cleanup to P4HL. Lots of work. Phew. |
||
| #1 | 937 | Sam Stafford |
Renaming my guest directory to the more conventional sam_stafford. |
||
| //guest/samwise/p4hl/src/dlls/ClientDepotUser.cpp | |||||
| #1 | 936 | Sam Stafford |
Adding P4HL to the public depot. See relnotes.txt for installation instructions; all relevant files are under p4hl/dist. Source code is under p4hl/src in the form of a VC++ project. |
||