本文整理汇总了C++中XmlElement::getNextElement方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlElement::getNextElement方法的具体用法?C++ XmlElement::getNextElement怎么用?C++ XmlElement::getNextElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlElement
的用法示例。
在下文中一共展示了XmlElement::getNextElement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildFromXml
void CommandTableModel::buildFromXml(XmlElement *root)
{
if (root->getTagName().compare("settings") != 0)
return;
removeAllRows();
XmlElement* setting = root->getFirstChildElement();
while ((setting) && (m_commandMap))
{
if (setting->hasAttribute("controller"))
{
MIDI_Message cc(setting->getIntAttribute("channel"), setting->getIntAttribute("controller"), true);
addRow(cc.channel, cc.controller, true);
// older versions of MIDI2LR stored the index of the string, so we should attempt to parse this as well
if (setting->getIntAttribute("command", -1) != -1)
{
m_commandMap->addCommandforMessage(setting->getIntAttribute("command"), cc);
}
else
{
m_commandMap->addCommandforMessage(setting->getStringAttribute("command_string"), cc);
}
}
else if (setting->hasAttribute("note"))
{
MIDI_Message note(setting->getIntAttribute("channel"), setting->getIntAttribute("note"), false);
addRow(note.channel, note.pitch, false);
// older versions of MIDI2LR stored the index of the string, so we should attempt to parse this as well
if (setting->getIntAttribute("command", -1) != -1)
{
m_commandMap->addCommandforMessage(setting->getIntAttribute("command"), note);
}
else
{
m_commandMap->addCommandforMessage(setting->getStringAttribute("command_string"), note);
}
}
setting = setting->getNextElement();
}
}
示例2: xmlDoc
void GUI::ClientListComponent::readClientDetailsFromXML()
{
if(File(csplayerxmlFilePath).exists())//if File CsPlayer.scp is exist
{
File f=File(csplayerxmlFilePath);
XmlDocument xmlDoc(f);
// Csplayer to take document of XMLDocument
ScopedPointer<XmlElement> Csplayer;
Csplayer = xmlDoc.getDocumentElement();
if(Csplayer) //if CsPlayer.scp file is not blank....
{
XmlElement * clientElement = Csplayer->getChildByName("Clients")->getChildByName("Client");
while(clientElement)
{
Configurations::ClientInfo tempClientInfo;
tempClientInfo.fromXML(clientElement);
// Add clientInformation into Array
clientInfoArray.add(tempClientInfo);
clientElement = clientElement->getNextElement();
}
clientListBox->updateContent();
}
}
}
示例3: downloadFromServer
bool OwlNestSettings::downloadFromServer(CommandID commandID) {
String nodeString, optionString, warningString;
PropertySet* props = ApplicationConfiguration::getApplicationProperties();
switch (commandID){
case ApplicationCommands::checkForFirmwareUpdates:
warningString = "Beware that this procedure can make your OWL unresponsive!";
nodeString = "firmwares";
optionString = props->getValue("firmware-dfu-options");
break;
case ApplicationCommands::checkForBootloaderUpdates:
warningString = "Beware that this procedure can brick your OWL!";
nodeString = "bootloaders";
optionString = props->getValue("bootloader-dfu-options");
break;
default:
return false;
}
String xmlFilename ("updates.xml");
URL url(props->getValue("owl-updates-dir-url")+xmlFilename);
ScopedPointer<XmlElement> xmlUpdates;
if(url.isWellFormed())
xmlUpdates = url.readEntireXmlStream(0);
if(xmlUpdates == NULL) {
AlertWindow::showMessageBoxAsync(AlertWindow::WarningIcon, "Connection Error", "Server connection failed");
return false;
}
XmlElement* filesNode = xmlUpdates->getChildByName(nodeString);
StringArray names;
XmlElement* child = filesNode->getFirstChildElement();
while(child != nullptr){
names.add(child->getStringAttribute("name"));
child = child->getNextElement();
}
AlertWindow popup("Download File From Server", "Choose file:", juce::AlertWindow::InfoIcon);
popup.addButton("Cancel", 0, juce::KeyPress(), juce::KeyPress());
popup.addButton("Download", 1, juce::KeyPress(), juce::KeyPress());
popup.addComboBox("box", names);
if(popup.runModalLoop()==0)
return false;
popup.setVisible(false);
String selectedFilename(popup.getComboBoxComponent("box")->getText());
URL fwUrl(props->getValue("owl-updates-dir-url")+selectedFilename);
ScopedPointer<InputStream> strm;
strm = fwUrl.createInputStream(0);
if(strm == NULL){
AlertWindow::showMessageBoxAsync(AlertWindow::WarningIcon, "Connection Error", "File unavailable", "Continue");
return false;
}
File theTargetFile(ApplicationConfiguration::getApplicationDirectory().getChildFile(selectedFilename));
FileChooser chooser("Save As", theTargetFile, "*.bin");
bool succeeded = false;
if(!chooser.browseForFileToSave(true))
return false;
theTargetFile = chooser.getResult();
TemporaryFile temp (theTargetFile);
ScopedPointer<FileOutputStream> out(temp.getFile().createOutputStream());
if(out != nullptr) {
out->writeFromInputStream(*strm, strm->getTotalLength());
out = nullptr; // deletes the stream
succeeded = temp.overwriteTargetFileWithTemporary();
}
if(!succeeded){
AlertWindow::showMessageBoxAsync(AlertWindow::WarningIcon, "File Error", "Failed to save file", "Continue");
return false;
}
if(AlertWindow::showOkCancelBox(AlertWindow::QuestionIcon, "Update Device",
"Would you like to update your OWL with this binary now? "+warningString, "Yes", "No"))
{
DBG("pathName"<< theTargetFile.getFullPathName());
DBG("optionString " << optionString);
return deviceFirmwareUpdate(theTargetFile, optionString);
}
return true;
}