本文整理汇总了C++中XmlElement::getDoubleAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlElement::getDoubleAttribute方法的具体用法?C++ XmlElement::getDoubleAttribute怎么用?C++ XmlElement::getDoubleAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlElement
的用法示例。
在下文中一共展示了XmlElement::getDoubleAttribute方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setFromXML
virtual void setFromXML(const XmlElement& inXML) override
{
// DBGM("In DecibelParameter::setFromXML(inXML) ");
XmlElement* thisXML = inXML.getChildByName(this->name);
setValue(thisXML->getDoubleAttribute("parameterValue", -9876.5));
setDefaultValue(thisXML->getDoubleAttribute("defaultValue", -9876.5));
setShouldBeSmoothed(thisXML->getBoolAttribute("isSmoothed", false));
setMinDecibels(thisXML->getDoubleAttribute("minDecibels", -9876.5));
setMaxDecibels(thisXML->getDoubleAttribute("maxDecibels", -9876.5));
setUnityDecibels(thisXML->getDoubleAttribute("unityDecibels", -9876.5));
setMidValue(thisXML->getDoubleAttribute("midValue", -9876.5));
}
示例2: loadXml
void pspRandomSystem::loadXml(juce::File xmlFile){
XmlDocument myDocument (xmlFile);
XmlElement* mainElement = myDocument.getDocumentElement();
if (mainElement == nullptr)
{
AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, "error loading randomTrajectory xml file !", "", "OK");
delete mainElement;
return;
}
else{
if(!mainElement->hasTagName("RandomTrajectory")){
AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, "xml file doesn't randomTrajectory data", "", "OK");
delete mainElement;
return;
}
else{
XmlElement* params = mainElement->getChildByName("parameterValues");
if(params){
int np = params->getIntAttribute("numParticles");
changeNumParticles(np);
static_cast<pspParticleSystemGUIGenericComponent*>(myGui->getGenericComponent())->getNumParticleSlider()->setValue(np);
setBounds(1, params->getDoubleAttribute("lxMin"));
setBounds(2, params->getDoubleAttribute("lxMax"));
setBounds(3, params->getDoubleAttribute("lyMin"));
setBounds(4, params->getDoubleAttribute("lyMax"));
setBounds(5, params->getDoubleAttribute("lzMin"));
setBounds(6, params->getDoubleAttribute("lzMax"));
static_cast<pspRandomSystemSpecificGUI*>(mySpecificGui)->setSliderValues(params->getDoubleAttribute("lxMin"),
params->getDoubleAttribute("lxMax"),
params->getDoubleAttribute("lyMin"),
params->getDoubleAttribute("lxMax"),
params->getDoubleAttribute("lzMin"),
params->getDoubleAttribute("lzMax"));
}
}
}
delete mainElement;
}
示例3: loadXmlRoomConfig
bool pspRoomConfigGUI::loadXmlRoomConfig(File xmlFile){
XmlDocument myDocument (xmlFile);
XmlElement* mainElement = myDocument.getDocumentElement();
if (mainElement == nullptr)
{
AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, "error loading room config xml file !", "", "OK");
delete mainElement;
return false;
}
else{
if(!mainElement->hasTagName("RoomConfig")){
AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, "xml file doesn't contain room config data", "", "OK");
delete mainElement;
return false;
}
else{
XmlElement* roomSize = mainElement->getChildByName("roomSize");
if(roomSize){
static_cast<roomConfigSlider*>(roomDimensions[0])->setValue(roomSize->getDoubleAttribute("width"));
}
XmlElement* speakers = mainElement->getChildByName("speakers");
if(speakers != nullptr){
int ns = speakers->getNumChildElements();
setNumSpeakers(ns);
nss->setValue(ns);
cout<<endl<<speakersPosition.size();
/*
for(int i=0; i<ns; i++){
static_cast<speakerPositionSlider*>(speakersPosition[3*i+0])->setValue(speakers->getChildElement(i)->getDoubleAttribute("x"));
static_cast<speakerPositionSlider*>(speakersPosition[3*i+1])->setValue(speakers->getChildElement(i)->getDoubleAttribute("y"));
static_cast<speakerPositionSlider*>(speakersPosition[3*i+2])->setValue(speakers->getChildElement(i)->getDoubleAttribute("z"));
}
*/
}
//delete speakers;
}
}
delete mainElement;
return true;
}
示例4: loadFromXml
bool JucerDocument::loadFromXml (const XmlElement& xml)
{
if (xml.hasTagName (jucerCompXmlTag)
&& getTypeName().equalsIgnoreCase (xml.getStringAttribute ("documentType")))
{
className = xml.getStringAttribute ("className", defaultClassName);
templateFile = xml.getStringAttribute ("template", String::empty);
componentName = xml.getStringAttribute ("componentName", String::empty);
parentClasses = xml.getStringAttribute ("parentClasses", defaultParentClasses);
constructorParams = xml.getStringAttribute ("constructorParams", String::empty);
variableInitialisers = xml.getStringAttribute ("variableInitialisers", String::empty);
fixedSize = xml.getBoolAttribute ("fixedSize", false);
initialWidth = xml.getIntAttribute ("initialWidth", 300);
initialHeight = xml.getIntAttribute ("initialHeight", 200);
snapGridPixels = xml.getIntAttribute ("snapPixels", snapGridPixels);
snapActive = xml.getBoolAttribute ("snapActive", snapActive);
snapShown = xml.getBoolAttribute ("snapShown", snapShown);
componentOverlayOpacity = (float) xml.getDoubleAttribute ("overlayOpacity", 0.0);
activeExtraMethods.clear();
if (XmlElement* const methods = xml.getChildByName ("METHODS"))
forEachXmlChildElementWithTagName (*methods, e, "METHOD")
activeExtraMethods.addIfNotAlreadyThere (e->getStringAttribute ("name"));
activeExtraMethods.trim();
activeExtraMethods.removeEmptyStrings();
changed();
getUndoManager().clearUndoHistory();
return true;
}
return false;
}
示例5: loadFromXml
/// Load parameter value from XML.
///
/// @param xmlDocument XML document to load from
///
void Parameter::loadFromXml(XmlElement *xmlDocument)
{
float realValue;
// get parameter's element from XML document
XmlElement *xmlParameter = xmlDocument->getChildByName(getTagName());
// parameter's element found
if (xmlParameter)
{
// get stored value from attribute "value" (or use default
// real value)
realValue = (float) xmlParameter->getDoubleAttribute("value", getDefaultRealFloat());
}
// otherwise
else
{
// use default real value
realValue = getDefaultRealFloat();
}
// update real value
setRealFloat(realValue);
}
示例6: initialiseFromXML
String AudioDeviceManager::initialiseFromXML (const XmlElement& xml,
const bool selectDefaultDeviceOnFailure,
const String& preferredDefaultDeviceName,
const AudioDeviceSetup* preferredSetupOptions)
{
lastExplicitSettings = new XmlElement (xml);
String error;
AudioDeviceSetup setup;
if (preferredSetupOptions != nullptr)
setup = *preferredSetupOptions;
if (xml.getStringAttribute ("audioDeviceName").isNotEmpty())
{
setup.inputDeviceName = setup.outputDeviceName
= xml.getStringAttribute ("audioDeviceName");
}
else
{
setup.inputDeviceName = xml.getStringAttribute ("audioInputDeviceName");
setup.outputDeviceName = xml.getStringAttribute ("audioOutputDeviceName");
}
currentDeviceType = xml.getStringAttribute ("deviceType");
if (findType (currentDeviceType) == nullptr)
{
if (AudioIODeviceType* const type = findType (setup.inputDeviceName, setup.outputDeviceName))
currentDeviceType = type->getTypeName();
else if (availableDeviceTypes.size() > 0)
currentDeviceType = availableDeviceTypes.getUnchecked(0)->getTypeName();
}
setup.bufferSize = xml.getIntAttribute ("audioDeviceBufferSize", setup.bufferSize);
setup.sampleRate = xml.getDoubleAttribute ("audioDeviceRate", setup.sampleRate);
setup.inputChannels .parseString (xml.getStringAttribute ("audioDeviceInChans", "11"), 2);
setup.outputChannels.parseString (xml.getStringAttribute ("audioDeviceOutChans", "11"), 2);
setup.useDefaultInputChannels = ! xml.hasAttribute ("audioDeviceInChans");
setup.useDefaultOutputChannels = ! xml.hasAttribute ("audioDeviceOutChans");
error = setAudioDeviceSetup (setup, true);
midiInsFromXml.clear();
forEachXmlChildElementWithTagName (xml, c, "MIDIINPUT")
midiInsFromXml.add (c->getStringAttribute ("name"));
const StringArray allMidiIns (MidiInput::getDevices());
for (int i = allMidiIns.size(); --i >= 0;)
setMidiInputEnabled (allMidiIns[i], midiInsFromXml.contains (allMidiIns[i]));
if (error.isNotEmpty() && selectDefaultDeviceOnFailure)
error = initialise (numInputChansNeeded, numOutputChansNeeded,
nullptr, false, preferredDefaultDeviceName);
setDefaultMidiOutput (xml.getStringAttribute ("defaultMidiOutput"));
return error;
}
示例7: setStateFromXML
//.........这里部分代码省略.........
// translate seq parameters
for(unsigned n=0; n<16; ++n)
{
std::stringstream pName;
std::stringstream pName2;
pName << "seq_value" << n;
pName2 << "seq_pulse" << n;
MLSymbol oldSym(pName.str());
MLSymbol newSym = MLSymbol("seq_value#").withFinalNumber(n);
MLSymbol oldSym2(pName2.str());
MLSymbol newSym2 = MLSymbol("seq_pulse#").withFinalNumber(n);
translationTable[oldSym] = newSym;
translationTable[oldSym2] = newSym2;
}
}
if (blobVersion <= 0x00010200)
{
MLSymbol oldSym = MLSymbol("seq_value");
MLSymbol newSym = MLSymbol("seq_value").withFinalNumber(0);
MLSymbol oldSym2 = MLSymbol("seq_pulse");
MLSymbol newSym2 = MLSymbol("seq_pulse").withFinalNumber(0);
translationTable[oldSym] = newSym;
translationTable[oldSym2] = newSym2;
// translate seq parameters
for(unsigned n=1; n<16; ++n)
{
oldSym = MLSymbol("seq_value#").withFinalNumber(n);
newSym = MLSymbol("seq_value").withFinalNumber(n);
oldSym2 = MLSymbol("seq_pulse#").withFinalNumber(n);
newSym2 = MLSymbol("seq_pulse").withFinalNumber(n);
translationTable[oldSym] = newSym;
translationTable[oldSym2] = newSym2;
}
}
// get params from xml
const unsigned numAttrs = xmlState.getNumAttributes();
String patcherInputStr ("patcher_input_");
for(unsigned i=0; i<numAttrs; ++i)
{
// get name / value pair.
const String& attrName = xmlState.getAttributeName(i);
const MLParamValue paramVal = xmlState.getDoubleAttribute(attrName);
// if not a patcher input setting,
if (!attrName.contains(patcherInputStr))
{
// see if we have this named parameter in our engine.
MLSymbol paramSym = XMLAttrToSymbol(attrName);
const int pIdx = getParameterIndex(paramSym);
if (pIdx >= 0)
{
// debug() << "setStateFromXML: <" << paramSym << " = " << paramVal << ">\n";
setPropertyImmediate(paramSym, paramVal);
}
else // try finding a match through translation table.
{
//debug() << "Looking for parameter " << paramSym << " in table...\n";
std::map<MLSymbol, MLSymbol>::iterator it;
it = translationTable.find(paramSym);
if (it != translationTable.end())
{
const MLSymbol newSym = translationTable[paramSym];
const int pNewIdx = getParameterIndex(newSym);
if (pNewIdx >= 0)
{
//debug() << "translated parameter to " << newSym << " .\n";
setPropertyImmediate(newSym, paramVal);
}
else
{
MLError() << "MLPluginProcessor::setStateFromXML: no such parameter! \n";
}
}
else
{
// fail silently on unfound params, because we have deprecated some but they may still
// be around in old presets.
//debug() << "MLPluginProcessor::setStateFromXML: parameter " << paramSym << " not found!\n";
}
}
}
}
// get editor state from XML
if(setViewAttributes)
{
int x = xmlState.getIntAttribute("editor_x");
int y = xmlState.getIntAttribute("editor_y");
int width = xmlState.getIntAttribute("editor_width");
int height = xmlState.getIntAttribute("editor_height");
mEditorRect = MLRect(x, y, width, height);
mEditorNumbersOn = xmlState.getIntAttribute("editor_num", 1);
mEditorAnimationsOn = xmlState.getIntAttribute("editor_anim", 1);
}
}
示例8: createNodeFromXml
void PMixDocument::createNodeFromXml (XmlElement& xml, const String& newSourceCode)
{
PluginDescription pd;
forEachXmlChildElement (xml, e)
{
if (pd.loadFromXml (*e))
break;
}
String errorMessage;
AudioPluginInstance* instance = audioEngine.createPluginInstance(pd, errorMessage);
jassert(instance != nullptr);
if (pd.pluginFormatName == "FAUST")
{
FaustAudioPluginInstance* faustProc = dynamic_cast<FaustAudioPluginInstance*>(instance);
faustProc->initialize(getLibraryPath(), drawPath);
if (newSourceCode.length())
faustProc->setSourceCode(newSourceCode, true);
// TODO: this is a bit wrong!
faustProc->prepareToPlay(44100., 8192);
// xml.setAttribute("numInputs", faustProc->getNumInputChannels());
// xml.setAttribute("numOutputs", faustProc->getNumOutputChannels()); ???
}
AudioProcessorGraph::Node::Ptr node (audioEngine.getGraph().addNode (instance, xml.getIntAttribute ("uid")));
if (!newSourceCode.length())
{
if (const XmlElement* const state = xml.getChildByName ("STATE"))
{
MemoryBlock m;
m.fromBase64Encoding (state->getAllSubText());
node->getProcessor()->setStateInformation (m.getData(), (int) m.getSize());
}
}
node->properties.set ("x", xml.getDoubleAttribute ("x"));
node->properties.set ("y", xml.getDoubleAttribute ("y"));
node->properties.set ("uiLastX", xml.getIntAttribute ("uiLastX"));
node->properties.set ("uiLastY", xml.getIntAttribute ("uiLastY"));
node->properties.set ("uiStatus", xml.getIntAttribute ("uiStatus"));
// presets etc for faust & plugin nodes
if(!InternalPluginFormat::isInternalFormat(pd.name))
{
node->properties.set ("colour", xml.getStringAttribute ("colour"));
node->properties.set ("iposx", xml.getDoubleAttribute ("iposx"));
node->properties.set ("iposy", xml.getDoubleAttribute ("iposy"));
if (const XmlElement* const params = xml.getChildByName ("PARAMS"))
{
var vparams = JSON::parse(params->getAllSubText());
node->properties.set ("params", vparams);
}
Array<var> presetsArr;
forEachXmlChildElement (xml, e)
{
if (e->hasTagName ("PRESET"))
{
DynamicObject* obj = new DynamicObject();
obj->setProperty("name", e->getStringAttribute("name"));
obj->setProperty("x", e->getDoubleAttribute("x"));
obj->setProperty("y", e->getDoubleAttribute("y"));
obj->setProperty("radius", e->getDoubleAttribute("radius"));
obj->setProperty("hidden", e->getBoolAttribute("hidden"));
// obj->setProperty("distance", e->getDoubleAttribute("distance"));
obj->setProperty("coeff", e->getDoubleAttribute("coeff"));
var vparams = JSON::parse(e->getAllSubText());
obj->setProperty("state", vparams);
obj->setProperty("uid", e->getIntAttribute("uid"));
var preset = var(obj);
presetsArr.add(preset);
}
}
node->properties.set("presets", presetsArr);
}
示例9: LoadXml
void Track::LoadXml(XmlElement* e, StringArray& errors, int formatVersion)
{
if (e->hasTagName(tag::kTrack))
{
this->SetName(e->getStringAttribute(tag::kName, ""));
this->Mute(e->getBoolAttribute(tag::kMuted));
this->SetActive(e->getBoolAttribute(tag::kActive, false));
this->SetInputGain(e->getDoubleAttribute(tag::kInputGain, 0));
this->SetInputPan(e->getDoubleAttribute(tag::kPan, 0.5));
this->SetOutputVolume(e->getDoubleAttribute("outputVolume", 0));
bool isSoloed = e->getBoolAttribute(tag::kSoloed, false);
if (isSoloed)
{
fScumbler->SoloTrack(this);
}
int channels = e->getIntAttribute(tag::kChannels, tk::kStereo);
// handle the pre-effect block.
XmlElement* pre = e->getChildByName(tag::kPreBlock);
if (pre)
{
fPreEffects->LoadXml(pre, errors, formatVersion);
}
else
{
errors.add("File format error -- missing <pre> effects block.");
}
// restore the loop parameters
XmlElement* loop = e->getChildByName(tag::kLoop);
if (loop)
{
fLoop->SetLoopDuration(loop->getIntAttribute(tag::kLoopDuration, 4000));
fLoop->SetFeedback(loop->getDoubleAttribute(tag::kLoopFeedback, 0.9));
//fLoop->SeekAbsolute(loop->getIntAttribute(tag::kLoopPosition, 0));
}
else
{
errors.add("File format error -- missing <loop> information");
}
// handle the post-effect block
XmlElement* post = e->getChildByName(tag::kPostBlock);
if (post)
{
fPostEffects->LoadXml(post, errors, formatVersion);
}
else
{
errors.add("File format error -- missing <post> effects block");
}
}
else
{
errors.add("File format error -- missing <track> data");
}
}
示例10: getNumberOfViews
bool SmugMug::getNumberOfViews(int month, int year, OwnedArray<Views>& albums, OwnedArray<Views>& images)
{
StringPairArray params;
params.set(("Month"), String(month));
params.set(("Year"), String(year));
XmlElement* n = smugMugRequest(("smugmug.users.getTransferStats"), params);
if (n)
{
XmlElement* albs = n->getChildByName(("Albums"));
if (albs)
{
XmlElement* alb = albs->getChildByName(("Album"));
while (alb)
{
Views* v = new Views();
v->id = alb->getIntAttribute(("id"));
v->views = alb->getIntAttribute(("Tiny")) + alb->getIntAttribute(("Small")) + alb->getIntAttribute(("Medium")) + alb->getIntAttribute(("Large")) + roundDoubleToInt(alb->getDoubleAttribute(("Original")));
albums.add(v);
XmlElement* img = n->getChildByName(("Image"));
while (img)
{
Views* v = new Views();
v->id = img->getIntAttribute(("id"));
v->views = img->getIntAttribute(("Tiny")) + img->getIntAttribute(("Small")) + img->getIntAttribute(("Medium")) + img->getIntAttribute(("Large")) + roundDoubleToInt(img->getDoubleAttribute(("Original")));
img = img->getNextElementWithTagName(("Image"));
}
alb = alb->getNextElementWithTagName(("Album"));
}
}
delete n;
return true;
}
return false;
}