void NamedValueSet::setFromXmlAttributes (const XmlElement& xml) { clear(); LinkedListPointer<NamedValue>::Appender appender (values); const int numAtts = xml.getNumAttributes(); // xxx inefficient - should write an att iterator.. for (int i = 0; i < numAtts; ++i) { const String& name = xml.getAttributeName (i); const String& value = xml.getAttributeValue (i); if (name.startsWith ("base64:")) { MemoryBlock mb; if (mb.fromBase64Encoding (value)) { appender.append (new NamedValue (name.substring (7), var (mb))); continue; } } appender.append (new NamedValue (name, var (value))); } }
void NamedValueSet::setFromXmlAttributes (const XmlElement& xml) { clear(); LinkedListPointer<NamedValue>::Appender appender (values); const int numAtts = xml.getNumAttributes(); // xxx inefficient - should write an att iterator.. for (int i = 0; i < numAtts; ++i) appender.append (new NamedValue (xml.getAttributeName (i), var (xml.getAttributeValue (i)))); }
ValueTree ValueTree::fromXml (const XmlElement& xml) { ValueTree v (xml.getTagName()); const int numAtts = xml.getNumAttributes(); // xxx inefficient - should write an att iterator.. for (int i = 0; i < numAtts; ++i) v.setProperty (xml.getAttributeName (i), var (xml.getAttributeValue (i)), 0); forEachXmlChildElement (xml, e) { v.addChild (fromXml (*e), -1, 0); }
BK16USODevice::BK16USODevice(){ XmlElement* xmlElement = Config::getElement("bk16"); if (xmlElement == nullptr){ std::cout << "element bk16 ne naiden v konfiguracii" << std::endl; }else{ if (xmlElement->isAttributeExists("address")){ address = atoi(xmlElement->getAttributeValue("address").c_str()); }else{ std::cout << "bk16 - znachenie adresa ne ukazano v konfiguracii" << std::endl; } } inputs = new unsigned char[INPUTS_NUMBER]; for (unsigned int i = 0; i < INPUTS_NUMBER; ++i) inputs[i] = 1; }
void InstanceProcessor::setStateInformation (const void* data, int sizeInBytes) { ScopedPointer<XmlElement> xml(getXmlFromBinary(data, sizeInBytes)); if(xml != nullptr) { if(xml->hasTagName("CamomileSettings")) { String name = xml->getStringAttribute("name"); String path = xml->getStringAttribute("path"); if(File::isAbsolutePath(path)) { File file(path + File::separatorString + name); if(!file.exists()) { file = File(m_path + File::separatorString + name); if(!file.exists()) { file = File(File::getCurrentWorkingDirectory().getFullPathName() + File::separatorString + name); if(!file.exists()) { file = File(File::getSpecialLocation(juce::File::SpecialLocationType::userDocumentsDirectory).getFullPathName() + File::separatorString + name); if(!file.exists()) { file = File(path + File::separatorString + name); } } } } loadPatch(name.toStdString(), path.toStdString()); } XmlElement* params = xml->getChildByName(juce::StringRef("params")); if(params) { for(int i = 0; i < params->getNumAttributes(); i++) { int index = getParameterIndex(params->getAttributeName(i)); if(index >= 0) { setParameterNotifyingHost(index, params->getAttributeValue(i).getDoubleValue()); } } } } } }