Restructured classes for nodes and trees.

Converted basic node and tree classes to C++ templates. This makes the code
clearer and avoids many explicit type casts. Also fixed some scope issues.
Fixed a bug in convertNewlineCharacters().

Fixed an ugly bug in convertNewlineCharacters() that caused dump2dcm to crash.
This issue was introduced with commit 093768a, i.e. the previous one.
Added insertSubTree() method to subtree class.

Added insertSubTree() and canInsertSubTree() method to the document subtree
class. This allows for adding a particular subtree to an SR document tree or
to another subtree. Also added new tests for these methods (as always).