当前位置: 首页>>代码示例>>C++>>正文


C++ Style::get方法代码示例

本文整理汇总了C++中Style::get方法的典型用法代码示例。如果您正苦于以下问题:C++ Style::get方法的具体用法?C++ Style::get怎么用?C++ Style::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Style的用法示例。


在下文中一共展示了Style::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: visitElement

 // Calls appropriate visitor for given element
 void visitElement(const Element& element)
 {
     Style style = context_.styleProvider.forElement(element, context_.quadKey.levelOfDetail);
     std::stringstream ss(*style.get(builderKeyId_)->value());
     while (ss.good()) {
         std::string name;
         getline(ss, name, ',');
         element.accept(getBuilder(name));
     }
 }
开发者ID:gitter-badger,项目名称:utymap,代码行数:11,代码来源:QuadKeyBuilder.cpp

示例2: generateData

    QString FightSheet::generateData()
    {
        Style *s = new Style( object->get("style").toInt(), keeper );

        setReportFile(s->get("name").toLower() + ".html");
        setReportPath("/../share/reports/fightsheet");

        Wrestler *red = new Wrestler(object->get("red").toInt(), keeper);
        Geo *geo_r = new Geo(red->get("geo").toInt(), keeper);
        Wrestler *blue = new Wrestler(object->get("blue").toInt(), keeper);
        Geo *geo_b = new Geo(blue->get("geo").toInt(), keeper);
        Weight *wh = new Weight( object->get("weight").toInt(), keeper );

        Competition *c = new Competition(object->get("competition").toInt(), keeper);

        Mat *mat = new Mat(object->get("mat").toInt(), keeper);
        CRound *cround = new CRound(object->get("cround").toInt(), keeper);
        CTour *ctour = new CTour(object->get("ctour").toInt(), keeper);

        QDate start = QDate::fromString(c->get("start"), QString("yyyy-MM-dd"));
        QDate stop = QDate::fromString(c->get("stop"), QString("yyyy-MM-dd"));

        QString date;
        if ( start.month() == stop.month() ) {
            date = QString("%1-%2/%3/%4").arg(start.day()).arg(stop.day()).arg(start.month()).arg(start.year());
        } else {
            date = start.toString("dd/MM/yyyy") + " - " + stop.toString("dd/MM/yyyy");
        }

        vars.insert("{red.title}", red->get("title"));
        vars.insert("{red.geo}", geo_r->get("title"));
        vars.insert("{blue.title}", blue->get("title"));
        vars.insert("{blue.geo}", geo_b->get("title"));
        vars.insert("{style}", s->get("name"));
        vars.insert("{weight}", wh->get("title"));
        vars.insert("{competition}", c->get("title"));
        vars.insert("{mat}", mat->get("title"));
        vars.insert("{round}", cround->get("title"));
        vars.insert("{place}", ctour->get("title"));
        vars.insert("{num}", object->get("num"));
        vars.insert("{date}", date);

        TQueryMap opt;
        opt.insert("competition", keeper->prepareParam(Equal, c->get("id")));

        QList<QVariant> id_list;
        if ( red->get("id").toInt() > 0 )
            id_list << red->get("id");

        if ( blue->get("id").toInt() > 0 )
            id_list << blue->get("id");

        opt.insert("wrestler", keeper->prepareParam(And | InSet, id_list ));
        opt.insert("style", keeper->prepareParam(And | Equal, s->get("id")));
        opt.insert("weight", keeper->prepareParam(And | Equal, wh->get("id")));


        QList<QVariant> list = keeper->getListOfFields(OCompetitionWrestler,
                                                       QStringList() << "wrestler" << "sorder", opt);
        for( int i = 0; i < list.size(); i++)
        {
            QStringList row = list.at(i).toStringList();
            if ( red->get("id").toInt() == row.at(0).toInt() )
                vars.insert("{red.num}", row.at(1));
            if ( blue->get("id").toInt() == row.at(0).toInt() )
                vars.insert("{blue.num}", row.at(1));
        }

        delete red;
        delete geo_r;
        delete geo_b;
        delete blue;
        delete s;
        delete wh;
        delete mat;
        delete cround;
        delete ctour;
        delete c;

        return applyTemplateVars(loadTemplate(reportFile), vars);
    }
开发者ID:alexey-zayats,项目名称:melampig,代码行数:81,代码来源:fightsheet.cpp

示例3: genCompetition

    void PersonalScoreReport::genCompetition(int /*cid*/, int sid, int wid)
    {
        Weight *w = new Weight(wid, keeper);
        Style *s = new Style(sid, keeper);

        pVars.insert("{competition}", comp->get("title"));
        pVars.insert("{weight}", w->get("title"));
        pVars.insert("{style}",  s->get("name"));

        TQueryMap opts;
        opts.insert("competition", keeper->prepareParam(Equal, comp->get("id")));
        opts.insert("weight", keeper->prepareParam(And|Equal, wid));
        opts.insert("style", keeper->prepareParam(And|Equal, sid));
        opts.insert("order", QStringList() << "sorder asc" );

        QList<QVariant> cwList = keeper->getListOfFields(OCompetitionWrestler, QStringList() << "wrestler" << "sorder", opts);

        int wrestlerCount = cwList.size();

        opts.clear();
        opts.insert("num", keeper->prepareParam(Less, wrestlerCount));
        opts.insert("order", QStringList() << "num desc" );
        opts.insert("limit", 1);

        // id, num
        CTour *ct = new CTour(opts, keeper);
        int tourNum = ct->get("num").toInt();
        delete ct;

        QString fightQualify_tmpl    = loadTemplate("fight-qualify.html");
        QString fightRound_tmpl      = loadTemplate("fight-round.html");
        QString fightRoundLast_tmpl  = loadTemplate("fight-round-last.html");
        QString final_tmpl   = loadTemplate("final.html");


        int offset_num = 0;
        if ( tourNum == wrestlerCount )
            offset_num = 0;
        else
            offset_num = (tourNum*2) - wrestlerCount;

        opts.clear();
        opts.insert("num", keeper->prepareParam(Less, wrestlerCount));
        opts.insert("order", QStringList() << "num desc" );

        QList<Object*> tl = keeper->getObjectList(OCTour, opts);
        QList<Object*> tourList;
        for( int i = 0; i < tl.size(); i++ ) {
            Object *o = tl.at(i);
            if (o->get("num").toInt() > 0 ) {
                tourList.append(o);
            }
        }

        QList<QVariant> wrestlerIdList;

        QHash<QString,QString> wrestlerPosIdMap;
        QHash<QString,QString> wrestlerIdPosMap;

        for(int i = 0; i < cwList.size(); i++ ) {
            QStringList list = cwList.at(i).toStringList();

            wrestlerIdList.append( list.at(0) );
            wrestlerPosIdMap.insert( list.at(1), list.at(0) );
            wrestlerIdPosMap.insert( list.at(0), list.at(1) );
        }

        QList<Object*> wrestlerList;

        QHash<QString,Object*> wrestlerIdMap;
        QHash<QString,Object*> wrestlerNumMap;

        QHash<QString,Object*> geoMap;

        opts.clear();
        opts.insert("id", keeper->prepareParam(InSet, wrestlerIdList));
        opts.insert("order", QStringList() << "id asc" );

        wrestlerList = keeper->getObjectList(OWrestler, opts);

        QList<QVariant> geoIdList;

        for( int z = 0; z < wrestlerList.size(); z++ ) {
            Object *obj = wrestlerList.at(z);
            wrestlerIdMap.insert(obj->get("id"), obj);
            wrestlerNumMap.insert( wrestlerPosIdMap[obj->get("id")], obj);
            if ( obj->get("geo").toInt() )
                geoIdList.append(obj->get("geo"));
        }

        opts.clear();
        opts.insert("id", keeper->prepareParam(InSet, geoIdList));
        opts.insert("order", QStringList() << "id asc" );

        geoMap = keeper->getObjectMap(OGeo, "id", opts);

        opts.clear();
        opts.insert("competition", keeper->prepareParam(Equal, comp->get("id")));
        opts.insert("weight", keeper->prepareParam(And|Equal, wid));
        opts.insert("style", keeper->prepareParam(And|Equal, sid));
//.........这里部分代码省略.........
开发者ID:alexey-zayats,项目名称:melampig,代码行数:101,代码来源:personalscorereport.cpp


注:本文中的Style::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。