Change trackingS.Rodriguez - Oct 14, 2004
This article is about the development of a feature that I call change tracking which you can find in products like MS Word. The screen capture above shows change tracking in practice.
The source code provided along with the article is in C++, and in PHP. C++ developers are able to integrate it with regular WIN32/MFC applications. PHP developers however can directly integrate this in their websites.
What are the effects
Change tracking helps users keep track of additions, deletions and mere changes in text between two revisions. In fact, additions and deletions are the same concept, it's all a matter of changing the point of view. Changes are also a combination of additions and deletions, this is why modelling the differences between two revisions of a piece of text is quite easy.
In its current form, additions are visually represented by a html-based red color, and deletions are represented by a html-based black strikethrough.
How does it work
The algorithm separates the change tracking with the visual representation of change tracking, that's why if you need a different styling, like not using html at all, it's easy and you just need to change the visual code without changing the algorithm itself.
How to use it
In PHP, there is one single function call :
buildTrackChanges("Two typo here. And another technical paper.<br>", "Two typosss he. And another marketing paper.<br>",1);
In C++, there are two method calls :
node* n = new node(NULL); CTrackChanges c; char* s1 = "Two typo here. technical paper"; char* s2 = "Two typosss here. marketing paper"; c.buildChangeList(n, s1, s2); n->dump(); OutputDebugString("\r\n\r\nstring tracking the changes : \r\n"); char* s = c.buildTrackChanges(n,s1,s2); OutputDebugString(s ? s : "some error occured!"); OutputDebugString("\r\n"); delete  s; delete n;