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


C++ Place类代码示例

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


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

示例1: QVariant

QVariant
PlaceListModel::data (const QModelIndex &index, int role) const
{
  int idx = index.row ();
  if (idx < 0 || m_data.count () <= idx)
    return QVariant();

  Place *place = m_data[idx];

  switch (role)
  {
  case NAME:
    return place->name ();
  case PUBKEY:
    return place->pubKeyString ();
  case TYPE:
    return place->type ();
  case DESC:
    return place->desc ();
  case THREADS:
    return &m_threads[idx];
  default:
    return QVariant();
  }
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例2: addTransition

Place* PNP::addTimedAction(string name, Place *p0, int timevalue, Place **p0action) {

    // fork transition
    Transition *tf = addTransition("[]"); tf->setX(p0->getX()+1); tf->setY(p0->getY());
    connect(p0,tf);

    // initial places of actions
    Place *pi1 = addPlace("X",-1); pi1->setX(tf->getX()+1); pi1->setY(tf->getY()-1);
    connect(tf,pi1);
    Place *pf1 = addAction(name,pi1);

    // actions
    Place *pi2 = addPlace("X",-1); pi2->setX(tf->getX()+1); pi2->setY(tf->getY()+1);
    connect(tf,pi2);
    stringstream ss; ss << "wait_" << timevalue;
    Place *pf2 = addAction(ss.str(),pi2);

    // join transition
    Transition *tj = addTransition("[]"); tj->setX(pf1->getX()+1); tj->setY(pf1->getY()+1);
    connect(pf1,tj); connect(pf2,tj);

    // interrupt
    Transition *ti = addTransition(name+".interrupt []"); ti->setX(tj->getX()); ti->setY(tj->getY()+1);
    connect(next(next(pi1)),ti); connect(pf2,ti);


    // final place
    Place *po = addPlace("X",-1); po->setX(tj->getX()+1); po->setY(tj->getY());
    connect(tj,po); connect(ti,po);

    nactions+=2;
    *p0action = pi1; // initial place of action
    return po;
}
开发者ID:cdondrup,项目名称:PetriNetPlans,代码行数:34,代码来源:pnpgenerator.cpp

示例3: getSelf

void TypeNodeCodeGen::visit(MethodCall* m)
{
    Place* self = getSelf(m);

    if ( const ScalarType* from = m->expr_->get().type_->cast<ScalarType>() )
    {
        Value* val = self->getScalar(builder_);
        const ScalarType* to = cast<ScalarType>( m->memberFct_->sig_.out_[0]->getType() );
        const llvm::Type* llvmTo = to->getLLVMType(ctxt_->module_);
        const llvm::Type* llvmFrom = from->getLLVMType(ctxt_->module_);

        if ( m->id()->find("bitcast") != std::string::npos )
            val = builder_.CreateBitCast(val, llvmTo);
        else // -> assumes that r is a normal cast
        {
            if ( llvmTo == llvmFrom )
            { 
                setResult(m, new Scalar(val));
                return;
            }

            llvm::StringRef name = val->getName();

            if ( from->isInteger() && to->isInteger() )
            {
                if ( from->sizeOf() > to->sizeOf() )
                    val = builder_.CreateTrunc(val, llvmTo, name);
                else
                {
                    // -> sizeof(from) < sizeof(to)
                    if ( from->isUnsigned() )
                        val = builder_.CreateZExt(val, llvmTo, name);
                    else
                        val = builder_.CreateSExt(val, llvmTo, name);
                }
            }
            else if ( from->isFloat() && to->isSigned() )   // fp -> si
                val = builder_.CreateFPToSI(val, llvmTo, name);
            else if ( from->isFloat() && to->isUnsigned() ) // fp -> ui
                val = builder_.CreateFPToUI(val, llvmTo, name);
            else if ( from->isSigned() && to->isFloat() )   // si -> fp
                val = builder_.CreateSIToFP(val, llvmTo, name);
            else if ( from->isUnsigned() && to->isFloat() ) // ui -> fp
                val = builder_.CreateUIToFP(val, llvmTo, name);
            else
            {
                swiftAssert( from->isFloat() && to->isFloat(), "must both be floats" );

                if ( from->sizeOf() > to->sizeOf() )
                    val = builder_.CreateFPTrunc(val, llvmTo, name);
                else // -> sizeof(from) < sizeof(to)
                    val = builder_.CreateFPExt(val, llvmTo, name);
            }
        }

        setResult( m, new Scalar(val) );
    }
    else
        emitCall(m, self);
}
开发者ID:BackupTheBerlios,项目名称:swiftc-svn,代码行数:60,代码来源:typenodecodegen.cpp

示例4: execute

   void AttackAction::execute(Player *player, Command *command, Game *game) {

      Place            *location = player->getLocation();
      BeingListCItPair beings = location->getBeingsByName(command->getDirectObject());

      if (beings.begin == beings.end) {
         player->out("display") << "There is no " << command->getDirectObject()
            << " here!" << endl;
         return;
      }

      try {

         string weaponName = command->getIndirectObject();
         Object *weapon = 0;

         Being *defender =
            Entity::clarifyEntity<BeingListCItPair, BeingListCIt, Being *>(beings,
            player);

         if (weaponName.length() > 0) {

            ObjectListCItPair items = player->getInventoryObjectsByName(weaponName);

            if (items.begin == items.end) {
               player->out("display") << "You don't have a " << weaponName << "!" << endl;
               return;
            }

            try {

               weapon =
                  Entity::clarifyEntity<ObjectListCItPair, ObjectListCIt, Object *>(items,
                  player);

               // TODO: this check should be made inside Being (we'd have an
               // exception to catch)
               if (!weapon->isWeapon()) {
                  player->out("display") << "The " << weaponName << " isn't a weapon!" << endl;
                  return;
               }
            }

            catch (string name) {
               player->out("display") << "You don't have a " << weaponName << "!" << endl;
               return;
            }
         }

         player->attack(defender, weapon);
      }

      catch (string name) {
         player->out("display") << "There is no " << name << " here!" << endl;
      }
   }
开发者ID:Ockin,项目名称:trogdor-pp,代码行数:56,代码来源:actions.cpp

示例5: Place

Place * Place::create(const QString &name, const QString &city, const QString &type,
                      QObject *parent)
{
    Place * returned = new Place(parent);
    returned->d_func()->name = name;
    returned->d_func()->city = city;
    returned->d_func()->type = typeFromString(type);
    returned->d_func()->typeString = type;
    return returned;
}
开发者ID:SfietKonstantin,项目名称:libvianavigo,代码行数:10,代码来源:place.cpp

示例6: main

int main()
{
	string input_in_form = "London";
	string input_in_Place = "Eugene";
	form_mesto z = form_mesto(input_in_form);
	Place x = Place(input_in_Place);
	x.add_place(z);
	std::ofstream ofs("save.dat", std::ios::binary);
	boost::archive::binary_oarchive oa(ofs);
	oa << x;
}
开发者ID:CCJY,项目名称:coliru,代码行数:11,代码来源:main.cpp

示例7: parseError

void SimbaNonsearchAllplacesGetResponse::parseNormalResponse() {
  parseError();
  if (responseParser->hasName("place_list")) {
  QList<Parser *> listParser = responseParser->getListObjectParser("place_list");
  Parser *parser;
  foreach (parser, listParser) {
    Place tmp;
    tmp.setParser(parser);
    tmp.parseResponse();
    placeList.append(tmp);
  }
开发者ID:jdwx-new,项目名称:TaobaoCppQtSDK,代码行数:11,代码来源:SimbaNonsearchAllplacesGetResponse.cpp

示例8:

Place::Place(const Place& place) {
	name = NULL;
	sign = NULL;
	x = 0;
	y = 0;
	if (place.name && place.sign) {
        set_place(place.get_x(), place.get_y(), place.get_name(), place.get_sign());
    } else {
        cout << "Cannot copy NULL pointer!!" << endl;
    }
}
开发者ID:D4ryus,项目名称:studium,代码行数:11,代码来源:place.cpp

示例9: new

Place* Place::create(const Vec2& pos)
{
    Place *ret = new (std::nothrow) Place();

    if (ret && ret->initWithPosition(pos)) {
        ret->autorelease();
        return ret;
    }

    CC_SAFE_DELETE(ret);
    return nullptr;
}
开发者ID:1097195326,项目名称:GameAreas,代码行数:12,代码来源:CCActionInstant.cpp

示例10: Place

Place* Place::create(const Point& pos)
{
    Place *pRet = new Place();

    if (pRet && pRet->initWithPosition(pos)) {
        pRet->autorelease();
        return pRet;
    }

    CC_SAFE_DELETE(pRet);
    return NULL;
}
开发者ID:Ben-Cortina,项目名称:GameBox,代码行数:12,代码来源:CCActionInstant.cpp

示例11: split_names

void TreeCorrelator::createPlace(std::map<std::string, std::string>& params,
                                 bool verbose) {
    bool replace = false;
    if (params["replace"] != "")
        replace = strings::to_bool(params["replace"]);

    vector<string> names = split_names(params["name"]);
    for (vector<string>::iterator it = names.begin();
         it != names.end();
         ++it) {

        if (params["type"] != "") {
            if (replace) {
                if (places_.count((*it)) != 1) {
                    stringstream ss;
                    ss << "TreeCorrelator: cannot replace Place " << (*it)
                       << ", it doesn't exist";
                    throw TreeCorrelatorException(ss.str());
                }
                delete places_[(*it)];
                if (verbose) {
                    Messenger m;
                    stringstream ss;
                    ss << "Replacing place " << (*it);
                    m.detail(ss.str(), 1);
                }
            } else {
                if (places_.count((*it)) == 1) {
                    stringstream ss;
                    ss << "TreeCorrelator: place" << (*it) << " already exists";
                    throw TreeCorrelatorException(ss.str());
                }
                if (verbose) {
                    Messenger m;
                    stringstream ss;
                    ss << "Creating place " << (*it);
                    m.detail(ss.str(), 1);
                }
            }
            Place* current = builder.create(params, verbose);
            places_[(*it)] = current;
            if (strings::to_bool(params["init"]))
                current->activate(0.0);
        }

        if (params["parent"] != "root") {
            bool coincidence = strings::to_bool(params["coincidence"]);
            addChild(params["parent"], (*it), coincidence, verbose);
        }

    }
}
开发者ID:akeeler,项目名称:pixie_scan,代码行数:52,代码来源:TreeCorrelator.cpp

示例12: RANDOM

vector<Place> PlacesManager::findRandom(unsigned int limit) {
	vector<Place> places;

	ResultSet &rs = Database::getInstance().execute("SELECT id, name FROM place ORDER BY RANDOM() LIMIT %d", limit);
	while (rs.hasNext()) {
		Place place;
		place.setId(rs.getInt(0));
		place.setName(rs.getString(1));
		places.push_back(place);
	}

	return places;
}
开发者ID:Ponup,项目名称:thiefcatcher,代码行数:13,代码来源:PlacesManager.cpp

示例13: previewPlace

  void previewPlace(Place& place)
  {
    {
      const TexMng::tex_ptr texture = texmng_.get(tex_name_l_);
      const Vec2<int>& ts = texture->size(); 

      GrpSprite obj;
      obj.size(size_.x / 2.0f, size_.y);
      obj.center(size_.x / 2.0f, size_.y / 2.0);
      obj.texture(texture);
    
      obj.uv(0, 0, ts.x, ts.y);
      obj.col(1.0, 1.0, 1.0);
      obj.draw();
      // 左側
    }
    {
      const TexMng::tex_ptr texture = texmng_.get(tex_name_r_);
      const Vec2<int>& ts = texture->size(); 

      GrpSprite obj;
      obj.size(size_.x / 2.0f, size_.y);
      obj.center(0, size_.y / 2.0);
      obj.texture(texture);
    
      obj.uv(0, 0, ts.x, ts.y);
      obj.col(1.0, 1.0, 1.0);
      obj.draw();
      // 右側
    }

    glScalef(size_.x / 2.0, size_.y / 2.0, 1.0);
    place.draw();
  }
开发者ID:limebreaker,项目名称:KONAHEN,代码行数:34,代码来源:nn_placeviewer.hpp

示例14: selectSquare

bool BoardQObjectAbstraction::selectSquare(int column, int row)
{
    bool moveAccepted = false;
    Place * tempPlace = selectedPlace;
    if(this->board != nullptr)
    {
        selectedPlace = board->getPlaceByCoord(column, row);
        if(  (tempPlace != nullptr)
           &&(tempPlace->getOccupyingPiece() != nullptr))
        {
            moveAccepted = board->movePiece(tempPlace, this->selectedPlace);
        }
        if(  (selectedPlace->getOccupyingPiece() == nullptr)
           ||(moveAccepted == true))
        {
            selectedPlace = nullptr;
        }
    }
    return moveAccepted;
}
开发者ID:MysticOdin,项目名称:MinimalChess,代码行数:20,代码来源:BoardQObjectAbstraction.cpp

示例15: getPlace

/**Operational method for the class;
 * Called to prompt the user to specificy the Place Object's attribute they wish to change, and
 * the value to set it to.
 *
 * @return	Returns a pointer to itself (this)
 */
ModifyPlacesView* ModifyPlacesView::start() {
    Place* place = getPlace(rootPlace);
    string opts[3] = {"Name", "Longitude", "Latitude"};
    OptionsView<string> view(opts, 3);
    int menuSelection = 0;

    do {
        cout << LF << "\tWhat would you like to modify?" << LF;
        switch (menuSelection = view.display()->getOption()) {
            case 0:
                place->setName(getAddress(1, "Please enter the name"));
                break;
            case 1:
                place->setLongitude(inputFloat("Please enter the longitude"));
                break;
            case 2:
                place->setLatitude(inputFloat("Please enter the latitude"));
                break;
        }
    } while (menuSelection != 3);

    return this;
}
开发者ID:ryansmith94,项目名称:WorldDistance,代码行数:29,代码来源:ModifyPlaceView.cpp


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