本文整理汇总了C++中LLXMLNodePtr::notNull方法的典型用法代码示例。如果您正苦于以下问题:C++ LLXMLNodePtr::notNull方法的具体用法?C++ LLXMLNodePtr::notNull怎么用?C++ LLXMLNodePtr::notNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLXMLNodePtr
的用法示例。
在下文中一共展示了LLXMLNodePtr::notNull方法的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: 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);
}
}
示例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;
//llinfos << "replaceSubstitutionStrings: value: \"" << value << "\" repl: \"" << replacement << "\"." << llendl;
it->second->setValue(replacement);
}
else
{
llwarns << "replaceSubstitutionStrings FAILURE: could not find replacement \"" << value << "\"." << 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: getNode
bool LLXUIParser::writeF64Value(const void* val_ptr, const name_stack_t& stack)
{
LLXMLNodePtr node = getNode(stack);
if (node.notNull())
{
node->setDoubleValue(*((F64*)val_ptr));
return true;
}
return false;
}
示例5: writeUUIDValue
bool LLXUIParser::writeUUIDValue(const void* val_ptr, const name_stack_t& stack)
{
LLXMLNodePtr node = getNode(stack);
if (node.notNull())
{
node->setStringValue(((LLUUID*)val_ptr)->asString());
return true;
}
return false;
}
示例6: 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;
}
示例7: 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;
}
示例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: writeUIColorValue
bool LLXUIParser::writeUIColorValue(const void* val_ptr, const name_stack_t& stack)
{
LLXMLNodePtr node = getNode(stack);
if (node.notNull())
{
LLUIColor color = *((LLUIColor*)val_ptr);
//RN: don't write out the color that is represented by a function
// rely on param block exporting to get the reference to the color settings
if (color.isReference()) return false;
node->setFloatValue(4, color.get().mV);
return true;
}
return false;
}
示例10: 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;
}
示例11: 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;
}
示例12: 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;
}
示例13: initChildrenXML
void LLPanel::initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory)
{
LLXMLNodePtr child;
for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
{
// look for string declarations for programmatic text
if (child->hasName("string"))
{
std::string string_name;
child->getAttributeString("name", string_name);
if (!string_name.empty())
{
mUIStrings[string_name] = child->getTextContents();
}
}
else
{
factory->createWidget(this, child);
}
}
}
示例14: 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;
}
示例15: 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())
//.........这里部分代码省略.........