本文整理汇总了C++中LLXMLNodePtr::hasName方法的典型用法代码示例。如果您正苦于以下问题:C++ LLXMLNodePtr::hasName方法的具体用法?C++ LLXMLNodePtr::hasName怎么用?C++ LLXMLNodePtr::hasName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLXMLNodePtr
的用法示例。
在下文中一共展示了LLXMLNodePtr::hasName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//-----------------------------------------------------------------------------
// buildMenu()
//-----------------------------------------------------------------------------
LLMenuGL *LLUICtrlFactory::buildMenu(const std::string &filename, LLView* parentp)
{
// TomY TODO: Break this function into buildMenu and buildMenuBar
LLXMLNodePtr root;
LLMenuGL* menu;
if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
{
return NULL;
}
// root must be called panel
if( !root->hasName( "menu_bar" ) && !root->hasName( "menu" ))
{
llwarns << "Root node should be named menu bar or menu in : " << filename << llendl;
return NULL;
}
if (root->hasName("menu"))
{
menu = (LLMenuGL*)LLMenuGL::fromXML(root, parentp, this);
}
else
{
menu = (LLMenuGL*)LLMenuBarGL::fromXML(root, parentp, this);
}
if (LLUI::sShowXUINames)
{
menu->setToolTip(filename);
}
return menu;
}
示例2: buildFloaterInternal
void LLUICtrlFactory::buildFloaterInternal(LLFloater *floaterp, LLXMLNodePtr &root, const std::string &filename,
const LLCallbackMap::map_t *factory_map, BOOL open) /* Flawfinder: ignore */
{
// root must be called floater
if( !(root->hasName("floater") || root->hasName("multi_floater") ) )
{
llwarns << "Root node should be named floater in: " << filename << llendl;
return;
}
if (factory_map)
{
mFactoryStack.push_front(factory_map);
}
floaterp->initFloaterXML(root, NULL, this, open); /* Flawfinder: ignore */
if (LLUI::sShowXUINames)
{
floaterp->setToolTip(filename);
}
if (factory_map)
{
mFactoryStack.pop_front();
}
LLHandle<LLFloater> handle = floaterp->getHandle();
mBuiltFloaters[handle] = filename;
}
示例3: buildFloaterInternal
void LLUICtrlFactory::buildFloaterInternal(LLFloater *floaterp, LLXMLNodePtr &root, const std::string &filename,
const LLCallbackMap::map_t *factory_map, BOOL open) /* Flawfinder: ignore */
{
// root must be called floater
if( !(root->hasName("floater") || root->hasName("multi_floater") ) )
{
llwarns << "Root node should be named floater in: " << filename << llendl;
return;
}
if (factory_map)
{
mFactoryStack.push_front(factory_map);
}
// for local registry callbacks; define in constructor, referenced in XUI or postBuild
floaterp->getCommitCallbackRegistrar().pushScope();
floaterp->getEnableCallbackRegistrar().pushScope();
floaterp->initFloaterXML(root, NULL, this, open); /* Flawfinder: ignore */
floaterp->getCommitCallbackRegistrar().popScope();
floaterp->getEnableCallbackRegistrar().popScope();
if (LLUI::sShowXUINames)
{
floaterp->setToolTip(filename);
}
if (factory_map)
{
mFactoryStack.pop_front();
}
LLHandle<LLFloater> handle = floaterp->getHandle();
mBuiltFloaters[handle] = filename;
}
示例4: 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);
}
}
}
示例5: buildFloater
//-----------------------------------------------------------------------------
// buildFloater()
//-----------------------------------------------------------------------------
bool LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filename, LLXMLNodePtr output_node)
{
LLFastTimer timer(FTM_BUILD_FLOATERS);
LLXMLNodePtr root;
//if exporting, only load the language being exported,
//instead of layering localized version on top of english
if (output_node)
{
if (!LLUICtrlFactory::getLocalizedXMLNode(filename, root))
{
llwarns << "Couldn't parse floater from: " << LLUI::getLocalizedSkinPath() + gDirUtilp->getDirDelimiter() + filename << llendl;
return false;
}
}
else if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
{
llwarns << "Couldn't parse floater from: " << LLUI::getSkinPath() + gDirUtilp->getDirDelimiter() + filename << llendl;
return false;
}
// root must be called floater
if( !(root->hasName("floater") || root->hasName("multi_floater")) )
{
llwarns << "Root node should be named floater in: " << filename << llendl;
return false;
}
bool res = true;
lldebugs << "Building floater " << filename << llendl;
mFileNames.push_back(gDirUtilp->findSkinnedFilename(LLUI::getSkinPath(), filename));
{
if (!floaterp->getFactoryMap().empty())
{
mFactoryStack.push_front(&floaterp->getFactoryMap());
}
// for local registry callbacks; define in constructor, referenced in XUI or postBuild
floaterp->getCommitCallbackRegistrar().pushScope();
floaterp->getEnableCallbackRegistrar().pushScope();
res = floaterp->initFloaterXML(root, floaterp->getParent(), output_node);
floaterp->setXMLFilename(filename);
floaterp->getCommitCallbackRegistrar().popScope();
floaterp->getEnableCallbackRegistrar().popScope();
if (!floaterp->getFactoryMap().empty())
{
mFactoryStack.pop_front();
}
}
mFileNames.pop_back();
return res;
}
示例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: 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;
}
示例8: 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;
}
示例9: buildPanelInternal
BOOL LLUICtrlFactory::buildPanelInternal(LLPanel* panelp, LLXMLNodePtr &root, const std::string &filename,
const LLCallbackMap::map_t* factory_map)
{
BOOL didPost = FALSE;
// root must be called panel
if( !root->hasName("panel" ) )
{
llwarns << "Root node should be named panel in : " << filename << llendl;
return didPost;
}
if (factory_map)
{
mFactoryStack.push_front(factory_map);
}
didPost = panelp->initPanelXML(root, NULL, this);
if (LLUI::sShowXUINames)
{
panelp->setToolTip(filename);
}
LLHandle<LLPanel> handle = panelp->getHandle();
mBuiltPanels[handle] = filename;
if (factory_map)
{
mFactoryStack.pop_front();
}
return didPost;
}
示例10: 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;
}
示例11: loadFromFilename
bool LLUIColorTable::loadFromFilename(const std::string& filename, string_color_map_t& table)
{
LLXMLNodePtr root;
if(!LLXMLNode::parseFile(filename, root, NULL))
{
llwarns << "Unable to parse color file " << filename << llendl;
return false;
}
if(!root->hasName("colors"))
{
llwarns << filename << " is not a valid color definition file" << llendl;
return false;
}
Params params;
LLXUIParser parser;
parser.readXUI(root, params, filename);
if(params.validateBlock())
{
insertFromParams(params, table);
}
else
{
llwarns << filename << " failed to load" << llendl;
return false;
}
return true;
}
示例12: parseStrings
//static
bool LLUITrans::parseStrings(const std::string& xml_filename)
{
LLXMLNodePtr root;
BOOL success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root);
if (!success || root.isNull() || !root->hasName( "strings" ))
{
llwarns << "Problem reading strings: " << xml_filename << llendl;
return false;
}
for (LLXMLNode* string = root->getFirstChild();
string != NULL; string = string->getNextSibling())
{
if (!string->hasName("string"))
{
continue;
}
std::string string_name;
if (! string->getAttributeString("name", string_name))
{
llwarns << "Unable to parse string with no name" << llendl;
continue;
}
LLUITransTemplate xml_template(string_name, string->getTextContents());
sStringTemplates[xml_template.mName] = xml_template;
}
return true;
}
示例13: buildContextMenu
//-----------------------------------------------------------------------------
// buildMenu()
//-----------------------------------------------------------------------------
LLContextMenu* LLUICtrlFactory::buildContextMenu(const std::string& filename, LLView* parentp)
{
LLXMLNodePtr root;
if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
{
return NULL;
}
// root must be called panel
if( !root->hasName( LL_PIE_MENU_TAG ))
{
LL_WARNS() << "Root node should be named " << LL_PIE_MENU_TAG << " in : " << filename << LL_ENDL;
return NULL;
}
std::string name("menu");
root->getAttributeString("name", name);
static LLUICachedControl<bool> context("LiruUseContextMenus", false);
LLContextMenu* menu = context ? new LLContextMenu(name) : new LLPieMenu(name);
parentp->addChild(menu);
menu->initXML(root, parentp, this, context);
if (LLUI::sShowXUINames)
{
menu->setToolTip(filename);
}
return menu;
}
示例14: name
//-----------------------------------------------------------------------------
// buildMenu()
//-----------------------------------------------------------------------------
LLPieMenu *LLUICtrlFactory::buildPieMenu(const std::string &filename, LLView* parentp)
{
LLXMLNodePtr root;
if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
{
return NULL;
}
// root must be called panel
if( !root->hasName( LL_PIE_MENU_TAG ))
{
llwarns << "Root node should be named " << LL_PIE_MENU_TAG << " in : " << filename << llendl;
return NULL;
}
std::string name("menu");
root->getAttributeString("name", name);
LLPieMenu *menu = new LLPieMenu(name);
parentp->addChild(menu);
menu->initXML(root, parentp, this);
if (LLUI::sShowXUINames)
{
menu->setToolTip(filename);
}
return menu;
}
示例15: parseLanguageStrings
//static
bool LLTrans::parseLanguageStrings(LLXMLNodePtr &root)
{
std::string xml_filename = "(language strings file)";
if (!root->hasName("strings"))
{
llerrs << "Invalid root node name in " << xml_filename
<< ": was " << root->getName() << ", expected \"strings\"" << llendl;
}
StringTable string_table;
LLXUIParser parser;
parser.readXUI(root, string_table, xml_filename);
if (!string_table.validateBlock())
{
llerrs << "Problem reading strings: " << xml_filename << llendl;
return false;
}
for(LLInitParam::ParamIterator<StringDef>::const_iterator it = string_table.strings.begin();
it != string_table.strings.end();
++it)
{
// share the same map with parseStrings() so we can search the strings using the same getString() function.- angela
LLTransTemplate xml_template(it->name, it->value);
sStringTemplates[xml_template.mName] = xml_template;
}
return true;
}