本文整理汇总了C++中ParameterMap::find方法的典型用法代码示例。如果您正苦于以下问题:C++ ParameterMap::find方法的具体用法?C++ ParameterMap::find怎么用?C++ ParameterMap::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterMap
的用法示例。
在下文中一共展示了ParameterMap::find方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Epic::AudioParameter& operator [] (Epic::StringHash id)
{
auto it = m_Params.find(id);
if (it == std::end(m_Params))
return s_NullParameter;
return *(*it).second;
}
示例2: ParseValue
// Called to parse a RCSS keyword declaration.
bool PropertyParserKeyword::ParseValue(Property& property, const String& value, const ParameterMap& parameters) const
{
ParameterMap::const_iterator iterator = parameters.find(value);
if (iterator == parameters.end())
return false;
property.value = Variant((*iterator).second);
property.unit = Property::KEYWORD;
return true;
}
示例3: setParameters
void OutputFormat::setParameters(const std::string& outDir,
const ParameterMap& formatParams)
{
m_outDir = outDir;
m_params.clear();
ParameterDescriptorList pList = getParameters();
for (ParameterDescriptorList::iterator it=pList.begin();
it!=pList.end(); it++) {
ParameterMap::const_iterator pIt = formatParams.find(it->m_identifier);
if (pIt!=formatParams.end()) {
m_params[it->m_identifier] = pIt->second;
} else {
m_params[it->m_identifier] = it->m_defaultValue;
}
}
}
示例4: getStringParam
std::string Component::getStringParam(const std::string& id, const ParameterMap& params)
{
ParameterMap::const_iterator it=params.find(id);
if (it!=params.end()) {
if (it->second.size()==0) {
cerr << "ERROR: parameter " << id << " is empty !" << endl;
return EMPTY_STRING;
}
return it->second;
}
ParameterDescriptorList pList = getParameterDescriptorList();
for (ParameterDescriptorList::const_iterator descIt=pList.begin();
descIt!=pList.end(); descIt++)
{
if (descIt->m_identifier==id)
return descIt->m_defaultValue;
}
cerr << "ERROR: no parameter " << id << " for component " << getIdentifier() << " !" << endl;
return EMPTY_STRING;
}
示例5: loadAnimation
EmptyAnimationPtr Object::loadAnimation(const ParameterMap& parameters) {
double scale_factor=1;
BasePointType bp_type=BP_MD;
Uint16 animation_type=ATYPE_LOOP;
double fps=0;
AllignType allign_type=AT_MD;
if (hasParam(parameters,"scale")) {
if (parameters.find("scale")->second == "lvl") scale_factor=config.lvlscale;
else scale_factor=atof(parameters.find("scale")->second.c_str());
}
if (hasParam(parameters,"bp_type")) {
if (parameters.find("bp_type")->second.find("hleft") !=string::npos) {
if (parameters.find("bp_type")->second.find("vup") !=string::npos) bp_type=BP_LU;
else if (parameters.find("bp_type")->second.find("vmiddle") !=string::npos) bp_type=BP_LM;
else if (parameters.find("bp_type")->second.find("vdown") !=string::npos) bp_type=BP_LD;
} else if (parameters.find("bp_type")->second.find("hmiddle") !=string::npos) {
if (parameters.find("bp_type")->second.find("vup") !=string::npos) bp_type=BP_MU;
else if (parameters.find("bp_type")->second.find("vmiddle") !=string::npos) bp_type=BP_MM;
else if (parameters.find("bp_type")->second.find("vdown") !=string::npos) bp_type=BP_MD;
} else if (parameters.find("bp_type")->second.find("hright") !=string::npos) {
if (parameters.find("bp_type")->second.find("vup") !=string::npos) bp_type=BP_RU;
else if (parameters.find("bp_type")->second.find("vmiddle") !=string::npos) bp_type=BP_RM;
else if (parameters.find("bp_type")->second.find("vdown") !=string::npos) bp_type=BP_RD;
}
}
if (hasParam(parameters,"type")) {
animation_type=NOTHING;
if (parameters.find("type")->second.find("once") !=string::npos) animation_type|=ATYPE_ONCE;
if (parameters.find("type")->second.find("loop") !=string::npos) animation_type|=ATYPE_LOOP;
if (parameters.find("type")->second.find("swing") !=string::npos) animation_type|=ATYPE_SWING;
if (parameters.find("type")->second.find("step") !=string::npos) animation_type|=ATYPE_STEP;
if (parameters.find("type")->second.find("reverse") !=string::npos) animation_type<<=1;
if (animation_type==NOTHING) animation_type=ATYPE_LOOP;
if (parameters.find("type")->second.find("switch") !=string::npos) animation_type|=ATYPE_ST_SWITCH;
}
if (hasParam(parameters,"fps")) fps=atof(parameters.find("fps")->second.c_str());
if (hasParam(parameters,"allign_type")) {
if (parameters.find("allign_type")->second.find("hleft") !=string::npos) {
if (parameters.find("allign_type")->second.find("vup") !=string::npos) allign_type=AT_LU;
else if (parameters.find("allign_type")->second.find("vmiddle") !=string::npos) allign_type=AT_LM;
else if (parameters.find("allign_type")->second.find("vdown") !=string::npos) allign_type=AT_LD;
} else if (parameters.find("allign_type")->second.find("hmiddle") !=string::npos) {
if (parameters.find("allign_type")->second.find("vup") !=string::npos) allign_type=AT_MU;
else if (parameters.find("allign_type")->second.find("vmiddle") !=string::npos) allign_type=AT_MM;
else if (parameters.find("allign_type")->second.find("vdown") !=string::npos) allign_type=AT_MD;
} else if (parameters.find("allign_type")->second.find("hright") !=string::npos) {
if (parameters.find("allign_type")->second.find("vup") !=string::npos) allign_type=AT_RU;
else if (parameters.find("allign_type")->second.find("vmiddle") !=string::npos) allign_type=AT_RM;
else if (parameters.find("allign_type")->second.find("vdown") !=string::npos) allign_type=AT_RD;
}
}
/* Use animation name */
if (hasParam(parameters,"name")) {
string anim_name=parameters.find("name")->second;
return loadAnimation(anim_name,scale_factor,bp_type,animation_type,fps,allign_type);
/* Use a base image */
} else if (hasParam(parameters,"image")) {
string image_name=parameters.find("image")->second;
Uint16 frames=1;
Uint16 start_pos=0;
if (hasParam(parameters,"frames")) frames=atoi(parameters.find("frames")->second.c_str());
if (hasParam(parameters,"start_pos")) start_pos=atoi(parameters.find("start_pos")->second.c_str());
/* threat as horizontal animation (constant width, height) with <image_hor_frames> frames */
if (hasParam(parameters,"image_hor_frames")) {
Uint16 image_hor_frames=atoi(parameters.find("image_hor_frames")->second.c_str());
return loadAnimation(scenario->imgcache->loadImage(image_hor_frames,image_name,scale_factor),frames,bp_type,animation_type,fps,start_pos,allign_type);
/* threat as horizontal animation (constant width, height) with width <image_hor_width> and an optional shift */
} else if (hasParam(parameters,"image_hor_width")) {
Uint16 image_hor_width=atoi(parameters.find("image_hor_width")->second.c_str());
Uint16 image_hor_shift=0;
if (hasParam(parameters,"image_hor_shift")) image_hor_shift=atoi(parameters.find("image_hor_shift")->second.c_str());
return loadAnimation(scenario->imgcache->loadImage(image_hor_width,image_hor_shift,image_name,scale_factor),frames,bp_type,animation_type,fps,start_pos,allign_type);
/* threat as constant width/height animation based on a base rectangle */
} else if (hasParam(parameters,"image_rect")) {
ParameterMap rect_param=getParameters(parameters.find("image_rect")->second,';');
SDL_Rect rect;
rect.x=rect.y=0;
rect.w=rect.h=10;
if (hasParam(rect_param,"x")) rect.x=atoi(rect_param.find("x")->second.c_str());
if (hasParam(rect_param,"y")) rect.y=atoi(rect_param.find("y")->second.c_str());
if (hasParam(rect_param,"w")) rect.w=atoi(rect_param.find("w")->second.c_str());
if (hasParam(rect_param,"h")) rect.h=atoi(rect_param.find("h")->second.c_str());
return loadAnimation(scenario->imgcache->loadImage(rect,image_name,scale_factor),frames,bp_type,animation_type,fps,start_pos,allign_type);
/* get informations from an image description file */
} else {
string image_desc=image_name+".dsc";
if (hasParam(parameters,"image_desc")) image_desc=parameters.find("image_desc")->second;
return loadAnimation(scenario->imgcache->loadImage(image_name,scale_factor,image_desc),frames,bp_type,animation_type,fps,start_pos,allign_type);
}
/* no suitable animation found */
} else {
//.........这里部分代码省略.........