本文整理汇总了C++中ParameterMap::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ ParameterMap::empty方法的具体用法?C++ ParameterMap::empty怎么用?C++ ParameterMap::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterMap
的用法示例。
在下文中一共展示了ParameterMap::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadMapBuf
int Scenario::loadMapBuf(string mapn) {
mapname=mapn;
ifstream mapfile;
string tmpline;
string loadfile=config.datadir+mapname;
mapfile.open(loadfile.c_str());
if (mapfile) {
cout << "Loading new map: " << loadfile << endl;
} else {
cout << "Map loading failed: " << loadfile << " not found!\n";
return 2;
}
mapbuf.clear();
/* We parse the parameters to add a name if it was missing
This whole file reading looks much more complicated because
of this (otherwise there would only be mapbuf.push_back(tmpline) */
string cname;
Uint16 x,y;
ParameterMap parameters;
bool header=true;
std::map<string,Uint16> namecount;
while (getline(mapfile,tmpline)) {
if (header) {
mapbuf.push_back(tmpline);
std::istringstream tmpstream(tmpline);
tmpstream >> cname;
if (cname[0]=='#') {
if (cname=="#ENDHEADER") header=false;
continue;
}
} else {
cname.erase();
x=y=0;
std::istringstream tmpstream(tmpline);
tmpstream >> cname >> x >> y;
if (cname.empty() || cname[0]=='#') {
mapbuf.push_back(tmpline);
continue;
} else {
namecount[cname]++;
}
string parameterlist((istreambuf_iterator<char>(tmpstream)), istreambuf_iterator<char>());
parameters=getParameters(parameterlist);
if (!hasParam(parameters,"name")) {
if (parameters.empty()) tmpline+=" name="+cname+itos(namecount[cname]);
else tmpline+=", name="+cname+itos(namecount[cname]);
}
mapbuf.push_back(tmpline);
}
}