本文整理汇总了C++中CKeySet::GetTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CKeySet::GetTag方法的具体用法?C++ CKeySet::GetTag怎么用?C++ CKeySet::GetTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKeySet
的用法示例。
在下文中一共展示了CKeySet::GetTag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Print
//--------------------------------------------------------------------------
// Print all keys
//--------------------------------------------------------------------------
void CKeyMap::Print (FILE* f)
{
// Iterate over keysets
std::map<Tag,CKeySet*>::iterator i;
for (i=kset.begin(); i!=kset.end(); i++) {
CKeySet *pKeySet = i->second;
// Format key set unique ID
char s[8];
TagToString (s, pKeySet->GetTag());
fprintf (f, "KeySet '%s' %s\n", s, pKeySet->GetName());
// Iterate over key definitions within the keyset
std::map<Tag,CKeyDefinition*>::iterator j;
for (j=pKeySet->dkey.begin(); j!=pKeySet->dkey.end(); j++) {
CKeyDefinition *pKeyDef = j->second;
// Format key definition unique ID
char sId[8];
TagToString (sId, pKeyDef->GetTag());
// Format key code
char sCode[32];
formatKeyCode (sCode, pKeyDef->GetCode());
fprintf (f, " '%s' %-40s %s\n", sId, pKeyDef->GetName(), sCode);
}
}
}
示例2: Read
//--------------------------------------------------------------------------
// Read all keyboard definitions
//--------------------------------------------------------------------------
int CKeyMap::Read (SStream *stream, Tag tag)
{
int rc = TAG_IGNORED;
switch (tag) {
case 'vers':
// Version
ReadInt (&vers, stream);
rc = TAG_READ;
break;
case 'kset':
// KeySet sub-object
{
Tag ksetTag;
ReadTag (&ksetTag, stream);
CheckSet(ksetTag);
CKeySet *ks = new CKeySet (ksetTag);
ReadFrom (ks, stream);
kset[ks->GetTag()] = ks;
oset.push_back(ks);
}
rc = TAG_READ;
break;
}
if (rc == TAG_IGNORED) {
globals->logWarning->Write ("CKeyMap::Read : Unknown tag %s", TagToString(tag));
}
return rc;
}
示例3: FindKeyDefinitionByCode
//------------------------------------------------------------------------------
// Locate a key definition by keyboard code only
//------------------------------------------------------------------------------
CKeyDefinition* CKeyMap::FindKeyDefinitionByCode (int iCode, Tag &setTagOut)
{ setTagOut = 0;
std::map<Tag,CKeySet*>::iterator i;
for (i=kset.begin(); i!=kset.end(); i++)
{ CKeySet *set = i->second;
CKeyDefinition *kdf = set->GetKeyByCode(iCode);
if (0 == kdf) continue;
setTagOut = set->GetTag();
return kdf;
}
return 0;
}