/*
* 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' && p[1] != '\0' )
numLines++;
return numLines;
}
# |
Change |
User |
Description |
Committed |
|
#1
|
22562 |
rlranft |
Populate -o //guest/perforce_software/p4/2017-1/...
//guest/rlranft/p4/2017-1/.... |
|
|
//guest/perforce_software/p4/2017-1/support/splr.cc |
#1
|
22288 |
mark_mears |
import 2017.1 code drop |
|
|