本文整理汇总了C++中plKey::getLocation方法的典型用法代码示例。如果您正苦于以下问题:C++ plKey::getLocation方法的具体用法?C++ plKey::getLocation怎么用?C++ plKey::getLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plKey
的用法示例。
在下文中一共展示了plKey::getLocation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MoveKey
void plKeyCollector::MoveKey(plKey key, const plLocation& to) {
std::vector<plKey>& keyList = keys[key->getLocation()][key->getType()];
std::vector<plKey>::iterator it = keyList.begin();
size_t sub = 0;
while (it != keyList.end()) {
if ((*it) == key) {
it = keyList.erase(it);
sub++;
} else {
(*it)->setID((*it)->getID() - sub);
it++;
}
}
if (keyList.empty())
keys[key->getLocation()].erase(key->getType());
if (keys[key->getLocation()].empty())
keys.erase(key->getLocation());
key->setLocation(to);
add(key);
}
示例2: findKey
plKey plKeyCollector::findKey(plKey match) {
plKey key;
std::vector<plKey> kList = getKeys(match->getLocation(), match->getType());
for (unsigned int i=0; i < kList.size(); i++) {
if (*kList[i] == *match) {
key = kList[i];
break;
}
}
return key;
}
示例3: del
void plKeyCollector::del(plKey key) {
std::vector<plKey>& keyList = keys[key->getLocation()][key->getType()];
std::vector<plKey>::iterator it = keyList.begin();
size_t sub = 0;
while (it != keyList.end()) {
if ((*it) == key) {
it = keyList.erase(it);
sub++;
} else {
(*it)->setID((*it)->getID() - sub);
it++;
}
}
if (keyList.empty())
keys[key->getLocation()].erase(key->getType());
if (keys[key->getLocation()].empty())
keys.erase(key->getLocation());
if (key.Exists() && key.isLoaded()) {
key->deleteObj();
}
}
示例4: add
void plKeyCollector::add(plKey key) {
keys[key->getLocation()][key->getType()].push_back(key);
if (key->getID() == 0)
key->setID(keys[key->getLocation()][key->getType()].size());
}