本文整理汇总了C++中Xml::parseInt方法的典型用法代码示例。如果您正苦于以下问题:C++ Xml::parseInt方法的具体用法?C++ Xml::parseInt怎么用?C++ Xml::parseInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xml
的用法示例。
在下文中一共展示了Xml::parseInt方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readStatus
void MasterEdit::readStatus(Xml& xml)
{
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 == "midieditor")
MidiEditor::readStatus(xml);
else if (tag == "ypos")
vscroll->setPos(xml.parseInt());
else if (tag == "ymag")
{
// vscroll->setMag(xml.parseInt());
int mag = xml.parseInt();
vscroll->setMag(mag);
}
else
xml.unknown("MasterEdit");
break;
case Xml::TagEnd:
if (tag == "master")
{
// raster setzen
int item = 0;
switch (_raster)
{
case 1: item = 0;
break;
case 0: item = 1;
break;
case 768: item = 2;
break;
case 384: item = 3;
break;
case 192: item = 4;
break;
case 96: item = 5;
break;
}
_rasterInit = _raster;
rasterLabel->setCurrentIndex(item);
return;
}
default:
break;
}
}
}
示例2: readSeqConfiguration
static void readSeqConfiguration(Xml& xml)
{
//bool updatePorts = false;
for (;;)
{
Xml::Token token = xml.parse();
if (token == Xml::Error || token == Xml::End)
break;
const QString& tag = xml.s1();
switch (token)
{
case Xml::TagStart:
if (tag == "midiport")
{
//updatePorts = true;
readConfigMidiPort(xml);
}
else if (tag == "rcStop")
rcStopNote = xml.parseInt();
else if (tag == "rcEnable")
rcEnable = xml.parseInt();
else if (tag == "rcRecord")
rcRecordNote = xml.parseInt();
else if (tag == "rcGotoLeft")
rcGotoLeftMarkNote = xml.parseInt();
else if (tag == "rcPlay")
rcPlayNote = xml.parseInt();
else
xml.skip(tag);
break;
case Xml::TagEnd:
if (tag == "sequencer")
{
//All Midiports have been read so put all the unconfigured ports in the id list
//if(updatePorts)
//{
for(int i = 0; i < MIDI_PORTS; ++i)
{
MidiPort *mp = &midiPorts[i];
if(!losMidiPorts.contains(mp->id()))
losMidiPorts.insert(mp->id(), mp);
}
//}
return;
}
default:
break;
}
}
}
示例3: readShortCuts
void readShortCuts(Xml& xml)
{
for (;;)
{
Xml::Token token = xml.parse();
if (token == Xml::Error || token == Xml::End)
break;
const QString& tag = xml.s1();
switch (token)
{
case Xml::TagStart:
{
if (tag.length())
{
int index = getShrtByTag(tag.toUtf8().constData());
if (index != -1)
{
//printf("Index: %d\n",index);
shortcuts[index].key = xml.parseInt();
//printf("shortcuts[%d].key = %d, %s\n",index, shortcuts[index].key, shortcuts[index].descr);
}
else
xml.skip(tag);
}
}
case Xml::TagEnd:
if (tag == "shortcuts")
return;
default:
break;
}
}
}
示例4: readShortCuts
void readShortCuts(Xml& xml)
{
for (;;)
{
Xml::Token token = xml.parse();
if (token == Xml::Error || token == Xml::End)
break;
const QString& tag = xml.s1();
switch (token)
{
case Xml::TagStart:
{
if (tag.length())
{
int index = getShrtByTag(tag.toAscii().constData());
if (index == -1) //No such tag found
printf("Config file might be corrupted. Unknown shortcut: %s\n", tag.toLatin1().constData());
else
{
//printf("Index: %d\n",index);
shortcuts[index].key = xml.parseInt();
//printf("shortcuts[%d].key = %d, %s\n",index, shortcuts[index].key, shortcuts[index].descr);
}
}
}
case Xml::TagEnd:
if (tag == "shortcuts")
return;
default:
break;
}
}
}
示例5: readConfiguration
void MasterEdit::readConfiguration(Xml& xml)
{
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 == "raster")
_rasterInit = xml.parseInt();
else
xml.unknown("MasterEdit");
break;
case Xml::TagEnd:
if (tag == "masteredit")
return;
default:
break;
}
}
}
示例6: read
void WaveEventBase::read(Xml& xml)
{
for (;;)
{
Xml::Token token = xml.parse();
const QString& tag = xml.s1();
switch (token)
{
case Xml::Error:
case Xml::End:
case Xml::Attribut:
return;
case Xml::TagStart:
if (tag == "poslen")
PosLen::read(xml, "poslen");
else if (tag == "frame")
_spos = xml.parseInt();
else if(tag == "leftclip")
m_leftclip = xml.parseInt();
else if(tag == "rightclip")
m_rightclip = xml.parseInt();
else if (tag == "file")
{
SndFile* wf = getWave(xml.parse1(), true);
if (wf)
{
f = SndFileR(wf);
}
}
else
xml.unknown("Event");
break;
case Xml::TagEnd:
if (tag == "event")
{
Pos::setType(FRAMES); // DEBUG
return;
}
default:
break;
}
}
}
示例7: read
void TrackView::read(Xml& xml)/*{{{*/
{
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 == "name")
{
_name = xml.parse1();
}
else if(tag == "comment")
{
_comment = xml.parse1();
}
else if(tag == "selected")
{
_selected = (bool)xml.parseInt();
}
else if (tag == "vtrack")
{
Track* t = song->findTrack(xml.parse1());
if (t)
{
//printf("TrackView::read() Adding track\n");
addTrack(t);
}
}
break;
case Xml::Attribut:
break;
case Xml::TagEnd:
if(tag == "trackview")
return;
default:
break;
}
}
}/*}}}*/
示例8: read
void TempoList::read(Xml& xml)
{
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 == "tempo")
{
TEvent* t = new TEvent();
unsigned tick = t->read(xml);
iTEvent pos = find(tick);
if (pos != end())
erase(pos);
insert(std::pair<const int, TEvent*> (tick, t));
}
else if (tag == "globalTempo")
_globalTempo = xml.parseInt();
else
xml.unknown("TempoList");
break;
case Xml::Attribut:
if (tag == "fix")
_tempo = xml.s2().toInt();
break;
case Xml::TagEnd:
if (tag == "tempolist")
{
normalize();
++_tempoSN;
return;
}
default:
break;
}
}
}
示例9: readController
static void readController(Xml& xml, int midiPort, int channel)
{
int id = 0;
int val = CTRL_VAL_UNKNOWN;
for (;;)
{
Xml::Token token = xml.parse();
QString tag = xml.s1();
switch (token)
{
case Xml::TagStart:
if (tag == "val")
val = xml.parseInt();
else
xml.skip(tag);
break;
case Xml::Attribut:
if (tag == "id")
id = xml.s2().toInt();
break;
case Xml::TagEnd:
if (tag == "controller")
{
MidiPort* port = &midiPorts[midiPort];
//port->addManagedController(channel, id);
val = port->limitValToInstrCtlRange(id, val);
// The value here will actually be sent to the device LATER, in MidiPort::setMidiDevice()
port->setHwCtrlState(channel, id, val);
return;
}
default:
return;
}
}
}
示例10: readConfiguration
void readConfiguration(Xml& xml, bool readOnlySequencer)/*{{{*/
{
for (;;)
{
Xml::Token token = xml.parse();
if (token == Xml::Error || token == Xml::End)
break;
QString tag = xml.s1();
switch (token)
{
case Xml::TagStart:
/* the reading of configuration is split in two; read
"sequencer" and read ALL. The reason is that it is
possible to load a song without configuration. In
this case the <configuration> chapter in the song
file should be skipped. However the sub part
<sequencer> contains elements that are necessary
to preserve composition consistency. Mainly
midiport configuration and VOLUME.
*/
if (tag == "sequencer")
{
readSeqConfiguration(xml);
break;
}
else if (readOnlySequencer)
{
xml.skip(tag);
break;
}
if (tag == "theme")
config.style = xml.parse1();
else if (tag == "styleSheetFile")
config.styleSheetFile = xml.parse1();
else if (tag == "useOldStyleStopShortCut")
config.useOldStyleStopShortCut = xml.parseInt();
else if (tag == "moveArmedCheckBox")
config.moveArmedCheckBox = xml.parseInt();
else if (tag == "externalWavEditor")
config.externalWavEditor = xml.parse1();
else if (tag == "font0")
config.fonts[0].fromString(xml.parse1());
else if (tag == "font1")
config.fonts[1].fromString(xml.parse1());
else if (tag == "font2")
config.fonts[2].fromString(xml.parse1());
else if (tag == "font3")
config.fonts[3].fromString(xml.parse1());
else if (tag == "font4")
config.fonts[4].fromString(xml.parse1());
else if (tag == "font5")
config.fonts[5].fromString(xml.parse1());
else if (tag == "font6")
config.fonts[6].fromString(xml.parse1());
else if (tag == "globalAlphaBlend")
config.globalAlphaBlend = xml.parseInt();
else if (tag == "palette0")
config.palette[0] = readColor(xml);
else if (tag == "palette1")
config.palette[1] = readColor(xml);
else if (tag == "palette2")
config.palette[2] = readColor(xml);
else if (tag == "palette3")
config.palette[3] = readColor(xml);
else if (tag == "palette4")
config.palette[4] = readColor(xml);
else if (tag == "palette5")
config.palette[5] = readColor(xml);
else if (tag == "palette6")
config.palette[6] = readColor(xml);
else if (tag == "palette7")
config.palette[7] = readColor(xml);
else if (tag == "palette8")
config.palette[8] = readColor(xml);
else if (tag == "palette9")
config.palette[9] = readColor(xml);
else if (tag == "palette10")
config.palette[10] = readColor(xml);
else if (tag == "palette11")
config.palette[11] = readColor(xml);
else if (tag == "palette12")
config.palette[12] = readColor(xml);
else if (tag == "palette13")
config.palette[13] = readColor(xml);
else if (tag == "palette14")
config.palette[14] = readColor(xml);
else if (tag == "palette15")
config.palette[15] = readColor(xml);
else if (tag == "palette16")
config.palette[16] = readColor(xml);
else if (tag == "ctrlGraphFg")
config.ctrlGraphFg = readColor(xml);
else if (tag == "extendedMidi")
config.extendedMidi = xml.parseInt();
else if (tag == "midiExportDivision")
config.midiDivision = xml.parseInt();
else if (tag == "smfFormat")
config.smfFormat = xml.parseInt();
else if (tag == "exp2ByteTimeSigs")
//.........这里部分代码省略.........
示例11: readConfigMidiPort
static void readConfigMidiPort(Xml& xml)/*{{{*/
{
int idx = 0;
qint64 id = -1;
QString device;
bool isGlobal = false;
QString instrument("GM");
QList<PatchSequence*> patchSequences;
QList<QPair<int, QString> > presets;
int openFlags = 1;
int dic = 0;
int doc = 0;
int type = MidiDevice::ALSA_MIDI;
bool cachenrpn = false;
MidiDevice* dev = 0;
for (;;)
{
Xml::Token token = xml.parse();
if (token == Xml::Error || token == Xml::End)
break;
QString tag = xml.s1();
switch (token)
{
case Xml::TagStart:
if (tag == "name")
{
device = xml.parse1();
if (!dev)//Look for it as an alsa or already created device
dev = midiDevices.find(device);
}
else if (tag == "type")
{
type = xml.parseInt();
}
else if (tag == "record")
{ // old
bool f = xml.parseInt();
if (f)
openFlags |= 2;
}
else if (tag == "openFlags")
openFlags = xml.parseInt();
else if (tag == "defaultInChans")
dic = xml.parseInt();
else if (tag == "defaultOutChans")
doc = xml.parseInt();
else if (tag == "instrument")
{
instrument = xml.parse1();
}
else if (tag == "channel")
{
readPortChannel(xml, idx);
}
else if (tag == "preset" || tag == "patchSequence")
{
PatchSequence* p = readMidiPortPatchSequences(xml);
if (p)
patchSequences.append(p);
}
else if(tag == "midiPreset")
{
presets.append(readMidiPortPreset(xml));
}
else if(tag == "cacheNRPN")
{
cachenrpn = xml.parseInt();
}
else
xml.skip(tag);
break;
case Xml::Attribut:
if (tag == "idx")
{//Check to see if this port is already used, and bump if so
idx = xml.s2().toInt();
int freePort = getFreeMidiPort();
if(freePort != idx)
{//Set a flag here so we know when loading tracks later that we are dealing with an old file or global inputs changed
idx = freePort;
}
}
else if(tag == "portId")
{//New style
id = xml.s2().toLongLong();
idx = getFreeMidiPort();
}
else if(tag == "isGlobalInput")
{//Find the matching input if posible and set our index to it
isGlobal = xml.s2().toInt();
}
break;
case Xml::TagEnd:
if (tag == "midiport")
{
if(isGlobal)
//.........这里部分代码省略.........
示例12: readProperties
bool AudioTrack::readProperties(Xml& xml, const QString& tag)
{
if (tag == "LadspaPlugin" || tag == "plugin")
{
BasePlugin* pi = new LadspaPlugin();
pi->setTrack(this);
pi->setId((int)_efxPipe->size());
if (pi->readConfiguration(xml, false))
delete pi;
else
_efxPipe->addPlugin(pi, -1);
}
else if (tag == "Lv2Plugin")
{
Lv2Plugin* pi = new Lv2Plugin();
pi->setTrack(this);
pi->setId((int)_efxPipe->size());
if (pi->readConfiguration(xml, false))
delete pi;
else
_efxPipe->addPlugin(pi, -1);
}
else if (tag == "VstPlugin")
{
VstPlugin* pi = new VstPlugin();
pi->setTrack(this);
pi->setId((int)_efxPipe->size());
if (pi->readConfiguration(xml, false))
delete pi;
else
_efxPipe->addPlugin(pi, -1);
}
else if (tag == "auxSend")
readAuxSend(xml);
else if (tag == "prefader")
_prefader = xml.parseInt();
else if (tag == "sendMetronome")
_sendMetronome = xml.parseInt();
else if (tag == "automation")
setAutomationType(AutomationType(xml.parseInt()));
else if (tag == "controller")
{
CtrlList* l = new CtrlList();
l->read(xml);
// Since (until now) oom wrote a 'zero' for plugin controller current value
// in the XML file, we can't use that value, now that plugin automation is added.
// We must take the value from the plugin control value.
// Otherwise we break all existing .oom files with plugins, because the gui
// controls would all be set to zero.
// But we will allow for the (unintended, useless) possibility of a controller
// with no matching plugin control.
BasePlugin* p = 0;
bool ctlfound = false;
int m = l->id() & AC_PLUGIN_CTL_ID_MASK;
int n = (l->id() >> AC_PLUGIN_CTL_BASE_POW) - 1;
int pdepth = _efxPipe->size();
if (n >= 0 && n < pdepth)
{
p = (*_efxPipe)[n];
if (p)
{
ParameterPort* cport = p->getParameterPort(m);
if (cport && cport->type == PARAMETER_INPUT && (cport->hints & PARAMETER_IS_AUTOMABLE) > 0)
ctlfound = true;
}
}
iCtrlList icl = _controller.find(l->id());
if (icl == _controller.end())
_controller.add(l);
else
{
CtrlList* d = icl->second;
for (iCtrl i = l->begin(); i != l->end(); ++i)
d->add(i->second.getFrame(), i->second.val);
if (!ctlfound)
d->setCurVal(l->curVal());
d->setColor(l->color());
d->setVisible(l->isVisible());
d->setDefault(l->getDefault());
delete l;
l = d;
}
if (ctlfound)
{
l->setCurVal(p->getParameterValue(m));
ParameterPort* cport = p->getParameterPort(m);
if (cport && cport->hints & PARAMETER_IS_TOGGLED)
l->setMode(CtrlList::DISCRETE);
else
l->setMode(CtrlList::INTERPOLATE);
}
}