/******************************************************************************
 * This file is part of the Mula project
 * Copyright (c) 2011 Laszlo Papp <lpapp@kde.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef MULA_PLUGIN_STARDICT_FILE
#define MULA_PLUGIN_STARDICT_FILE

#include <QtCore/QString>

const int invalidIndex = -100;

static inline int stardictStringCompare(QString string1, QString string2)
{
    int retval = string1.compare(string2, Qt::CaseInsensitive);

    if (retval == 0)
        return string1.compare(string2);
    else
        return retval;
}

#endif // MULA_PLUGIN_STARDICT_FILE

/******************************************************************************
 * This file is part of the Mula project
 * Copyright (c) 2011 Laszlo Papp <lpapp@kde.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef MULA_PLUGIN_STARDICT_FILE
#define MULA_PLUGIN_STARDICT_FILE

#include <QtCore/QString>

const int invalidIndex = -100;

static inline int stardictStringCompare(QString string1, QString string2)
{
    int retval = string1.compare(string2, Qt::CaseInsensitive);
    return retval ? retval : string1.compare(string2);
}

#endif // MULA_PLUGIN_STARDICT_FILE

Use the tenary operator instead of a simple if/else inside an inline function
Use the tenary operator instead of a simple if/else inside an inline function
