本文整理汇总了C++中ParamMap::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ ParamMap::empty方法的具体用法?C++ ParamMap::empty怎么用?C++ ParamMap::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParamMap
的用法示例。
在下文中一共展示了ParamMap::empty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsDefaultParam
bool LuaFeatureDefs::IsDefaultParam(const string& word)
{
if (paramMap.empty()) {
InitParamMap();
}
return (paramMap.find(word) != paramMap.end());
}
示例2: PushEntries
bool LuaFeatureDefs::PushEntries(lua_State* L)
{
if (paramMap.empty()) {
InitParamMap();
}
const map<string, const FeatureDef*>& featureDefs =
featureHandler->GetFeatureDefs();
map<string, const FeatureDef*>::const_iterator fdIt;
for (fdIt = featureDefs.begin(); fdIt != featureDefs.end(); ++fdIt) {
const FeatureDef* fd = fdIt->second;
if (fd == NULL) {
continue;
}
lua_pushnumber(L, fd->id);
lua_newtable(L); { // the proxy table
lua_newtable(L); { // the metatable
HSTR_PUSH(L, "__index");
lua_pushlightuserdata(L, (void*)fd);
lua_pushcclosure(L, FeatureDefIndex, 1);
lua_rawset(L, -3); // closure
HSTR_PUSH(L, "__newindex");
lua_pushlightuserdata(L, (void*)fd);
lua_pushcclosure(L, FeatureDefNewIndex, 1);
lua_rawset(L, -3);
HSTR_PUSH(L, "__metatable");
lua_pushlightuserdata(L, (void*)fd);
lua_pushcclosure(L, FeatureDefMetatable, 1);
lua_rawset(L, -3);
}
lua_setmetatable(L, -2);
}
HSTR_PUSH(L, "pairs");
lua_pushcfunction(L, Pairs);
lua_rawset(L, -3);
HSTR_PUSH(L, "next");
lua_pushcfunction(L, Next);
lua_rawset(L, -3);
lua_rawset(L, -3); // proxy table into FeatureDefs
}
return true;
}
示例3: PushEntries
bool LuaWeaponDefs::PushEntries(lua_State* L)
{
if (paramMap.empty()) {
InitParamMap();
}
const map<string, int>& weaponMap = weaponDefHandler->weaponID;
map<string, int>::const_iterator wit;
for (wit = weaponMap.begin(); wit != weaponMap.end(); ++wit) {
const WeaponDef* wd = &weaponDefHandler->weaponDefs[wit->second];
if (wd == NULL) {
continue;
}
lua_pushnumber(L, wd->id);
lua_newtable(L); { // the proxy table
lua_newtable(L); { // the metatable
HSTR_PUSH(L, "__index");
lua_pushlightuserdata(L, (void*)wd);
lua_pushcclosure(L, WeaponDefIndex, 1);
lua_rawset(L, -3); // closure
HSTR_PUSH(L, "__newindex");
lua_pushlightuserdata(L, (void*)wd);
lua_pushcclosure(L, WeaponDefNewIndex, 1);
lua_rawset(L, -3);
HSTR_PUSH(L, "__metatable");
lua_pushlightuserdata(L, (void*)wd);
lua_pushcclosure(L, WeaponDefMetatable, 1);
lua_rawset(L, -3);
}
lua_setmetatable(L, -2);
}
HSTR_PUSH(L, "pairs");
lua_pushcfunction(L, Pairs);
lua_rawset(L, -3);
HSTR_PUSH(L, "next");
lua_pushcfunction(L, Next);
lua_rawset(L, -3);
lua_rawset(L, -3); // proxy table into WeaponDefs
}
return true;
}
示例4: PushEntries
bool LuaUnitDefs::PushEntries(lua_State* L)
{
if (paramMap.empty()) {
InitParamMap();
}
const map<string, int>& udMap = unitDefHandler->unitDefIDsByName;
map<string, int>::const_iterator udIt;
for (udIt = udMap.begin(); udIt != udMap.end(); ++udIt) {
const UnitDef* ud = unitDefHandler->GetUnitDefByID(udIt->second);
if (ud == NULL) {
continue;
}
lua_pushnumber(L, ud->id);
lua_newtable(L); { // the proxy table
lua_newtable(L); { // the metatable
HSTR_PUSH(L, "__index");
lua_pushlightuserdata(L, (void*)ud);
lua_pushcclosure(L, UnitDefIndex, 1);
lua_rawset(L, -3); // closure
HSTR_PUSH(L, "__newindex");
lua_pushlightuserdata(L, (void*)ud);
lua_pushcclosure(L, UnitDefNewIndex, 1);
lua_rawset(L, -3);
HSTR_PUSH(L, "__metatable");
lua_pushlightuserdata(L, (void*)ud);
lua_pushcclosure(L, UnitDefMetatable, 1);
lua_rawset(L, -3);
}
lua_setmetatable(L, -2);
}
HSTR_PUSH(L, "pairs");
lua_pushcfunction(L, Pairs);
lua_rawset(L, -3);
HSTR_PUSH(L, "next");
lua_pushcfunction(L, Next);
lua_rawset(L, -3);
lua_rawset(L, -3); // proxy table into UnitDefs
}
return true;
}
示例5: PushEntries
bool LuaFeatureDefs::PushEntries(lua_State* L)
{
if (paramMap.empty()) {
InitParamMap();
}
lua_newtable(L); { // the metatable
HSTR_PUSH_CFUNC(L, "__index", FeatureDefTableIndex);
HSTR_PUSH_CFUNC(L, "__newindex", FeatureDefTableNewIndex);
HSTR_PUSH_CFUNC(L, "__metatable", FeatureDefTableMetatable);
}
lua_setmetatable(L, -2);
return true;
}