本文整理汇总了C++中KeyMap::read方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyMap::read方法的具体用法?C++ KeyMap::read怎么用?C++ KeyMap::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyMap
的用法示例。
在下文中一共展示了KeyMap::read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
void MidiInstrument::read(Xml& xml)
{
bool ok;
int base = 10;
_nullvalue = -1;
m_keymaps.clear();
for (;;)
{
Xml::Token token = xml.parse();
const QString& tag = xml.s1();
switch (token)
{
case Xml::Error:
case Xml::End:
return;
case Xml::TagStart:
if (tag == "Patch")
{
Patch* patch = new Patch;
patch->read(xml);
if (pg.empty())
{
PatchGroup* p = new PatchGroup;
p->patches.push_back(patch);
pg.push_back(p);
}
else
pg[0]->patches.push_back(patch);
}
else if (tag == "PatchGroup")
{
PatchGroup* p = new PatchGroup;
p->read(xml);
pg.push_back(p);
}
else if (tag == "Controller")
{
MidiController* mc = new MidiController();
mc->read(xml);
// Added by Tim. Copied from los 2.
//
// HACK: make predefined "Program" controller overloadable
//
if (mc->name() == "Program")
{
for (iMidiController i = _controller->begin(); i != _controller->end(); ++i)
{
if (i->second->name() == mc->name())
{
delete i->second;
_controller->erase(i);
break;
}
}
}
_controller->add(mc);
}
else if (tag == "Init")
readEventList(xml, _midiInit, "Init");
else if (tag == "Reset")
readEventList(xml, _midiReset, "Reset");
else if (tag == "State")
readEventList(xml, _midiState, "State");
else if (tag == "InitScript")
{
if (_initScript)
delete _initScript;
QByteArray ba = xml.parse1().toLatin1();
const char* istr = ba.constData();
int len = strlen(istr) + 1;
if (len > 1)
{
_initScript = new char[len];
memcpy(_initScript, istr, len);
}
}
else if(tag == "KeyMap")
{
KeyMap *km = new KeyMap;
km->read(xml);
m_keymaps.insert(km->key, km);
}
else
xml.unknown("MidiInstrument");
break;
case Xml::Attribut:
if (tag == "name")
setIName(xml.s2());
else if (tag == "nullparam")
{
_nullvalue = xml.s2().toInt(&ok, base);
}
else if(tag == "panValue")
m_panValue = xml.s2().toDouble();
break;
case Xml::TagEnd:
if (tag == "MidiInstrument")
return;
default:
//.........这里部分代码省略.........