void LuaTableWriter::writeQuotedKeyAndValue(const QString &key, const QVariant &value) { prepareNewLine(); write('['); write(quote(key).toUtf8()); write("] = "); switch (value.type()) { case QVariant::Int: case QVariant::UInt: case QVariant::LongLong: case QVariant::ULongLong: case QVariant::Double: case QVariant::Bool: write(value.toString().toLatin1()); break; default: write(quote(value.toString()).toUtf8()); break; } m_newLine = false; m_valueWritten = true; }
void LuaTableWriter::writeStartTable(const QByteArray &name) { prepareNewLine(); write(name + " = {"); ++m_indent; m_newLine = false; m_valueWritten = false; }
void LuaTableWriter::writeStartReturnTable() { prepareNewLine(); write("return {"); ++m_indent; m_newLine = false; m_valueWritten = false; }
void LuaTableWriter::writeStartTable() { prepareNewLine(); write('{'); ++m_indent; m_newLine = false; m_valueWritten = false; }
void LuaTableWriter::writeKeyAndUnquotedValue(const QByteArray &key, const QByteArray &value) { prepareNewLine(); write(key); write(" = "); write(value); m_newLine = false; m_valueWritten = true; }
void LuaTableWriter::writeKeyAndValue(const QByteArray &key, const char *value) { prepareNewLine(); write(key); write(" = \""); write(value); write('"'); m_newLine = false; m_valueWritten = true; }
void LuaTableWriter::writeQuotedKeyAndValue(const QString &key, const QString &value) { prepareNewLine(); write("[\""); write(key.toUtf8()); write("\"] = \""); write(value.toUtf8()); write('"'); m_newLine = false; m_valueWritten = true; }