/*
* Copyright 1995, 2000 Perforce Software. All rights reserved.
*
* This file is part of Perforce - the FAST SCM System.
*/
# include <stdhdrs.h>
# include <debug.h>
# include <strbuf.h>
# include "splr.h"
// This simple class lets you read through a StrPtr's text, a "line" at a time.
StrPtrLineReader::StrPtrLineReader( const StrPtr *buf )
{
start = buf->Text();
}
StrPtrLineReader::~StrPtrLineReader()
{
}
int
StrPtrLineReader::GetLine( StrBuf *line )
{
if( !start || !(*start) )
return 0;
const char *p = start;
for( ; p && *p; p++ )
if( p[0] == '\n' )
break;
line->Set( start, p - start );
start = (*p) ? p + 1 : 0 ;
return 1;
}
int
StrPtrLineReader::CountLines()
{
if( !start || !(*start) )
return 0;
int numLines = 1;
for( const char *p = start; *p; p++ )
if( *p == '\n' )
numLines++;
return numLines;
}
# |
Change |
User |
Description |
Committed |
|
#1
|
19992 |
devkix |
"Forking branch 2016-1 of perforce_software-p4 to devkix-p4." |
|
|
//guest/perforce_software/p4/2016-1/support/splr.cc |
#1
|
19472 |
Liz Lam |
Initial add of the 2016.1 p4/p4api source code. |
|
|