QByteArray TmxMapWriter::toByteArray(const Map *map) { QByteArray bytes; QBuffer buffer(&bytes); buffer.open(QIODevice::WriteOnly); MapWriter writer; writer.setLayerDataFormat(MapWriter::Base64Zlib); writer.writeMap(map, &buffer); return bytes; }
bool TmxMapWriter::write(const Map *map, const QString &fileName) { Preferences *prefs = Preferences::instance(); MapWriter writer; writer.setLayerDataFormat(prefs->layerDataFormat()); writer.setDtdEnabled(prefs->dtdEnabled()); bool result = writer.writeMap(map, fileName); if (!result) mError = writer.errorString(); else mError.clear(); return result; }
bool AuroraMapWriter::write(const Map *map, const QString &fileName) { Map::LayerDataFormat format = map->layerDataFormat(); if (format == Map::Default) format = Map::Base64Zlib; format = Map::Base64Zlib; MapWriter writer; writer.setLayerDataFormat(format); writer.setDtdEnabled(false); bool result = writer.writeMap(map, fileName); if (!result) { mError = writer.errorString(); } else { mError.clear(); } return result; }