GClasses
GClasses::GDiff Class Reference

Detailed Description

This class finds the differences between two text files It is case and whitespace sensitive, but is tolerant of Unix/Windows/Mac line endings. It uses lines as the atomic unit. It accepts matching lines in a greedy manner.

#include <GDiff.h>

Public Member Functions

 GDiff (const char *szFile1, const char *szFile2)
 
virtual ~GDiff ()
 
bool nextLine (struct GDiffLine *pLine)
 

Static Public Member Functions

static void test ()
 Performs unit tests for this class. Throws an exception if there is a failure. More...
 

Protected Member Functions

size_t findNextMatchingLine (size_t *pPos1, size_t *pPos2)
 

Static Protected Member Functions

static size_t measureLineLength (const char *pLine)
 

Protected Attributes

size_t m_nLine1
 
size_t m_nLine2
 
size_t m_nNextMatch1
 
size_t m_nNextMatch2
 
size_t m_nNextMatchLen
 
size_t m_nPos1
 
size_t m_nPos2
 
const char * m_pFile1
 
const char * m_pFile2
 

Constructor & Destructor Documentation

GClasses::GDiff::GDiff ( const char *  szFile1,
const char *  szFile2 
)
virtual GClasses::GDiff::~GDiff ( )
virtual

Member Function Documentation

size_t GClasses::GDiff::findNextMatchingLine ( size_t *  pPos1,
size_t *  pPos2 
)
protected
static size_t GClasses::GDiff::measureLineLength ( const char *  pLine)
staticprotected
bool GClasses::GDiff::nextLine ( struct GDiffLine pLine)
static void GClasses::GDiff::test ( )
static

Performs unit tests for this class. Throws an exception if there is a failure.

Member Data Documentation

size_t GClasses::GDiff::m_nLine1
protected
size_t GClasses::GDiff::m_nLine2
protected
size_t GClasses::GDiff::m_nNextMatch1
protected
size_t GClasses::GDiff::m_nNextMatch2
protected
size_t GClasses::GDiff::m_nNextMatchLen
protected
size_t GClasses::GDiff::m_nPos1
protected
size_t GClasses::GDiff::m_nPos2
protected
const char* GClasses::GDiff::m_pFile1
protected
const char* GClasses::GDiff::m_pFile2
protected