#include <clientapi.h> #include "DAFile.h" #include "DALine.h" #include "DARev.h" #include "DATextTable.h" DAFile::DAFile( DATextTable* table ) :textTable( table ) { revArray = 0x0; arrSize = 0; lineZero = new DALine( this, 0, 0, 0 ); } DAFile::~DAFile(void) { for ( int i = 0 ; i < arrSize ; i++ ) { if ( revArray[i] ) delete revArray[i]; } delete[] revArray; while ( lineZero->nextLine() != lineZero ) { delete lineZero->nextLine(); } delete lineZero; } void DAFile::setPath( const StrPtr* p ) { path.Set( p ); } DARev* DAFile::addRev( int num, int change ) { if ( !revArray ) { arrSize = num + 1; revArray = new DARev*[arrSize]; for ( int i = 0 ; i < arrSize ; i++ ) { revArray[i] = 0x0; } } if ( num >= arrSize ) return 0x0; revArray[ num ] = new DARev( num, change ); return revArray[ num ]; } DALine* DAFile::addLine( const StrPtr* text, int up, int lo ) { DALine* line = new DALine( this, textTable->getId( *text ), up, lo ); lineZero->prependLine( line ); return line; } DARev* DAFile::getRev( int num ) { if ( num >= arrSize || num < 0 ) return 0x0; return revArray[ num ]; } DARev* DAFile::getNextRev( int num ) { if ( num >= arrSize || num < 0 ) return 0x0; return revArray[ num ] ? revArray[ num ] : getNextRev( num+1 ); } DARev* DAFile::getLastRev( int num ) { if ( num >= arrSize || num < 0 ) return 0x0; return revArray[ num ] ? revArray[ num ] : getLastRev( num-1 ); } int DAFile::head() { return arrSize - 1; } DALine* DAFile::firstLine() { return lineZero->nextLine(); } DALine* DAFile::lastLine() { return lineZero->prevLine(); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 6297 | Sam Stafford |
Work so far on "deep annotate". Been getting a lot of questions on this lately from other people working on the same thing; might as well pool efforts. |