本文整理汇总了C++中LLXMLNodePtr::getNextSibling方法的典型用法代码示例。如果您正苦于以下问题:C++ LLXMLNodePtr::getNextSibling方法的具体用法?C++ LLXMLNodePtr::getNextSibling怎么用?C++ LLXMLNodePtr::getNextSibling使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLXMLNodePtr
的用法示例。
在下文中一共展示了LLXMLNodePtr::getNextSibling方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getXML
// virtual
LLXMLNodePtr LLFlyoutButton::getXML(bool save_children) const
{
LLXMLNodePtr node = LLComboBox::getXML();
node->setName(LL_FLYOUT_BUTTON_TAG);
LLXMLNodePtr child;
for (child = node->getFirstChild(); child.notNull();)
{
if (child->hasName("combo_item"))
{
child->setName(LL_FLYOUT_BUTTON_ITEM_TAG);
//setName does a delete and add, so we have to start over
child = node->getFirstChild();
}
else
{
child = child->getNextSibling();
}
}
return node;
}
示例2: initChildrenXML
void LLPanel::initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory)
{
std::string kidstring(node->getName()->mString);
kidstring += ".string";
LLXMLNodePtr child;
for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
{
// look for string declarations for programmatic text
if (child->hasName("string") || child->hasName(kidstring))
{
std::string string_name;
child->getAttributeString("name", string_name);
if (!string_name.empty())
{
std::string contents = child->getTextContents();
child->getAttributeString("value", contents);
mUIStrings[string_name] = contents;
}
}
else
{
factory->createWidget(this, child);
}
}
}
示例3: replaceSubstitutionStrings
void replaceSubstitutionStrings(LLXMLNodePtr node, StringMap& replacements)
{
//llwarns << "replaceSubstitutionStrings" << llendl;
// walk the list of attributes looking for replacements
for (LLXMLAttribList::iterator it=node->mAttributes.begin();
it != node->mAttributes.end(); ++it)
{
std::string value = it->second->getValue();
if (value[0] == '$')
{
value.erase(0, 1); // trim off the $
std::string replacement;
StringMap::const_iterator found = replacements.find(value);
if (found != replacements.end())
{
replacement = found->second;
//llwarns << "replaceSubstituionStrings: value: " << value << " repl: " << replacement << llendl;
it->second->setValue(replacement);
}
else
{
llwarns << "replaceSubstituionStrings FAILURE: value: " << value << " repl: " << replacement << llendl;
}
}
}
// now walk the list of children and call this recursively.
for (LLXMLNodePtr child = node->getFirstChild();
child.notNull(); child = child->getNextSibling())
{
replaceSubstitutionStrings(child, replacements);
}
}
示例4: setupPaths
void LLUICtrlFactory::setupPaths()
{
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, "paths.xml");
LLXMLNodePtr root;
BOOL success = LLXMLNode::parseFile(filename, root, NULL);
sXUIPaths.clear();
if (success)
{
LLXMLNodePtr path;
for (path = root->getFirstChild(); path.notNull(); path = path->getNextSibling())
{
LLUIString path_val_ui(path->getValue());
std::string language = LLUI::getLanguage();
path_val_ui.setArg("[LANGUAGE]", language);
if (std::find(sXUIPaths.begin(), sXUIPaths.end(), path_val_ui.getString()) == sXUIPaths.end())
{
sXUIPaths.push_back(path_val_ui.getString());
}
}
}
else // parsing failed
{
std::string slash = gDirUtilp->getDirDelimiter();
std::string dir = "xui" + slash + "en-us";
llwarns << "XUI::config file unable to open: " << filename << llendl;
sXUIPaths.push_back(dir);
}
}
示例5: loadTemplates
bool LLNotificationTemplates::loadTemplates()
{
LL_INFOS() << "Reading notifications template" << LL_ENDL;
// Passing findSkinnedFilenames(constraint=LLDir::ALL_SKINS) makes it
// output all relevant pathnames instead of just the ones from the most
// specific skin.
std::vector<std::string> search_paths =
gDirUtilp->findSkinnedFilenames(LLDir::XUI, "notifications.xml", LLDir::ALL_SKINS);
std::string base_filename = search_paths.front();
LLXMLNodePtr root;
BOOL success = LLXMLNode::getLayeredXMLNode(root, search_paths);
if (!success || root.isNull() || !root->hasName( "notifications" ))
{
LL_ERRS() << "Problem reading XML from UI Notifications file: " << base_filename << LL_ENDL;
return false;
}
clearTemplates();
for (LLXMLNodePtr item = root->getFirstChild();
item.notNull(); item = item->getNextSibling())
{
if (item->hasName("global"))
{
std::string global_name;
if (item->getAttributeString("name", global_name))
{
mGlobalStrings[global_name] = item->getTextContents();
}
continue;
}
if (item->hasName("template"))
{
// store an xml template; templates must have a single node (can contain
// other nodes)
std::string name;
item->getAttributeString("name", name);
LLXMLNodePtr ptr = item->getFirstChild();
mXmlTemplates[name] = ptr;
continue;
}
if (!item->hasName("notification"))
{
LL_WARNS() << "Unexpected entity " << item->getName()->mString <<
" found in notifications.xml [language=]" << LLUI::getLanguage() << LL_ENDL;
continue;
}
}
return true;
}
示例6: initFromXML
bool LLFontRegistry::initFromXML(LLXMLNodePtr node)
{
LLXMLNodePtr child;
for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
{
std::string child_name;
child->getAttributeString("name",child_name);
if (child->hasName("font"))
{
LLFontDescriptor desc;
bool font_succ = fontDescInitFromXML(child, desc);
LLFontDescriptor norm_desc = desc.normalize();
if (font_succ)
{
// if this is the first time we've seen this font name,
// create a new template map entry for it.
const LLFontDescriptor *match_desc = getMatchingFontDesc(desc);
if (match_desc == NULL)
{
// Create a new entry (with no corresponding font).
mFontMap[norm_desc] = NULL;
}
// otherwise, find the existing entry and combine data.
else
{
// Prepend files from desc.
// A little roundabout because the map key is const,
// so we have to fetch it, make a new map key, and
// replace the old entry.
string_vec_t match_file_names = match_desc->getFileNames();
match_file_names.insert(match_file_names.begin(),
desc.getFileNames().begin(),
desc.getFileNames().end());
LLFontDescriptor new_desc = *match_desc;
new_desc.getFileNames() = match_file_names;
mFontMap.erase(*match_desc);
mFontMap[new_desc] = NULL;
}
}
}
else if (child->hasName("font_size"))
{
std::string size_name;
F32 size_value;
if (child->getAttributeString("name",size_name) &&
child->getAttributeF32("size",size_value))
{
mFontSizes[size_name] = size_value;
}
}
}
return true;
}
示例7:
LLNotificationForm::LLNotificationForm(const std::string& name, const LLXMLNodePtr xml_node)
: mFormData(LLSD::emptyArray()),
mIgnore(IGNORE_NO),
mInvertSetting(false)
{
if (!xml_node->hasName("form"))
{
llwarns << "Bad xml node for form: " << xml_node->getName() << llendl;
}
LLXMLNodePtr child = xml_node->getFirstChild();
while(child)
{
child = LLNotificationTemplates::instance().checkForXMLTemplate(child);
LLSD item_entry;
std::string element_name = child->getName()->mString;
if (element_name == "ignore")
{
bool save_option = false;
child->getAttribute_bool("save_option", save_option);
if (!save_option)
{
mIgnore = IGNORE_WITH_DEFAULT_RESPONSE;
}
else
{
// remember last option chosen by user and automatically respond with that in the future
mIgnore = IGNORE_WITH_LAST_RESPONSE;
LLUI::sIgnoresGroup->declareLLSD(std::string("Default") + name, "", std::string("Default response for notification " + name));
}
child->getAttributeString("text", mIgnoreMsg);
mIgnoreSetting = LLUI::sIgnoresGroup->addWarning(name);
}
else
{
// flatten xml form entry into single LLSD map with type==name
item_entry["type"] = element_name;
const LLXMLAttribList::iterator attrib_end = child->mAttributes.end();
for(LLXMLAttribList::iterator attrib_it = child->mAttributes.begin();
attrib_it != attrib_end;
++attrib_it)
{
item_entry[std::string(attrib_it->second->getName()->mString)] = attrib_it->second->getValue();
}
item_entry["value"] = child->getTextContents();
mFormData.append(item_entry);
}
child = child->getNextSibling();
}
}
示例8: fromXML
//static
LLView* LLFlyoutButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name = "flyout_button";
node->getAttributeString("name", name);
std::string label("");
node->getAttributeString("label", label);
LLRect rect;
createRect(node, rect, parent, LLRect());
LLUICtrlCallback callback = NULL;
LLFlyoutButton* flyout_button = new LLFlyoutButton(name,
rect,
label,
callback,
NULL);
std::string list_position;
node->getAttributeString("list_position", list_position);
if (list_position == "below")
{
flyout_button->mListPosition = BELOW;
}
else if (list_position == "above")
{
flyout_button->mListPosition = ABOVE;
}
flyout_button->initFromXML(node, parent);
LLXMLNodePtr child;
for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
{
if (child->hasName("flyout_button_item"))
{
std::string label = child->getTextContents();
std::string value = label;
child->getAttributeString("value", value);
flyout_button->add(label, LLSD(value) );
}
}
flyout_button->updateLayout();
return flyout_button;
}
示例9: loadTemplates
bool LLNotificationTemplates::loadTemplates()
{
const std::string xml_filename = "notifications.xml";
LLXMLNodePtr root;
BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root);
if (!success || root.isNull() || !root->hasName( "notifications" ))
{
llerrs << "Problem reading UI Notifications file: " << xml_filename << llendl;
return false;
}
clearTemplates();
for (LLXMLNodePtr item = root->getFirstChild();
item.notNull(); item = item->getNextSibling())
{
if (item->hasName("global"))
{
std::string global_name;
if (item->getAttributeString("name", global_name))
{
mGlobalStrings[global_name] = item->getTextContents();
}
continue;
}
if (item->hasName("template"))
{
// store an xml template; templates must have a single node (can contain
// other nodes)
std::string name;
item->getAttributeString("name", name);
LLXMLNodePtr ptr = item->getFirstChild();
mXmlTemplates[name] = ptr;
continue;
}
if (!item->hasName("notification"))
{
llwarns << "Unexpected entity " << item->getName()->mString <<
" found in " << xml_filename << llendl;
continue;
}
}
return true;
}
示例10: fromXML
LLView* LLScrollableContainerView::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("scroll_container");
node->getAttributeString("name", name);
LLRect rect;
createRect(node, rect, parent, LLRect());
BOOL opaque = FALSE;
node->getAttributeBOOL("opaque", opaque);
LLColor4 color(0,0,0,0);
LLUICtrlFactory::getAttributeColor(node,"color", color);
// Create the scroll view
LLScrollableContainerView *ret = new LLScrollableContainerView(name, rect, (LLPanel*)NULL, opaque, color);
LLPanel* panelp = NULL;
// Find a child panel to add
LLXMLNodePtr child;
for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
{
LLView *control = factory->createCtrlWidget(panelp, child);
if (control && control->isPanel())
{
if (panelp)
{
llinfos << "Warning! Attempting to put multiple panels into a scrollable container view!" << llendl;
delete control;
}
else
{
panelp = (LLPanel*)control;
}
}
}
if (panelp == NULL)
{
panelp = new LLPanel(std::string("dummy"), LLRect::null, FALSE);
}
ret->mScrolledView = panelp;
ret->initFromXML(node, parent);
return ret;
}
示例11: fromXML
//static
LLView* LLFlyoutButton::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory* factory)
{
std::string label("");
node->getAttributeString("label", label);
LLRect rect;
createRect(node, rect, parent, LLRect());
LLFlyoutButton* flyout_button = new LLFlyoutButton("flyout_button", rect, label);
std::string list_position;
node->getAttributeString("list_position", list_position);
if (list_position == "below")
{
flyout_button->mListPosition = BELOW;
}
else if (list_position == "above")
{
flyout_button->mListPosition = ABOVE;
}
if (LLFontGL* font = selectFont(node))
flyout_button->mActionButton->setFont(font);
flyout_button->initFromXML(node, parent);
for (LLXMLNodePtr child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
{
if (child->hasName(LL_FLYOUT_BUTTON_ITEM_TAG))
{
std::string label(child->getTextContents());
child->getAttributeString("label", label);
std::string value(label);
child->getAttributeString("value", value);
flyout_button->add(label, LLSD(value));
}
}
flyout_button->updateLayout();
return flyout_button;
}
示例12: fontDescInitFromXML
bool fontDescInitFromXML(LLXMLNodePtr node, LLFontDescriptor& desc)
{
if (node->hasName("font"))
{
std::string attr_name;
if (node->getAttributeString("name",attr_name))
{
desc.setName(attr_name);
}
std::string attr_style;
if (node->getAttributeString("font_style",attr_style))
{
desc.setStyle(LLFontGL::getStyleFromString(attr_style));
}
desc.setSize(s_template_string);
}
LLXMLNodePtr child;
for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
{
std::string child_name;
child->getAttributeString("name",child_name);
if (child->hasName("file"))
{
std::string font_file_name = child->getTextContents();
desc.getFileNames().push_back(font_file_name);
}
else if (child->hasName("os"))
{
if (child_name == currentOsName())
{
fontDescInitFromXML(child, desc);
}
}
}
return true;
}
示例13: fromXML
LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("name_list");
node->getAttributeString("name", name);
LLRect rect;
createRect(node, rect, parent, LLRect());
BOOL multi_select = FALSE;
node->getAttributeBOOL("multi_select", multi_select);
BOOL draw_border = TRUE;
node->getAttributeBOOL("draw_border", draw_border);
BOOL draw_heading = FALSE;
node->getAttributeBOOL("draw_heading", draw_heading);
S32 name_column_index = 0;
node->getAttributeS32("name_column_index", name_column_index);
LLUICtrlCallback callback = NULL;
LLNameListCtrl* name_list = new LLNameListCtrl(name,
rect,
callback,
NULL,
multi_select,
draw_border,
name_column_index);
name_list->setDisplayHeading(draw_heading);
if (node->hasAttribute("heading_height"))
{
S32 heading_height;
node->getAttributeS32("heading_height", heading_height);
name_list->setHeadingHeight(heading_height);
}
BOOL allow_calling_card_drop = FALSE;
if (node->getAttributeBOOL("allow_calling_card_drop", allow_calling_card_drop))
{
name_list->setAllowCallingCardDrop(allow_calling_card_drop);
}
name_list->setScrollListParameters(node);
name_list->initFromXML(node, parent);
LLSD columns;
S32 index = 0;
S32 total_static = 0;
LLXMLNodePtr child;
for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
{
if (child->hasName("column"))
{
std::string labelname("");
child->getAttributeString("label", labelname);
std::string columnname(labelname);
child->getAttributeString("name", columnname);
BOOL columndynamicwidth = FALSE;
child->getAttributeBOOL("dynamicwidth", columndynamicwidth);
std::string sortname(columnname);
child->getAttributeString("sort", sortname);
S32 columnwidth = -1;
if (child->hasAttribute("relwidth"))
{
F32 columnrelwidth = 0.f;
child->getAttributeF32("relwidth", columnrelwidth);
columns[index]["relwidth"] = columnrelwidth;
}
else
{
child->getAttributeS32("width", columnwidth);
columns[index]["width"] = columnwidth;
}
LLFontGL::HAlign h_align = LLFontGL::LEFT;
h_align = LLView::selectFontHAlign(child);
if(!columndynamicwidth) total_static += llmax(0, columnwidth);
columns[index]["name"] = columnname;
columns[index]["label"] = labelname;
columns[index]["halign"] = (S32)h_align;
columns[index]["dynamicwidth"] = columndynamicwidth;
columns[index]["sort"] = sortname;
index++;
}
}
name_list->setTotalStaticColumnWidth(total_static);
name_list->setColumnHeadings(columns);
for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
//.........这里部分代码省略.........
示例14: loadTemplates
bool LLNotifications::loadTemplates()
{
const std::string xml_filename = "notifications.xml";
LLXMLNodePtr root;
BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root);
if (!success || root.isNull() || !root->hasName( "notifications" ))
{
llerrs << "Problem reading UI Notifications file: " << xml_filename << llendl;
return false;
}
clearTemplates();
for (LLXMLNodePtr item = root->getFirstChild();
item.notNull(); item = item->getNextSibling())
{
// we do this FIRST so that item can be changed if we
// encounter a usetemplate -- we just replace the
// current xml node and keep processing
item = checkForXMLTemplate(item);
if (item->hasName("global"))
{
std::string global_name;
if (item->getAttributeString("name", global_name))
{
mGlobalStrings[global_name] = item->getTextContents();
}
continue;
}
if (item->hasName("template"))
{
// store an xml template; templates must have a single node (can contain
// other nodes)
std::string name;
item->getAttributeString("name", name);
LLXMLNodePtr ptr = item->getFirstChild();
mXmlTemplates[name] = ptr;
continue;
}
if (!item->hasName("notification"))
{
llwarns << "Unexpected entity " << item->getName()->mString <<
" found in " << xml_filename << llendl;
continue;
}
// now we know we have a notification entry, so let's build it
LLNotificationTemplatePtr pTemplate(new LLNotificationTemplate());
if (!item->getAttributeString("name", pTemplate->mName))
{
llwarns << "Unable to parse notification with no name" << llendl;
continue;
}
//llinfos << "Parsing " << pTemplate->mName << llendl;
pTemplate->mMessage = item->getTextContents();
pTemplate->mDefaultFunctor = pTemplate->mName;
item->getAttributeString("type", pTemplate->mType);
item->getAttributeString("icon", pTemplate->mIcon);
item->getAttributeString("label", pTemplate->mLabel);
item->getAttributeU32("duration", pTemplate->mExpireSeconds);
item->getAttributeU32("expireOption", pTemplate->mExpireOption);
std::string priority;
item->getAttributeString("priority", priority);
pTemplate->mPriority = NOTIFICATION_PRIORITY_NORMAL;
if (!priority.empty())
{
if (priority == "low") pTemplate->mPriority = NOTIFICATION_PRIORITY_LOW;
if (priority == "normal") pTemplate->mPriority = NOTIFICATION_PRIORITY_NORMAL;
if (priority == "high") pTemplate->mPriority = NOTIFICATION_PRIORITY_HIGH;
if (priority == "critical") pTemplate->mPriority = NOTIFICATION_PRIORITY_CRITICAL;
}
item->getAttributeString("functor", pTemplate->mDefaultFunctor);
BOOL persist = false;
item->getAttributeBOOL("persist", persist);
pTemplate->mPersist = persist;
std::string sound;
item->getAttributeString("sound", sound);
if (!sound.empty())
{
// TODO: test for bad sound effect name / missing effect
pTemplate->mSoundEffect = LLUUID(LLUI::sConfigGroup->getString(sound.c_str()));
}
for (LLXMLNodePtr child = item->getFirstChild();
!child.isNull(); child = child->getNextSibling())
{
child = checkForXMLTemplate(child);
//.........这里部分代码省略.........
示例15: readXUIImpl
bool LLXUIParser::readXUIImpl(LLXMLNodePtr nodep, const std::string& scope, LLInitParam::BaseBlock& block)
{
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
boost::char_separator<char> sep(".");
bool values_parsed = false;
// submit attributes for current node
values_parsed |= readAttributes(nodep, block);
// treat text contents of xml node as "value" parameter
std::string text_contents = nodep->getSanitizedValue();
if (!text_contents.empty())
{
mCurReadNode = nodep;
mNameStack.push_back(std::make_pair(std::string("value"), newParseGeneration()));
// child nodes are not necessarily valid parameters (could be a child widget)
// so don't complain once we've recursed
bool silent = mCurReadDepth > 0;
if (!block.submitValue(mNameStack, *this, true))
{
mNameStack.pop_back();
block.submitValue(mNameStack, *this, silent);
}
else
{
mNameStack.pop_back();
}
}
// then traverse children
// child node must start with last name of parent node (our "scope")
// for example: "<button><button.param nested_param1="foo"><param.nested_param2 nested_param3="bar"/></button.param></button>"
// which equates to the following nesting:
// button
// param
// nested_param1
// nested_param2
// nested_param3
mCurReadDepth++;
for(LLXMLNodePtr childp = nodep->getFirstChild(); childp.notNull();)
{
std::string child_name(childp->getName()->mString);
S32 num_tokens_pushed = 0;
// for non "dotted" child nodes check to see if child node maps to another widget type
// and if not, treat as a child element of the current node
// e.g. <button><rect left="10"/></button> will interpret <rect> as "button.rect"
// since there is no widget named "rect"
if (child_name.find(".") == std::string::npos)
{
mNameStack.push_back(std::make_pair(child_name, newParseGeneration()));
num_tokens_pushed++;
}
else
{
// parse out "dotted" name into individual tokens
tokenizer name_tokens(child_name, sep);
tokenizer::iterator name_token_it = name_tokens.begin();
if(name_token_it == name_tokens.end())
{
childp = childp->getNextSibling();
continue;
}
// check for proper nesting
if(!scope.empty() && *name_token_it != scope)
{
childp = childp->getNextSibling();
continue;
}
// now ignore first token
++name_token_it;
// copy remaining tokens on to our running token list
for(tokenizer::iterator token_to_push = name_token_it; token_to_push != name_tokens.end(); ++token_to_push)
{
mNameStack.push_back(std::make_pair(*token_to_push, newParseGeneration()));
num_tokens_pushed++;
}
}
// recurse and visit children XML nodes
if(readXUIImpl(childp, mNameStack.empty() ? scope : mNameStack.back().first, block))
{
// child node successfully parsed, remove from DOM
values_parsed = true;
LLXMLNodePtr node_to_remove = childp;
childp = childp->getNextSibling();
nodep->deleteChild(node_to_remove);
}
else
{
childp = childp->getNextSibling();
}
//.........这里部分代码省略.........