本文整理汇总了C++中Row::find方法的典型用法代码示例。如果您正苦于以下问题:C++ Row::find方法的具体用法?C++ Row::find怎么用?C++ Row::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Row
的用法示例。
在下文中一共展示了Row::find方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMaxAmount
int ItemManager::getMaxAmount(string itemName)
{
Row* row = DATABASE->get("item", itemName);
if (row == NULL) return 0;
return atoi(row->find("maxamount")->second.c_str());
}
示例2: getImageName
string ItemManager::getImageName(string itemName)
{
Row* row = DATABASE->get("item", itemName);
if (row == NULL) return "";
return row->find("image")->second;
}
示例3: serializeRow
Status serializeRow(const Row& r,
const ColumnNames& cols,
JSON& doc,
rj::Value& obj) {
if (cols.empty()) {
for (const auto& i : r) {
doc.addRef(i.first, i.second, obj);
}
} else {
for (const auto& c : cols) {
auto i = r.find(c);
if (i != r.end()) {
doc.addRef(c, i->second, obj);
}
}
}
return Status();
}
示例4: modify
bool Database::modify(std::string tablename, std::string keyValue, Row &object)
{
Row* row = get(tablename, keyValue);
if (row == NULL)
{
return false;
}
for (Row::iterator i = object.begin(), temp; i != object.end(); i++)
{
temp = row->find(i->first);
if (temp != row->end())
{
temp->second = i->second;
}
else
{
row->insert(make_pair(i->first, i->second));
}
}
return true;
}
示例5: createItem
Item* ItemManager::createItem(std::string itemName, int amount)
{
Item* item = NULL;
Row* row = DATABASE->get("item", itemName);
if (row == NULL) return NULL;
string imageName = row->find("image")->second;
string spriteImageName = row->find("spriteimage")->second;
ITEM_TYPE itemType = (ITEM_TYPE)atoi(row->find("itemtype")->second.c_str());
EQUIPMENT_TYPE equipType = (EQUIPMENT_TYPE)atoi(row->find("equiptype")->second.c_str());
int maxAmount = atoi(row->find("maxamount")->second.c_str());
int hp = atoi(row->find("hp")->second.c_str());
int mp = atoi(row->find("mp")->second.c_str());
int attack = atoi(row->find("attack")->second.c_str());
int defense = atoi(row->find("defense")->second.c_str());
int atkSpeed = atoi(row->find("atkspeed")->second.c_str());
int shootNum = atoi(row->find("shootnum")->second.c_str());
int mana = atoi(row->find("mana")->second.c_str());
bool doubleJump = atoi(row->find("doublejump")->second.c_str());
bool fastRun = atoi(row->find("fastrun")->second.c_str());
bool fly = atoi(row->find("fly")->second.c_str());
item = new Item;
item->initialize(itemName, imageName, spriteImageName, itemType, equipType, maxAmount, hp, mp, attack, defense, atkSpeed, shootNum, mana, doubleJump, fastRun, fly);
item->addAmount(amount);
_vItem.push_back(item);
return item;
}