本文整理汇总了C++中XmlElement::getChildByName方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlElement::getChildByName方法的具体用法?C++ XmlElement::getChildByName怎么用?C++ XmlElement::getChildByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlElement
的用法示例。
在下文中一共展示了XmlElement::getChildByName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: restoreFromXml
void CDPlayer::restoreFromXml(const XmlElement& element, const File& /*projectDirectory*/)
{
setColor(Colour::fromString(element.getStringAttribute("color", "0xffffffff")));
repaint();
XmlElement* boundsXml = element.getChildByName("Bounds");
if (boundsXml)
{
String x = boundsXml->getStringAttribute("x", "0");
String y = boundsXml->getStringAttribute("y", "0");
String width = boundsXml->getStringAttribute("width", "150");
String height = boundsXml->getStringAttribute("height", "150");
getParentComponent()->setBounds(x.getIntValue(), y.getIntValue(), width.getIntValue(), height.getIntValue());
}
else
{
XmlElement* mdiDocumentPosXml = element.getChildByName("MdiDocumentPos");
if (mdiDocumentPosXml->getNumChildElements() > 0 && mdiDocumentPosXml->getFirstChildElement()->isTextElement())
{
getProperties().set("mdiDocumentPos_", mdiDocumentPosXml->getFirstChildElement()->getText());
}
}
XmlElement* nameXml = element.getChildByName("Name");
setName(nameXml->getAllSubText().trim());
XmlElement* driveXml = element.getChildByName("Drive");
m_availableCDsComboBox.selectDrive(driveXml->getAllSubText().trim());
}
示例2: getSubCategoryList
bool SmugMug::getSubCategoryList(OwnedArray<SubCategory>& subCategories)
{
StringPairArray params;
XmlElement* n = smugMugRequest(("smugmug.subcategories.getAll"), params);
if (n)
{
XmlElement* c = n->getChildByName(("SubCategories"));
if (c)
{
XmlElement* subCat = c->getChildByName(("SubCategory"));
while (subCat)
{
SubCategory* subCategory = new SubCategory();
subCategory->id = subCat->getIntAttribute(("id"));
subCategory->title = subCat->getStringAttribute(("Name"));
XmlElement* cat = subCat->getChildByName(("Category"));
if (cat)
subCategory->parentId = cat->getIntAttribute(("id"));
subCategories.add(subCategory);
subCat = subCat->getNextElementWithTagName(("SubCategory"));
}
}
delete n;
return true;
}
return false;
}
示例3: login
void SmugMug::login(const String& username, const String& password)
{
sessionId = String::empty;
StringPairArray params;
params.set(("EmailAddress"), username);
params.set(("Password"), password);
XmlElement* n = smugMugRequest(("smugmug.login.withPassword"), params);
if (n)
{
XmlElement* l = n->getChildByName(("Login"));
if (l)
{
accountType = l->getStringAttribute(("AccountType"));
XmlElement* s = l->getChildByName(("Session"));
if (s)
{
sessionId = s->getStringAttribute(("id"));
addLogEntry(("Info: logged in session: ") + sessionId);
}
}
delete n;
}
}
示例4: getCategoryList
bool SmugMug::getCategoryList(OwnedArray<Category>& categories)
{
StringPairArray params;
XmlElement* n = smugMugRequest(("smugmug.categories.get"), params);
if (n)
{
XmlElement* c = n->getChildByName(("Categories"));
if (c)
{
XmlElement* cat = c->getChildByName(("Category"));
while (cat)
{
Category* category = new Category();
category->id = cat->getIntAttribute(("id"));
category->title = cat->getStringAttribute(("Name"));
categories.add(category);
cat = cat->getNextElementWithTagName(("Category"));
}
}
delete n;
return true;
}
return false;
}
示例5: getImages
bool SmugMug::getImages(OwnedArray<ImageItem>& images, SmugID albumId)
{
StringPairArray params;
params.set(("AlbumID"), String(albumId.id));
params.set(("AlbumKey"), albumId.key);
params.set(("Heavy"), ("1"));
XmlElement* n = smugMugRequest(("smugmug.images.get"), params);
if (n)
{
XmlElement* a = n->getChildByName(("Album"));
if (a)
{
XmlElement* i = a->getChildByName(("Images"));
if (i)
{
XmlElement* img = i->getChildByName(("Image"));
while (img)
{
ImageItem* itm = new ImageItem();
itm->id.id = img->getIntAttribute(("id"));
itm->id.key = img->getStringAttribute(("Key"));
itm->filename = img->getStringAttribute(("FileName"));
itm->caption = img->getStringAttribute((""));
itm->keywords = img->getStringAttribute((""));
itm->position = img->getIntAttribute(("Position"));
itm->date = img->getStringAttribute(("Date"));
itm->format = img->getStringAttribute(("Format"));
itm->serial = img->getIntAttribute(("Serial"));
itm->watermark = img->getBoolAttribute(("Watermark"));
itm->size = img->getIntAttribute(("Size"));
itm->width = img->getIntAttribute(("Width"));
itm->height = img->getIntAttribute(("Height"));
itm->md5sum = img->getStringAttribute(("MD5Sum"));
itm->lastUpdated = img->getStringAttribute(("LastUpdated"));
itm->originalURL = img->getStringAttribute(("OriginalURL"));
itm->largeURL = img->getStringAttribute(("LargeURL"));
itm->mediumURL = img->getStringAttribute(("MediumURL"));
itm->smallURL = img->getStringAttribute(("SmallURL"));
itm->tinyURL = img->getStringAttribute(("TinyURL"));
itm->thumbURL = img->getStringAttribute(("ThumbURL"));
itm->albumURL = img->getStringAttribute(("AlbumURL"));
images.add(itm);
img = img->getNextElementWithTagName(("Image"));
}
}
}
delete n;
return images.size() > 0;
}
return false;
}
示例6: getAlbumList
bool SmugMug::getAlbumList(OwnedArray<Album>& albums)
{
StringPairArray params;
XmlElement* n = smugMugRequest(("smugmug.albums.get"), params);
if (n)
{
XmlElement* a = n->getChildByName(("Albums"));
if (a)
{
XmlElement* alb = a->getChildByName(("Album"));
while (alb)
{
Album* album = new Album();
album->id.id = alb->getIntAttribute(("id"));
album->id.key = alb->getStringAttribute(("Key"));
album->title = alb->getStringAttribute(("Title"));
XmlElement* cat = alb->getChildByName(("Category"));
if (cat)
{
album->category = cat->getStringAttribute(("Name"));
album->categoryId = cat->getIntAttribute(("id"));
}
else
{
album->category = String::empty;
album->categoryId = -1;
}
XmlElement* subcat = alb->getChildByName(("SubCategory"));
if (subcat)
{
album->subCategory = subcat->getStringAttribute(("Name"));
album->subCategoryId = subcat->getIntAttribute(("id"));
}
else
{
album->subCategory = String::empty;
album->subCategoryId = -1;
}
albums.add(album);
alb = alb->getNextElementWithTagName(("Album"));
}
}
delete n;
return true;
}
return false;
}
示例7: restoreFromXml
void SoloBusMixer::restoreFromXml(const XmlElement& element)
{
XmlElement* leftElement = element.getChildByName("Left");
if (leftElement)
{
m_leftFader.setValue(leftElement->getAllSubText().trim().getFloatValue());
}
XmlElement* rightElement = element.getChildByName("Left");
if (rightElement)
{
m_rightFader.setValue(rightElement->getAllSubText().trim().getFloatValue());
}
}
示例8: getImageUrls
bool SmugMug::getImageUrls(SmugID id, ImageUrls& urls)
{
StringPairArray params;
params.set(("ImageID"), String(id.id));
params.set(("ImageKey"), id.key);
params.set(("Password"), "");
XmlElement* n = smugMugRequest(("smugmug.images.getURLs"), params);
if (n)
{
XmlElement* img = n->getChildByName(("Image"));
if (img)
{
urls.originalURL = img->getStringAttribute(("OriginalURL"));
urls.largeURL = img->getStringAttribute(("LargeURL"));
urls.mediumURL = img->getStringAttribute(("MediumURL"));
urls.smallURL = img->getStringAttribute(("SmallURL"));
urls.tinyURL = img->getStringAttribute(("TinyURL"));
urls.thumbURL = img->getStringAttribute(("ThumbURL"));
urls.albumURL = img->getStringAttribute(("AlbumURL"));
}
delete n;
return true;
}
return false;
}
示例9: createAlbum
SmugID SmugMug::createAlbum(const String& title, const int categoryId, const StringPairArray& albumFlags)
{
SmugID newAlbum;
newAlbum.id = -1;
StringPairArray params(albumFlags);
params.set(("Title"), title);
params.set(("CategoryID"), String(categoryId));
XmlElement* n = smugMugRequest(("smugmug.albums.create"), params);
if (n)
{
XmlElement* a = n->getChildByName(("Album"));
if (a)
{
newAlbum.id = a->getIntAttribute(("id"), -1);
newAlbum.key = a->getStringAttribute(("Key"));
}
if (newAlbum.id != -1)
addLogEntry(("Info: album created: ") + title);
delete n;
}
return newAlbum;
}
示例10: smugMugRequest
XmlElement* SmugMug::smugMugRequest(const String& method, const StringPairArray& params_, bool upload)
{
StringPairArray params(params_);
params.set(("method"), method);
params.set(("APIKey"), APIKEY);
startTimer(LOGOUT_TIMER);
if (sessionId.isNotEmpty())
params.set(("SessionID"), sessionId);
URL url(upload ? UPLOAD_URL : BASE_URL);
StringArray keys = params.getAllKeys();
StringArray vals = params.getAllValues();
for (int i = 0; i < keys.size(); i++)
url = url.withParameter(keys[i], vals[i]);
XmlElement* x = url.readEntireXmlStream(upload);
#ifdef JUCE_DEBUG
Logger::outputDebugString(url.toString(true));
if (x)
Logger::outputDebugString(x->createDocument(String::empty, true));
#endif
if (x && x->getStringAttribute(("stat")) == ("fail"))
{
XmlElement* err = x->getChildByName(("err"));
if (err)
{
addLogEntry(("Error: ") + err->getStringAttribute(("msg")));
}
}
return x;
}
示例11: readConfig
void XmlParser::readConfig()
{
XmlDocument* xmlConfigDoc = new XmlDocument(File(File::getCurrentWorkingDirectory().getChildFile(configFile)));
XmlElement* xmlConfigElem = xmlConfigDoc->getDocumentElement();
if (xmlConfigElem != NULL)
{
XmlElement* pictures = xmlConfigElem->getChildByName(T("pictures"));
if (pictures != NULL)
{
if (pictures->hasAttribute(T("path")))
{
m_picturePath = pictures->getStringAttribute(T("path"));
}
else
{
LOG_ERROR(T("Element \"pictures\" is incomplete"));
}
}
else
{
LOG_ERROR(T("Element \"pictures\" not found"));
}
delete xmlConfigElem;
}
else
{
LOG_ERROR((T("XML load failed: %ls"), (const juce_wchar*)xmlConfigDoc->getLastParseError()));
}
delete xmlConfigDoc;
}
示例12: handleXmlReply
OnlineUnlockStatus::UnlockResult OnlineUnlockStatus::handleXmlReply (XmlElement xml)
{
UnlockResult r;
if (const XmlElement* keyNode = xml.getChildByName ("KEY"))
{
const String keyText (keyNode->getAllSubText().trim());
r.succeeded = keyText.length() > 10 && applyKeyFile (keyText);
}
else
{
r.succeeded = false;
}
if (xml.hasTagName ("MESSAGE"))
r.informativeMessage = xml.getStringAttribute ("message").trim();
if (xml.hasTagName ("ERROR"))
r.errorMessage = xml.getStringAttribute ("error").trim();
if (xml.getStringAttribute ("url").isNotEmpty())
r.urlToLaunch = xml.getStringAttribute ("url").trim();
if (r.errorMessage.isEmpty() && r.informativeMessage.isEmpty() && r.urlToLaunch.isEmpty() && ! r.succeeded)
r.errorMessage = TRANS ("Unexpected or corrupted reply from XYZ").replace ("XYZ", getWebsiteName()) + "...\n\n"
+ TRANS("Please try again in a few minutes, and contact us for support if this message appears again.");
return r;
}
示例13: 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;
}
示例14: 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));
}
示例15: 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;
}