This article provides a simple C++ WIN32 tool to perform diffs on arbitrary files. It also features a nice and workable HTML output.
|
#pragma once
// DiffEngine ////////////////////////////////////////////////////////
//
//
//////////////////////////////////////////////////////////////////////
// S.Rodriguez - Feb 2003
//////////////////////////////////////////////////////////////////////
//
//
class CDiffEngine
{
// Members
protected:
CString m_szColorText, m_szColorBackground, m_szColorChanged, m_szColorAdded, m_szColorDeleted; // used by the html renderer
CString m_szHeader, m_szFooter;
// Constructor
public:
CDiffEngine();
// Accessors
public:
// Methods
// compare f1 (old version) with f2 (new version)
// and build two new copies of those file objects with status on a line by line basis
//
BOOL Diff( /*in*/CFilePartition &f1, /*in*/CFilePartition &f2,
/*out*/CFilePartition &f1_bis, /*out*/CFilePartition &f2_bis);
// build html report
//
void SetTitles(CString &szHeader, CString &szFooter);
void SetColorStyles(CString &szText, CString &szBackground, CString &szChanged, CString &szAdded, CString &szDeleted);
BOOL ExportAsHtml( /*in*/CString &szFilename,
/*in*/CFilePartition &f1,
/*in*/CFilePartition &f2);
// Helpers
protected:
CString Escape(CString &s);
};
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Addicted to reverse engineering. At work, I am developing business intelligence software in a team of smart people (independent software vendor).
Need a fast Excel generation component? Try
xlsgen.