A TMX writer would save a TKMap class into TMX format using base64 encoding and optional compression (gzip, zlib).
The resulting TMX file should be 100% compatible with Tiled.
Any runtime modifications to the TKMap class and its constituents (tileset, layers, objects, etc) would be preserved. This would make saving TMX files mainly useful for savegames, writing editors and writing (random) map generators.
Estimation: 3 days