Logo Search packages:      
Sourcecode: debconf-kde version File versions  Download package

template<class T >
int DebconfKde::DebconfFrontend::enumFromString ( const QString &  str,
const char *  enumName 
) [static, private]

Transforms the string camel cased and return it's enum given the enum name

Definition at line 114 of file debconf.cpp.

{
    m_values[key] = value;
}

template<class T> int DebconfFrontend::enumFromString(const QString &str, const char *enumName)
{
    QString realName(str);
    realName.replace(0, 1, str.at(0).toUpper());
    int pos;
    while ((pos = realName.indexOf(QLatin1Char( '_' ))) != -1) {
        if (pos + 1 > realName.size()) {
            realName.chop(pos);
        } else{
            realName.replace(pos, 2, realName.at(pos + 1).toUpper());
        }
    }

    int id = T::staticMetaObject.indexOfEnumerator(enumName);
    QMetaEnum e = T::staticMetaObject.enumerator(id);

Generated by  Doxygen 1.6.0   Back to index