コード例 #1
0
ファイル: kodemain.cpp プロジェクト: serghei/kde3-kdepim
void addPropertyFunctions(QString &out, const QString &type,
                          const QString &name)
{
    // FIXME: Use KODE::Function

    bool isReference = type.endsWith("*") || type.endsWith("&");

    QString argument;
    QString upper = KODE::Style::upperFirst(name);
    if(!isReference)
    {
        argument = "const " + type + " &";
    }
    else argument = type;

    KODE::Code code;
    code.setIndent(4);
    code += "/**";
    code += "  Set .";
    code += "*/";
    code += "void set" + upper + "( " + argument + "v )";
    code += "{";
    code += "  m" + upper + " = v;";
    code += "}";

    code += "/**";
    code += "  Get " + name + ". See set" + upper + "().";
    code += "*/";
    code += type + (isReference ? "" : " ") + name + "() const";
    code += "{";
    code += "  return m" + upper + ";";
    code += "}";

    out += code.text();
}
コード例 #2
0
ファイル: kodemain.cpp プロジェクト: serghei/kde3-kdepim
void addPropertyVariable(QString &out, const QString &type,
                         const QString &name)
{
    QString upper = KODE::Style::upperFirst(name);
    bool isReference = type.endsWith("*") || type.endsWith("&");

    KODE::Code code;
    code.setIndent(4);
    code += type + (isReference ? "" : " ") + "m" + upper + ";";

    out += code.text();
}