本文整理汇总了C++中ParamList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ ParamList::begin方法的具体用法?C++ ParamList::begin怎么用?C++ ParamList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParamList
的用法示例。
在下文中一共展示了ParamList::begin方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//--------------------------------------------------------------------------------//
void Win32InputManager::_parseConfigSettings( ParamList ¶mList )
{
//Here we pick up settings such as a device's cooperation mode
std::map<std::string, DWORD> temp;
temp["DISCL_BACKGROUND"] = DISCL_BACKGROUND;
temp["DISCL_EXCLUSIVE"] = DISCL_EXCLUSIVE;
temp["DISCL_FOREGROUND"] = DISCL_FOREGROUND;
temp["DISCL_NONEXCLUSIVE"] = DISCL_NONEXCLUSIVE;
temp["DISCL_NOWINKEY"] = DISCL_NOWINKEY;
//Check for pairs: ie. ("w32_keyboard","DISCL_NOWINKEY")("w32_keyboard","DISCL_FOREGROUND")
ParamList::iterator i = paramList.begin(), e = paramList.end();
for( ; i != e; ++i )
{
if( i->first == "w32_keyboard" )
kbSettings |= temp[i->second];
else if( i->first == "w32_mouse" )
mouseSettings |= temp[i->second];
else if( i->first == "w32_joystick" )
joySettings |= temp[i->second];
}
if( kbSettings == 0 ) kbSettings = DISCL_FOREGROUND | DISCL_EXCLUSIVE;
if( mouseSettings == 0 ) mouseSettings = DISCL_FOREGROUND | DISCL_EXCLUSIVE;
if( joySettings == 0 ) joySettings = DISCL_FOREGROUND | DISCL_EXCLUSIVE;
}
示例2: if
//----------------------------------------------------------------------------
void Win32InputManager::ParseConfigSettings (ParamList ¶mList)
{
std::map<std::string, DWORD> temp;
temp["DISCL_BACKGROUND"] = DISCL_BACKGROUND;
temp["DISCL_EXCLUSIVE"] = DISCL_EXCLUSIVE;
temp["DISCL_FOREGROUND"] = DISCL_FOREGROUND;
temp["DISCL_NONEXCLUSIVE"] = DISCL_NONEXCLUSIVE;
temp["DISCL_NOWINKEY"] = DISCL_NOWINKEY;
ParamList::iterator it = paramList.begin();
for (; it!=paramList.end(); it++)
{
if (it->first == "Win32Keyboard")
{
mKeyboardSettings |= temp[it->second];
}
else if (it->first == "Win32Mouse")
{
mMouseSettings |= temp[it->second];
}
}
if (0 == mKeyboardSettings)
{
mKeyboardSettings
= DISCL_FOREGROUND | DISCL_NONEXCLUSIVE | DISCL_NOWINKEY;
}
if (0 == mMouseSettings)
{
mMouseSettings = DISCL_FOREGROUND | DISCL_NONEXCLUSIVE;
}
}
示例3: readParamsFile
RobotInterface::ParamList RobotInterface::XMLReader::Private::readParamsTag(TiXmlElement *paramsElem)
{
const std::string &valueStr = paramsElem->ValueStr();
if (valueStr.compare("params") != 0) {
SYNTAX_ERROR(paramsElem->Row()) << "Expected \"params\". Found" << valueStr;
}
std::string filename;
if (paramsElem->QueryStringAttribute("file", &filename) == TIXML_SUCCESS) {
// yDebug() << "Found params file [" << filename << "]";
#ifdef WIN32
std::replace(filename.begin(), filename.end(), '/', '\\');
filename = path + "\\" + filename;
#else // WIN32
filename = path + "/" + filename;
#endif //WIN32
return readParamsFile(filename);
}
std::string robotName;
if (paramsElem->QueryStringAttribute("robot", &robotName) != TIXML_SUCCESS) {
SYNTAX_WARNING(paramsElem->Row()) << "\"params\" element should contain the \"robot\" attribute";
}
if (robotName != robot.name()) {
SYNTAX_WARNING(paramsElem->Row()) << "Trying to import a file for the wrong robot. Found" << robotName << "instead of" << robot.name();
}
unsigned int build;
#if TINYXML_UNSIGNED_INT_BUG
if (paramsElem->QueryUnsignedAttribute("build", &build()) != TIXML_SUCCESS) {
// No build attribute. Assuming build="0"
SYNTAX_WARNING(paramsElem->Row()) << "\"params\" element should contain the \"build\" attribute [unsigned int]. Assuming 0";
}
#else
int tmp;
if (paramsElem->QueryIntAttribute("build", &tmp) != TIXML_SUCCESS || tmp < 0) {
// No build attribute. Assuming build="0"
SYNTAX_WARNING(paramsElem->Row()) << "\"params\" element should contain the \"build\" attribute [unsigned int]. Assuming 0";
tmp = 0;
}
build = (unsigned)tmp;
#endif
if (build != robot.build()) {
SYNTAX_WARNING(paramsElem->Row()) << "Import a file for a different robot build. Found" << build << "instead of" << robot.build();
}
ParamList params;
for (TiXmlElement* childElem = paramsElem->FirstChildElement(); childElem != 0; childElem = childElem->NextSiblingElement()) {
ParamList childParams = readParams(childElem);
for (ParamList::const_iterator it = childParams.begin(); it != childParams.end(); ++it) {
params.push_back(*it);
}
}
return params;
}
示例4:
void
Action::Base::set_param_list(const ParamList ¶m_list)
{
ParamList::const_iterator iter;
for(iter=param_list.begin();iter!=param_list.end();++iter)
set_param(iter->first,iter->second);
}
示例5: paramsAsProperty
yarp::os::Property paramsAsProperty() const
{
ParamList p = RobotInterface::mergeDuplicateGroups(params);
std::string s;
s += "(device " + type + ")";
for (RobotInterface::ParamList::const_iterator it = p.begin(); it != p.end(); ++it) {
const RobotInterface::Param ¶m = *it;
s += " (" + param.name() + " " + param.value() + ")";
}
return yarp::os::Property(s.c_str());
}
示例6:
RobotInterface::ParamList RobotInterface::XMLReader::Private::readParamListTag(TiXmlElement* paramListElem)
{
if (paramListElem->ValueStr().compare("paramlist") != 0) {
SYNTAX_ERROR(paramListElem->Row()) << "Expected \"paramlist\". Found" << paramListElem->ValueStr();
}
ParamList params;
Param mainparam;
if (paramListElem->QueryStringAttribute("name", &mainparam.name()) != TIXML_SUCCESS) {
SYNTAX_ERROR(paramListElem->Row()) << "\"paramlist\" element should contain the \"name\" attribute";
}
params.push_back(mainparam);
// yDebug() << "Found paramlist [" << params.at(0).name() << "]";
for (TiXmlElement* childElem = paramListElem->FirstChildElement(); childElem != 0; childElem = childElem->NextSiblingElement()) {
if (childElem->ValueStr().compare("elem") != 0) {
SYNTAX_ERROR(childElem->Row()) << "Expected \"elem\". Found" << childElem->ValueStr();
}
Param childParam;
if (childElem->QueryStringAttribute("name", &childParam.name()) != TIXML_SUCCESS) {
SYNTAX_ERROR(childElem->Row()) << "\"elem\" element should contain the \"name\" attribute";
}
const char *valueText = childElem->GetText();
if (!valueText) {
SYNTAX_ERROR(childElem->Row()) << "\"elem\" element should have a value [ \"name\" = " << childParam.name() << "]";
}
childParam.value() = valueText;
params.push_back(childParam);
}
if (params.empty()) {
SYNTAX_ERROR(paramListElem->Row()) << "\"paramlist\" cannot be empty";
}
// +1 skips the first element, that is the main param
for (ParamList::iterator it = params.begin() + 1; it != params.end(); ++it) {
Param ¶m = *it;
params.at(0).value() += (params.at(0).value().empty() ? "(" : " ") + param.name();
}
params.at(0).value() += ")";
// yDebug() << params;
return params;
}
示例7: group
RobotInterface::Param RobotInterface::XMLReader::Private::readGroupTag(TiXmlElement* groupElem)
{
if (groupElem->ValueStr().compare("group") != 0) {
SYNTAX_ERROR(groupElem->Row()) << "Expected \"group\". Found" << groupElem->ValueStr();
}
Param group(true);
if (groupElem->QueryStringAttribute("name", &group.name()) != TIXML_SUCCESS) {
SYNTAX_ERROR(groupElem->Row()) << "\"group\" element should contain the \"name\" attribute";
}
// yDebug() << "Found group [" << group.name() << "]";
ParamList params;
for (TiXmlElement* childElem = groupElem->FirstChildElement(); childElem != 0; childElem = childElem->NextSiblingElement()) {
ParamList childParams = readParams(childElem);
for (ParamList::const_iterator it = childParams.begin(); it != childParams.end(); ++it) {
params.push_back(*it);
}
}
if (params.empty()) {
SYNTAX_ERROR(groupElem->Row()) << "\"group\" cannot be empty";
}
std::string groupString;
for (ParamList::iterator it = params.begin(); it != params.end(); ++it) {
if (!groupString.empty()) {
groupString += " ";
}
groupString += "(" + it->name() + " " + it->value() + ")";
}
group.value() = groupString;
return group;
}
示例8: readDevices
RobotInterface::Robot& RobotInterface::XMLReader::Private::readRobotTag(TiXmlElement *robotElem)
{
if (robotElem->ValueStr().compare("robot") != 0) {
SYNTAX_ERROR(robotElem->Row()) << "Root element should be \"robot\". Found" << robotElem->ValueStr();
}
if (robotElem->QueryStringAttribute("name", &robot.name()) != TIXML_SUCCESS) {
SYNTAX_ERROR(robotElem->Row()) << "\"robot\" element should contain the \"name\" attribute";
}
#if TINYXML_UNSIGNED_INT_BUG
if (robotElem->QueryUnsignedAttribute("build", &robot.build()) != TIXML_SUCCESS) {
// No build attribute. Assuming build="0"
SYNTAX_WARNING(robotElem->Row()) << "\"robot\" element should contain the \"build\" attribute [unsigned int]. Assuming 0";
}
#else
int tmp;
if (robotElem->QueryIntAttribute("build", &tmp) != TIXML_SUCCESS || tmp < 0) {
// No build attribute. Assuming build="0"
SYNTAX_WARNING(robotElem->Row()) << "\"robot\" element should contain the \"build\" attribute [unsigned int]. Assuming 0";
tmp = 0;
}
robot.build() = (unsigned)tmp;
#endif
if (robotElem->QueryStringAttribute("portprefix", &robot.portprefix()) != TIXML_SUCCESS) {
SYNTAX_WARNING(robotElem->Row()) << "\"robot\" element should contain the \"portprefix\" attribute. Using \"name\" attribute";
robot.portprefix() = robot.name();
}
// yDebug() << "Found robot [" << robot.name() << "] build [" << robot.build() << "] portprefix [" << robot.portprefix() << "]";
for (TiXmlElement* childElem = robotElem->FirstChildElement(); childElem != 0; childElem = childElem->NextSiblingElement()) {
if (childElem->ValueStr().compare("device") == 0 || childElem->ValueStr().compare("devices") == 0) {
DeviceList childDevices = readDevices(childElem);
for (DeviceList::const_iterator it = childDevices.begin(); it != childDevices.end(); ++it) {
robot.devices().push_back(*it);
}
} else {
ParamList childParams = readParams(childElem);
for (ParamList::const_iterator it = childParams.begin(); it != childParams.end(); ++it) {
robot.params().push_back(*it);
}
}
}
return robot;
}
示例9:
bool
Action::ColorSet::is_candidate(const ParamList &x)
{
if (!candidate_check(get_param_vocab(), x))
return false;
std::multimap<synfig::String, Param>::const_iterator iter;
for (iter = x.begin(); iter != x.end(); ++iter)
{
if (iter->first == "value_desc" &&
iter->second.get_value_desc().get_value_type() != type_color)
return false;
}
return true;
}
示例10: matchParameters
void RecursiveDescentParser::matchParameters(FunctionEntry* fEntry, ParamList* &callerParams, Token tk) {
if(fEntry->getEntryType()!=TableEntry::FUNCTION) return;
int paramCount = 1;
ParamList* declParams = fEntry->getParamaterList();
ParamList::iterator j=callerParams->begin();
for(ParamList::iterator i=declParams->begin();
i!=declParams->end();
++i)
{
if(j==callerParams->end()) {
std::stringstream errorMsg;
errorMsg << "Function '" << fEntry->getName() << "' does not take "
<< paramCount-1 << " parameter(s)";
errorHandler(errorMsg.str(), tk);
return;
}
if((*i)->getType() != (*j)->getType()) {
std::stringstream errorMsg;
errorMsg << "Parameter " << paramCount << " should be of type "
<< (((*i)->getType()==T_INT)? "'int'" : "'char'");
errorHandler(errorMsg.str(), tk);
}
if((*i)->getAttribute() != (*j)->getAttribute()) {
std::stringstream errorMsg;
errorMsg << "Parameter " << paramCount << " should "
<< (((*i)->getAttribute()==VA_SIMPLE)? "not " : "")
<< "be an array";
errorHandler(errorMsg.str(), tk);
}
++paramCount;
++j;
}
if(j!=callerParams->end()) {
std::stringstream errorMsg;
errorMsg << "Function '" << fEntry->getName() << "' only takes "
<< declParams->size() << " parameter(s)";
errorHandler(errorMsg.str(), tk);
}
}
示例11: readParams
RobotInterface::Action RobotInterface::XMLReader::Private::readActionTag(TiXmlElement* actionElem)
{
if (actionElem->ValueStr().compare("action") != 0) {
SYNTAX_ERROR(actionElem->Row()) << "Expected \"action\". Found" << actionElem->ValueStr();
}
Action action;
if (actionElem->QueryValueAttribute<ActionPhase>("phase", &action.phase()) != TIXML_SUCCESS || action.phase() == ActionPhaseUnknown) {
SYNTAX_ERROR(actionElem->Row()) << "\"action\" element should contain the \"phase\" attribute [startup|interrupt{1,2,3}|shutdown]";
}
if (actionElem->QueryValueAttribute<ActionType>("type", &action.type()) != TIXML_SUCCESS || action.type() == ActionTypeUnknown) {
SYNTAX_ERROR(actionElem->Row()) << "\"action\" element should contain the \"type\" attribute [configure|calibrate|attach|abort|detach|park|custom]";
}
// yDebug() << "Found action [ ]";
#if TINYXML_UNSIGNED_INT_BUG
if (actionElem->QueryUnsignedAttribute("level", &action.level()) != TIXML_SUCCESS) {
SYNTAX_ERROR(actionElem->Row()) << "\"action\" element should contain the \"level\" attribute [unsigned int]";
}
#else
int tmp;
if (actionElem->QueryIntAttribute("level", &tmp) != TIXML_SUCCESS || tmp < 0) {
SYNTAX_ERROR(actionElem->Row()) << "\"action\" element should contain the \"level\" attribute [unsigned int]";
}
action.level() = (unsigned)tmp;
#endif
for (TiXmlElement* childElem = actionElem->FirstChildElement(); childElem != 0; childElem = childElem->NextSiblingElement()) {
ParamList childParams = readParams(childElem);
for (ParamList::const_iterator it = childParams.begin(); it != childParams.end(); ++it) {
action.params().push_back(*it);
}
}
// yDebug() << action;
return action;
}
示例12: readActions
RobotInterface::Device RobotInterface::XMLReader::Private::readDeviceTag(TiXmlElement *deviceElem)
{
const std::string &valueStr = deviceElem->ValueStr();
if (valueStr.compare("device") != 0) {
SYNTAX_ERROR(deviceElem->Row()) << "Expected \"device\". Found" << valueStr;
}
Device device;
if (deviceElem->QueryStringAttribute("name", &device.name()) != TIXML_SUCCESS) {
SYNTAX_ERROR(deviceElem->Row()) << "\"device\" element should contain the \"name\" attribute";
}
// yDebug() << "Found device [" << device.name() << "]";
if (deviceElem->QueryStringAttribute("type", &device.type()) != TIXML_SUCCESS) {
SYNTAX_ERROR(deviceElem->Row()) << "\"device\" element should contain the \"type\" attribute";
}
device.params().push_back(Param("robotName", robot.portprefix().c_str()));
for (TiXmlElement* childElem = deviceElem->FirstChildElement(); childElem != 0; childElem = childElem->NextSiblingElement()) {
if (childElem->ValueStr().compare("action") == 0 ||
childElem->ValueStr().compare("actions") == 0) {
ActionList childActions = readActions(childElem);
for (ActionList::const_iterator it = childActions.begin(); it != childActions.end(); ++it) {
device.actions().push_back(*it);
}
} else {
ParamList childParams = readParams(childElem);
for (ParamList::const_iterator it = childParams.begin(); it != childParams.end(); ++it) {
device.params().push_back(*it);
}
}
}
// yDebug() << device;
return device;
}