Example #1
0
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;
}
Example #2
0
void LuaTableWriter::writeStartTable(const QByteArray &name)
{
    prepareNewLine();
    write(name + " = {");
    ++m_indent;
    m_newLine = false;
    m_valueWritten = false;
}
Example #3
0
void LuaTableWriter::writeStartReturnTable()
{
    prepareNewLine();
    write("return {");
    ++m_indent;
    m_newLine = false;
    m_valueWritten = false;
}
Example #4
0
void LuaTableWriter::writeStartTable()
{
    prepareNewLine();
    write('{');
    ++m_indent;
    m_newLine = false;
    m_valueWritten = false;
}
Example #5
0
void LuaTableWriter::writeKeyAndUnquotedValue(const QByteArray &key,
                                              const QByteArray &value)
{
    prepareNewLine();
    write(key);
    write(" = ");
    write(value);
    m_newLine = false;
    m_valueWritten = true;
}
Example #6
0
void LuaTableWriter::writeKeyAndValue(const QByteArray &key,
                                      const char *value)
{
    prepareNewLine();
    write(key);
    write(" = \"");
    write(value);
    write('"');
    m_newLine = false;
    m_valueWritten = true;
}
Example #7
0
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;
}