本文整理汇总了C++中LLUrlMatch::getUrl方法的典型用法代码示例。如果您正苦于以下问题:C++ LLUrlMatch::getUrl方法的具体用法?C++ LLUrlMatch::getUrl怎么用?C++ LLUrlMatch::getUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLUrlMatch
的用法示例。
在下文中一共展示了LLUrlMatch::getUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findUrl
bool LLUrlRegistry::findUrl(const LLWString &text, LLUrlMatch &match, const LLUrlLabelCallback &cb)
{
// boost::regex_search() only works on char or wchar_t
// types, but wchar_t is only 2-bytes on Win32 (not 4).
// So we use UTF-8 to make this work the same everywhere.
std::string utf8_text = wstring_to_utf8str(text);
if (findUrl(utf8_text, match, cb))
{
// we cannot blindly return the start/end offsets from
// the UTF-8 string because it is a variable-length
// character encoding, so we need to update the start
// and end values to be correct for the wide string.
LLWString wurl = utf8str_to_wstring(match.getUrl());
S32 start = text.find(wurl);
if (start == std::string::npos)
{
return false;
}
S32 end = start + wurl.size() - 1;
match.setValues(start, end, match.getUrl(),
match.getLabel(),
match.getTooltip(),
match.getIcon(),
match.getStyle(),
match.getMenuName(),
match.getLocation(),
match.getID(),
match.underlineOnHoverOnly());
return true;
}
return false;
}
示例2: onLLNotification
bool GrowlManager::onLLNotification(const LLSD& notice)
{
if (notice["sigtype"].asString() != "add")
{
return false;
}
LLNotificationPtr notification = LLNotifications::instance().find(notice["id"].asUUID());
std::string name = notification->getName();
LLSD substitutions = notification->getSubstitutions();
if (gGrowlManager->mNotifications.find(name) != gGrowlManager->mNotifications.end())
{
GrowlNotification* growl_notification = &gGrowlManager->mNotifications[name];
std::string body = "";
std::string title = "";
if (growl_notification->useDefaultTextForTitle)
{
title = notification->getMessage();
}
else if (!growl_notification->growlTitle.empty())
{
title = growl_notification->growlTitle;
LLStringUtil::format(title, substitutions);
}
if (growl_notification->useDefaultTextForBody)
{
body = notification->getMessage();
}
else if (!growl_notification->growlBody.empty())
{
body = growl_notification->growlBody;
LLStringUtil::format(body, substitutions);
}
//TM:FS no need to log whats sent to growl
//LL_INFOS("GrowlLLNotification") << "Notice: " << title << ": " << body << LL_ENDL;
if (name == "ObjectGiveItem" || name == "OwnObjectGiveItem" || name == "ObjectGiveItemUnknownUser" || name == "UserGiveItem" || name == "SystemMessageTip")
{
LLUrlMatch urlMatch;
LLWString newLine = utf8str_to_wstring(body);
LLWString workLine = utf8str_to_wstring(body);
while (LLUrlRegistry::instance().findUrl(workLine, urlMatch) && !urlMatch.getUrl().empty())
{
LLWStringUtil::replaceString(newLine, utf8str_to_wstring(urlMatch.getUrl()), utf8str_to_wstring(urlMatch.getLabel()));
// Remove the URL from the work line so we don't end in a loop in case of regular URLs!
// findUrl will always return the very first URL in a string
workLine = workLine.erase(0, urlMatch.getEnd() + 1);
}
body = wstring_to_utf8str(newLine);
}
gGrowlManager->notify(title, body, growl_notification->growlName);
}
return false;
}
示例3: LLUIColor
void object::test<4>()
{
//
// test the getUrl() method
//
LLUrlMatch match;
ensure_equals("getUrl() == ''", match.getUrl(), "");
match.setValues(10, 20, "http://slurl.com/", "", "", "", LLUIColor(), "", "", false,LLUUID::null);
ensure_equals("getUrl() == 'http://slurl.com/'", match.getUrl(), "http://slurl.com/");
match.setValues(10, 20, "", "", "", "", LLUIColor(), "", "", false,LLUUID::null);
ensure_equals("getUrl() == '' (2)", match.getUrl(), "");
}