QVariant Table::get(int row)
{
    if ((row<0)||(row>rowCount())) return(QVariant());
    if (type==MARKETS)
    {
        return(QVariant::fromValue(new ListObject(QString(base->currentExchange->marketsLong[row].c_str()))));
    }else if (type==MENU)
    {
        if (row==0) return(QVariant::fromValue(new ListObject((base->translations[50]))));
        return(QVariant::fromValue(new ListObject((base->translations[base->menuitem[row]]))));
    }else if (type==LEVERAGE)
    {
        return(QVariant::fromValue(new ListObject((base->translations[36]+" "+to_string1(base->levs[row])))));
    }else if (type==DEPOSITCURRENCIES)
    {
        QVariantMap map;

        map["name"]=base->currentExchange->currencies[row].name.c_str();
        return(map);
    }else if (type==BALANCE)
    {
        QVariantMap map;
        vector<Currency>::iterator it;

        for(it=base->currentExchange->currencies.begin();it!=base->currentExchange->currencies.end();++it) if (row==it->type) break;
        if (it==base->currentExchange->currencies.end()) return(QVariant());
        map["name"]=it->name.c_str();
        map["value"]=formatCurr(base->currentExchange->balance.balance[it->type],it->type);
        return(map);
    }else if (type==EXCHANGES)
    {
        return(QVariant::fromValue(new ListObject((base->exchanges[row]->name.c_str()))));
    }else if (type==ORDER)
    {
        return(QVariant::fromValue(new ListObject((base->trans(row+85)))));
    }else if (type==ORDERTYPE)
    {
        if (row==0) return(QVariant::fromValue(new ListObject((base->trans(91)))));
        else return(QVariant::fromValue(new ListObject((base->trans(92)+" "+base->currentExchange->currencies[row-1].name.c_str()))));
    }else if ((type==ORDERS)||(type==OPENSWAPS))
    {
        QVariantMap map;
        QString s;

        foreach(int k, roleNames().keys()) {
            s =  data(index(row, 0), k).toString();
            map[roleNames().value(k)] = s.toLower();
        }
        return map;
    }else if (type==OPENPOSITIONS)
Example #2
0
File: main.cpp Project: CCJY/coliru
int main()
{
    A *a = new A();
    to_string1(a->SM);            // undefined reference here
    to_string1(A::F);           
}