[DMDD] [refactor] Move Type::toCBuffer into a visitor class

@AndrejMitrovic This one took me quite a while to work out what was calling what and why, so I left it in a whole bunch of commits to make it easier to review.  I can squash it before merging if necessary.