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


C++ Params类代码示例

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


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

示例1: setAllPWM

Blob CCanPWMActor::setAllPWM(SDeviceDescription device, Blob params) {
    Params values = params[BLOB_ACTION_PARAMETER].get<Params>();
    Blob b;
    string response;
    CCanBuffer buffer;
    if (values.size() == 0) {
        response = "PWMActor->setAllPWM->Incorrect params";
        log->error(response);
        b[BLOB_TXT_RESPONSE_RESULT].put<string>(response);
        return b;
    }
    buffer.insertCommand(CMD_SET_PWM_ALL);
    buffer.insertId((unsigned char) getDeviceCategory());
    buffer << (unsigned char) getAddress(device);
    for (unsigned char val : values) {
        buffer << (unsigned char) (val);
    }
    buffer.buildBuffer();
    response = (getProtocol()->send(buffer)) ? "OK" : "PWMActor->setAllPWM->Sending CAN frame failed";

    b[BLOB_TXT_RESPONSE_RESULT].put<string>(response);

    return b;
}
开发者ID:jezierski,项目名称:homesys,代码行数:24,代码来源:CCanPWMActor.cpp

示例2: onLoadParams

void SetInkTypeCommand::onLoadParams(const Params& params)
{
  std::string typeStr = params.get("type");
  if (typeStr == "simple")
    m_type = tools::InkType::SIMPLE;
  else if (typeStr == "alpha-compositing")
    m_type = tools::InkType::ALPHA_COMPOSITING;
  else if (typeStr == "copy-color")
    m_type = tools::InkType::COPY_COLOR;
  else if (typeStr == "lock-alpha")
    m_type = tools::InkType::LOCK_ALPHA;
  else if (typeStr == "shading")
    m_type = tools::InkType::SHADING;
  else
    m_type = tools::InkType::DEFAULT;
}
开发者ID:4144,项目名称:aseprite,代码行数:16,代码来源:cmd_set_ink_type.cpp

示例3: drawConfidenceEllipse

  void drawConfidenceEllipse(const double &cx, const double &cy,
                             const double &sxx, const double &sxy, const double &syy,
                             const double &K, Params params)
  {
	  Vec2d vc = {cx, cy};
	  Vec4d vcov = { sxx, sxy, sxy, syy };
      Params msg;
      msg["action"] = "draw";
      msg["figure"] = params.pop("figure",current_fig);
      msg["shape"] = (params, "type", "ellipse",
                              "center", vc,
                              "covariance", vcov,
                              "sigma", K);

      fputs(Value(msg).toJSONString().append("\n\n").c_str(), channel);
      fflush(channel);
  }
开发者ID:DNLD2017,项目名称:turret_control,代码行数:17,代码来源:vibes.cpp

示例4: Handle

/** Handle /MODULES
 */
CmdResult CommandModules::Handle(User* user, const Params& parameters)
{
	// Don't ask remote servers about their modules unless the local user asking is an oper
	// 2.0 asks anyway, so let's handle that the same way
	bool for_us = (parameters.empty() || irc::equals(parameters[0], ServerInstance->Config->ServerName));
	if ((!for_us) || (!IS_LOCAL(user)))
	{
		if (!user->IsOper())
		{
			user->WriteNotice("*** You cannot check what modules other servers have loaded.");
			return CMD_FAILURE;
		}

		// From an oper and not for us, forward
		if (!for_us)
			return CMD_SUCCESS;
	}

	const ModuleManager::ModuleMap& mods = ServerInstance->Modules.GetModules();

  	for (ModuleManager::ModuleMap::const_iterator i = mods.begin(); i != mods.end(); ++i)
	{
		Module* m = i->second;
		Version V = m->GetVersion();

		if (IS_LOCAL(user) && user->HasPrivPermission("servers/auspex"))
		{
			std::string flags("VCO");
			size_t pos = 0;
			for (int mult = 2; mult <= VF_OPTCOMMON; mult *= 2, ++pos)
				if (!(V.Flags & mult))
					flags[pos] = '-';

			std::string srcrev = m->ModuleDLLManager->GetVersion();
			user->WriteRemoteNumeric(RPL_MODLIST, m->ModuleSourceFile, srcrev.empty() ? "*" : srcrev, flags, V.description);
		}
		else
		{
			user->WriteRemoteNumeric(RPL_MODLIST, m->ModuleSourceFile, '*', '*', V.description);
		}
	}
	user->WriteRemoteNumeric(RPL_ENDOFMODLIST, "End of MODULES list");

	return CMD_SUCCESS;
}
开发者ID:Adam-,项目名称:inspircd,代码行数:47,代码来源:cmd_modules.cpp

示例5: drawPie

  void drawPie(const double &cx, const double &cy, const double &r_min, const double &r_max, 
                  const double &theta_min, const double &theta_max, Params params)
  {
      // Angle need to be in degree
      Params msg;
      Vec2d cxy = { cx, cy };
      Vec2d rMinMax = { r_min, r_max };
      Vec2d thetaMinMax = { theta_min, theta_max };
      msg["action"] = "draw";
      msg["figure"] = params.pop("figure",current_fig);
      msg["shape"] = (params, "type", "pie",
                              "center", cxy,
                              "rho", rMinMax,
                              "theta", thetaMinMax);

      fputs(Value(msg).toJSONString().append("\n\n").c_str(), channel);
      fflush(channel);
  }  
开发者ID:DNLD2017,项目名称:turret_control,代码行数:18,代码来源:vibes.cpp

示例6: sendJson

void JsonApiHandlerHttp::sendJson(const Json &json)
{
    string data = json.dump();

    Params headers;
    headers.Add("Connection", "Close");
    headers.Add("Cache-Control", "no-cache, must-revalidate");
    headers.Add("Expires", "Mon, 26 Jul 1997 05:00:00 GMT");
    headers.Add("Content-Type", "application/json");
    headers.Add("Content-Length", Utils::to_string(data.size()));
    string res = httpClient->buildHttpResponse(HTTP_200, headers, data);
    sendData.emit(res);
}
开发者ID:kamibo,项目名称:calaos_base,代码行数:13,代码来源:JsonApiHandlerHttp.cpp

示例7: drawSector

  void drawSector(const double &cx, const double &cy, const double &a, const double &b, 
                  const double &startAngle, const double &endAngle, Params params)
  {
      // Angle need to be in degree
      Params msg;
      Vec2d cxy={ cx, cy };
      Vec2d cab = { a, b };
      Vec2d startEnd = { startAngle, endAngle };
      msg["action"] = "draw";
      msg["figure"] = params.pop("figure",current_fig);      
      msg["shape"] = (params, "type", "ellipse",
                              "center", cxy,
                              "axis", cab,
                              "orientation", 0,
                              "angles", startEnd);

      fputs(Value(msg).toJSONString().append("\n\n").c_str(), channel);
      fflush(channel);
  }
开发者ID:DNLD2017,项目名称:turret_control,代码行数:19,代码来源:vibes.cpp

示例8: pbrtShape

void pbrtShape(std::string const& name, Params const& params) {
    if (name == "plymesh") {
        auto filename = params.getString("string filename");
        auto cached = PBRTState::cachedShapes.find(pbrtPath + filename);
        std::shared_ptr<Shape const> shape;
        if (cached != PBRTState::cachedShapes.end()) {
            shape = cached->second;
        } else {
            shape = readply(pbrtPath + filename);
            PBRTState::cachedShapes[pbrtPath + filename] = shape;
        }

        PBRTState::objectStack.top().second.instances.push_back(
            Instance{shape, PBRTState::materialStack.top(),
                     PBRTState::transforms.top().start});
    } else {
        std::cout << "Unrecognized Shape: " << name << std::endl;
    }
}
开发者ID:jtalbot,项目名称:fungi,代码行数:19,代码来源:pbrt.cpp

示例9: GetParameters

bool CGUIIncludes::GetParameters(const TiXmlElement *include, const char *valueAttribute, Params& params)
{
  bool foundAny = false;

  // collect parameters from include tag
  // <include name="MyControl">
  //   <param name="posx" value="225" /> <!-- comments and other tags are ignored here -->
  //   <param name="posy">150</param>
  //   ...
  // </include>

  if (include)
  {
    const TiXmlElement *param = include->FirstChildElement("param");
    foundAny = param != NULL;  // doesn't matter if param isn't entirely valid
    while (param)
    {
      std::string paramName = XMLUtils::GetAttribute(param, "name");
      if (!paramName.empty())
      {
        std::string paramValue;

        // <param name="posx" value="120" />
        const char *value = param->Attribute(valueAttribute);         // try attribute first
        if (value)
          paramValue = value;
        else
        {
          // <param name="posx">120</param>
          const TiXmlNode *child = param->FirstChild();
          if (child && child->Type() == TiXmlNode::TINYXML_TEXT)
            paramValue = child->ValueStr();                           // and then tag value
        }

        params.insert({ paramName, paramValue });                     // no overwrites
      }
      param = param->NextSiblingElement("param");
    }
  }

  return foundAny;
}
开发者ID:AchimTuran,项目名称:xbmc,代码行数:42,代码来源:GUIIncludes.cpp

示例10: drawArrow

  void drawArrow(const double &xA, const double &yA, const double &xB, const double &yB, const double &tip_length, Params params)
  {
     // Reshape A and B into a vector of points
     std::vector<Value> points;
	 Vec2d va = { xA, yA };
	 Vec2d vb = { xB, yB };
     points.push_back(va);
     points.push_back(vb);

     // Send message
     Params msg;
     msg["action"] = "draw";
     msg["figure"] = params.pop("figure",current_fig);
     msg["shape"] = (params, "type", "arrow",
                             "points", points,
                             "tip_length", tip_length);

     fputs(Value(msg).toJSONString().append("\n\n").c_str(), channel);
     fflush(channel);
  }
开发者ID:DNLD2017,项目名称:turret_control,代码行数:20,代码来源:vibes.cpp

示例11: Handle

	CmdResult Handle(User* user, const Params& parameters) override
	{
		User* dest = ServerInstance->FindNick(parameters[1]);
		Channel* channel = ServerInstance->FindChan(parameters[0]);

		if ((dest) && (dest->registered == REG_ALL) && (channel))
		{
			const std::string& reason = (parameters.size() > 2) ? parameters[2] : dest->nick;

			if (dest->server->IsULine())
			{
				user->WriteNumeric(ERR_NOPRIVILEGES, "Cannot use an SA command on a U-lined client");
				return CMD_FAILURE;
			}

			if (!channel->HasUser(dest))
			{
				user->WriteNotice("*** " + dest->nick + " is not on " + channel->name);
				return CMD_FAILURE;
			}

			/* For local clients, directly kick them. For remote clients,
			 * just return CMD_SUCCESS knowing the protocol module will route the SAKICK to the user's
			 * local server and that will kick them instead.
			 */
			if (IS_LOCAL(dest))
			{
				// Target is on this server, kick them and send the snotice
				channel->KickUser(ServerInstance->FakeClient, dest, reason);
				ServerInstance->SNO.WriteGlobalSno('a', user->nick + " SAKICKed " + dest->nick + " on " + channel->name);
			}

			return CMD_SUCCESS;
		}
		else
		{
			user->WriteNotice("*** Invalid nickname or channel");
		}

		return CMD_FAILURE;
	}
开发者ID:Adam-,项目名称:inspircd,代码行数:41,代码来源:m_sakick.cpp

示例12: llmax

LLNetMap::LLNetMap (const Params & p)
:	LLUICtrl (p),
	mBackgroundColor (p.bg_color()),
	mScale( MAP_SCALE_MID ),
	mPixelsPerMeter( MAP_SCALE_MID / REGION_WIDTH_METERS ),
	mObjectMapTPM(0.f),
	mObjectMapPixels(0.f),
	mTargetPanX(0.f),
	mTargetPanY(0.f),
	mCurPanX(0.f),
	mCurPanY(0.f),
	mUpdateNow(FALSE),
	mObjectImageCenterGlobal( gAgent.getCameraPositionGlobal() ),
	mObjectRawImagep(),
	mObjectImagep(),
	mClosestAgentToCursor(),
	mClosestAgentAtLastRightClick(),
	mToolTipMsg()
{
	mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);
}
开发者ID:Xara,项目名称:Opensource-V2-SL-Viewer,代码行数:21,代码来源:llnetmap.cpp

示例13: _AddParam

void CFunctionConfig::_AddParam(ParserEnv* e, const Params& params)
{
	for (euint i = 0; i < params.size(); i++)
	{
		const xhn::pair<xhn::string, ValueType>& p = params[i];
		SymbolValue type;
		switch (p.second)
		{
		case IntValue:
			type = IntTypeSym();
			break;
		case FloatValue:
			type = FloatTypeSym();
			break;
		default:
			return;
		}
		SymbolValue* sv = ParserEnv_new_unknown_symbol(e, p.first.c_str());
		AddParam(e, *sv, type);
	}
}
开发者ID:rodrigobmg,项目名称:v-engine,代码行数:21,代码来源:vlang.cpp

示例14: saveFile

void DefaultCliDelegate::saveFile(Context* ctx, const CliOpenFile& cof)
{
  Command* saveAsCommand = Commands::instance()->byId(CommandId::SaveFileCopyAs());
  Params params;
  params.set("filename", cof.filename.c_str());
  params.set("filename-format", cof.filenameFormat.c_str());

  if (cof.hasFrameTag()) {
    params.set("frame-tag", cof.frameTag.c_str());
  }
  if (cof.hasFrameRange()) {
    params.set("from-frame", base::convert_to<std::string>(cof.fromFrame).c_str());
    params.set("to-frame", base::convert_to<std::string>(cof.toFrame).c_str());
  }
  if (cof.hasSlice()) {
    params.set("slice", cof.slice.c_str());
  }

  if (cof.ignoreEmpty)
    params.set("ignoreEmpty", "true");

  ctx->executeCommand(saveAsCommand, params);
}
开发者ID:aseprite,项目名称:aseprite,代码行数:23,代码来源:default_cli_delegate.cpp

示例15: onLoadParams

void SaveFileBaseCommand::onLoadParams(const Params& params)
{
  m_filename = params.get("filename");
  m_filenameFormat = params.get("filename-format");
  m_frameTag = params.get("frame-tag");
  m_aniDir = params.get("ani-dir");
  m_slice = params.get("slice");

  if (params.has_param("from-frame") ||
      params.has_param("to-frame")) {
    doc::frame_t fromFrame = params.get_as<doc::frame_t>("from-frame");
    doc::frame_t toFrame = params.get_as<doc::frame_t>("to-frame");
    m_selFrames.insert(fromFrame, toFrame);
    m_adjustFramesByFrameTag = true;
  }
  else {
    m_selFrames.clear();
    m_adjustFramesByFrameTag = false;
  }
}
开发者ID:imeteora,项目名称:aseprite,代码行数:20,代码来源:cmd_save_file.cpp


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