IlwisTypes Parameter::determineType(const QString& value, const SymbolTable &symtab) {
    IlwisTypes tp = IlwisObject::findType(value);
    if ( tp != itUNKNOWN)
        return tp;

    Symbol sym = symtab.getSymbol(value);
    if ( sym.isValid() && sym._type != itUNKNOWN)
        return sym._type;

    QString s = context()->workingCatalog()->resolve(value);
    IlwisTypes type = IlwisObject::findType(s) ;
    if ( type != itUNKNOWN)
        return type;

    quint64 id = IlwisObject::internalname2id(value);
    if ( id != i64UNDEF){
        ESPIlwisObject obj =  mastercatalog()->get(id);
        if ( obj.get() != 0)
            return obj->ilwisType();
    }
    tp = Domain::ilwType(value);

    return tp == itUNKNOWN ? itSTRING : tp;

}
IlwisTypes Parameter::determineType(const QString& value, const SymbolTable &symtab) {
    bool ok;
    value.toDouble(&ok);
    if ( ok)
        return itNUMBER;

    kernel()->issues()->silent(true);  // suppress error messages during probe of value

    QString unquotedValue = OperationHelper::unquote(value);
    IlwisTypes tp = IlwisObject::findType(unquotedValue);
    if ( value == "\"?\"" || value == "?")
        tp = itANY;

    if ( tp != itUNKNOWN) {
        kernel()->issues()->silent(false);
        return tp;
    }

    Symbol sym = symtab.getSymbol(unquotedValue);
    if ( sym.isValid() && sym._type != itUNKNOWN) {
        kernel()->issues()->silent(false);
        return sym._type;
    }

    QString s = context()->workingCatalog()->resolve(unquotedValue);
    IlwisTypes type = IlwisObject::findType(s) ;
    if ( type != itUNKNOWN) {
        kernel()->issues()->silent(false);
        return type;
    }

    quint64 id = IlwisObject::internalname2id(unquotedValue);
    if ( id != i64UNDEF){
        ESPIlwisObject obj =  mastercatalog()->get(id);
        if ( obj.get() != 0) {
            kernel()->issues()->silent(false);
            return obj->ilwisType();
        }
    }
    tp = Domain::ilwType(unquotedValue);
    kernel()->issues()->silent(false);
    return tp == itUNKNOWN ? itSTRING : tp;
}
Exemple #3
0
quint64 IlwisObject::internalname2id(const QString &name, bool resolve)
{
    int index = 0;
    QString sid = sUNDEF;
    if ( (index = name.indexOf(NAME_ALIAS)) != -1) {
        sid = name.mid(index + SZ_NAME_ALIAS);
    }
    else if ( (index = name.indexOf(ANONYMOUS_PREFIX)) != -1) { // internal objects are not in the catalog
        sid = name.mid(index + SZ_ANONYMOUS_PREFIX);
    }
    bool ok;
    quint64 id = sid.toLongLong(&ok);
    if (ok){
        if (!resolve)
            return id;
        ESPIlwisObject data = mastercatalog()->get(id);
        if ( data.get() != 0) {
            return data->id();
        }
    }
    return i64UNDEF;

}