本文整理汇总了C++中LLURI函数的典型用法代码示例。如果您正苦于以下问题:C++ LLURI函数的具体用法?C++ LLURI怎么用?C++ LLURI使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LLURI函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkParts
void URITestObject::test<4>()
{
// scheme w/o paths
checkParts(LLURI("mailto:[email protected]"),
"mailto", "[email protected]", "", "");
checkParts(LLURI("silly://abc/def?foo"),
"silly", "//abc/def?foo", "", "");
}
示例2: downloadMarkerPath
void LLUpdateDownloader::Implementation::resume(void)
{
mCancelled = false;
if(isDownloading()) {
mClient.downloadError("download in progress");
}
mDownloadRecordPath = downloadMarkerPath();
llifstream dataStream(mDownloadRecordPath);
if(!dataStream) {
mClient.downloadError("no download marker");
return;
}
LLSDSerialize::fromXMLDocument(mDownloadData, dataStream);
if(!mDownloadData.asBoolean()) {
mClient.downloadError("no download information in marker");
return;
}
std::string filePath = mDownloadData["path"].asString();
try {
if(LLFile::isfile(filePath)) {
llstat fileStatus;
LLFile::stat(filePath, &fileStatus);
if(fileStatus.st_size != mDownloadData["size"].asInteger()) {
resumeDownloading(fileStatus.st_size);
} else if(!validateDownload()) {
LLFile::remove(filePath);
download(LLURI(mDownloadData["url"].asString()),
mDownloadData["hash"].asString(),
mDownloadData["update_version"].asString(),
mDownloadData["required"].asBoolean());
} else {
mClient.downloadComplete(mDownloadData);
}
} else {
download(LLURI(mDownloadData["url"].asString()),
mDownloadData["hash"].asString(),
mDownloadData["update_version"].asString(),
mDownloadData["required"].asBoolean());
}
} catch(DownloadError & e) {
mClient.downloadError(e.what());
}
}
示例3: startInternetStream
// virtual
void LLAudioEngine::startInternetStream(const std::string& url)
{
llinfos << "entered startInternetStream()" << llendl;
if (!mInternetStreamMedia)
{
LLMediaManager* mgr = LLMediaManager::getInstance();
if (mgr)
{
mInternetStreamMedia = mgr->createSourceFromMimeType(LLURI(url).scheme(), "audio/mpeg"); // assumes that whatever media implementation supports mp3 also supports vorbis.
llinfos << "mInternetStreamMedia is now " << mInternetStreamMedia << llendl;
}
}
if(!mInternetStreamMedia)
return;
if (!url.empty()) {
llinfos << "Starting internet stream: " << url << llendl;
mInternetStreamURL = url;
#if LL_QUICKTIME_ENABLED
mInternetStreamMedia->navigateTo ( createListenPls(url) );
#else
mInternetStreamMedia->navigateTo ( url );
#endif
llinfos << "Playing....." << llendl;
mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_START);
mInternetStreamMedia->updateMedia();
} else {
llinfos << "setting stream to NULL"<< llendl;
mInternetStreamURL.clear();
mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP);
mInternetStreamMedia->updateMedia();
}
}
示例4: LLURI
std::string LLUrlEntryRegion::getLocation(const std::string &url) const
{
LLSD path_array = LLURI(url).pathArray();
std::string region_name = unescapeUrl(path_array[2]);
LL_DEBUGS("UrlEntry") << "location " << region_name << LL_ENDL;
return region_name;
}
示例5: LLURI
// virtual
LLSD LLAssetStorage::getPendingDetailsImpl(const LLAssetStorage::request_list_t* requests,
LLAssetType::EType asset_type,
const std::string& detail_prefix) const
{
LLSD details;
if (requests)
{
request_list_t::const_iterator it = requests->begin();
request_list_t::const_iterator end = requests->end();
for ( ; it != end; ++it)
{
LLAssetRequest* req = *it;
if ( (LLAssetType::AT_NONE == asset_type)
|| (req->getType() == asset_type) )
{
LLSD row = req->getTerseDetails();
std::ostringstream detail;
detail << detail_prefix << "/" << LLAssetType::lookup(req->getType())
<< "/" << req->getUUID();
row["detail"] = LLURI(detail.str());
details.append(row);
}
}
}
return details;
}
示例6: sanitizeUri
void HippoGridInfo::setLoginUri(const std::string& loginUri)
{
std::string uri = loginUri;
mLoginUri = sanitizeUri(uri);
if (utf8str_tolower(LLURI(uri).hostName()) == "login.agni.lindenlab.com")
{
mIsInProductionGrid = true;
}
}
示例7: sanitizeUri
void HippoGridInfo::setLoginUri(const std::string& loginUri)
{
mLoginUri = sanitizeUri(loginUri);
if (utf8str_tolower(LLURI(mLoginUri).hostName()) == "login.agni.lindenlab.com")
{
mIsInProductionGrid = true;
useHttps();
setPlatform(PLATFORM_SECONDLIFE);
}
else if (utf8str_tolower(LLURI(mLoginUri).hostName()) == "login.aditi.lindenlab.com")
{
useHttps();
setPlatform(PLATFORM_SECONDLIFE);
}
else if (utf8str_tolower(LLURI(mLoginUri).hostName()) == "login.avination.com" ||
utf8str_tolower(LLURI(mLoginUri).hostName()) == "login.avination.net")
{
mIsInAvination = true;
useHttps();
}
}
示例8: startInternetStream
// virtual
void LLAudioEngine::startInternetStream(const std::string& url)
{
llinfos << "entered startInternetStream()" << llendl;
if (!mInternetStreamMedia)
{
LLMediaManager* mgr = LLMediaManager::getInstance();
if (mgr)
{
mInternetStreamMedia = mgr->createSourceFromMimeType(LLURI(url).scheme(), "audio/mpeg"); // assumes that whatever media implementation supports mp3 also supports vorbis.
llinfos << "mInternetStreamMedia is now " << mInternetStreamMedia << llendl;
}
}
if(!mInternetStreamMedia)
{
return;
}
// Check for a dead stream from gstreamer, just in case
else if(getStatus() == LLMediaBase::STATUS_DEAD)
{
llinfos << "don't play dead stream urls"<< llendl;
mInternetStreamURL.clear();
mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP);
mInternetStreamMedia->updateMedia();
stopInternetStream();
}
else if (url.empty())
{
llinfos << "url is emptly. Setting stream to NULL"<< llendl;
mInternetStreamURL.clear();
mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP);
mInternetStreamMedia->updateMedia();
}
// Stream appears to be good, attempting to play
else
{
// stop any other stream first
stopInternetStream();
llinfos << "Starting internet stream: " << url << llendl;
mInternetStreamURL = url;
mInternetStreamMedia->navigateTo(url);
//llinfos << "Playing....." << llendl;
mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_START);
mInternetStreamMedia->updateMedia();
mStatus = LLMediaBase::STATUS_STARTED;
}
}
示例9: LLURI
// static
LLURI LLURI::buildHTTP(const std::string& prefix,
const LLSD& path)
{
LLURI result;
// TODO: deal with '/' '?' '#' in host_port
if (prefix.find("://") != prefix.npos)
{
// it is a prefix
result = LLURI(prefix);
}
else
{
// it is just a host and optional port
result.mScheme = "http";
result.mEscapedAuthority = escapeHostAndPort(prefix);
}
if (path.isArray())
{
// break out and escape each path component
for (LLSD::array_const_iterator it = path.beginArray();
it != path.endArray();
++it)
{
lldebugs << "PATH: inserting " << it->asString() << llendl;
result.mEscapedPath += "/" + escapePathComponent(it->asString());
}
}
else if(path.isString())
{
result.mEscapedPath += "/" + escapePathComponent(path.asString());
}
else if(path.isUndefined())
{
// do nothing
}
else
{
llwarns << "Valid path arguments to buildHTTP are array, string, or undef, you passed type"
<< path.type() << llendl;
}
result.mEscapedOpaque = "//" + result.mEscapedAuthority +
result.mEscapedPath;
return result;
}
示例10: LLURI
void FSPanelLogin::loadLoginPage()
{
if (!sInstance) return;
LLURI login_page = LLURI(LLGridManager::getInstance()->getLoginPage());
LLSD params(login_page.queryMap());
LL_DEBUGS("AppInit") << "login_page: " << login_page << LL_ENDL;
// Language
params["lang"] = LLUI::getLanguage();
// First Login?
if (gSavedSettings.getBOOL("FirstLoginThisInstall"))
{
params["firstlogin"] = "TRUE"; // not bool: server expects string TRUE
}
// Channel and Version
params["version"] = llformat("%s (%d)",
LLVersionInfo::getShortVersion().c_str(),
LLVersionInfo::getBuild());
params["channel"] = LLVersionInfo::getChannel();
// Grid
params["grid"] = LLGridManager::getInstance()->getGridId();
// add OS info
params["os"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
// sourceid
params["sourceid"] = gSavedSettings.getString("sourceid");
// Make an LLURI with this augmented info
LLURI login_uri(LLURI::buildHTTP(login_page.authority(),
login_page.path(),
params));
LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
if (web_browser->getCurrentNavUrl() != login_uri.asString())
{
LL_DEBUGS("AppInit") << "loading: " << login_uri << LL_ENDL;
web_browser->navigateTo( login_uri.asString(), HTTP_CONTENT_TEXT_HTML );
}
}
示例11: u
void URITestObject::test<18>()
{
LLURI u("GIS:///app/login?first_name=Testert4&last_name=Tester&web_login_key=test");
// if GIS is the scheme, LLURI should parse /app/login as path, with no authority
ensure_equals("scheme", u.scheme(), "GIS");
ensure_equals("authority", u.authority(), "");
ensure_equals("path", u.path(), "/app/login");
ensure_equals("pathmap", u.pathArray()[0].asString(), "app");
ensure_equals("pathmap", u.pathArray()[1].asString(), "login");
ensure_equals("query", u.query(), "first_name=Testert4&last_name=Tester&web_login_key=test");
ensure_equals("query map element", u.queryMap()["last_name"].asString(), "Tester");
u = LLURI("GIS://Da Boom/128/128/128");
// if GIS is the scheme, LLURI should parse /128/128/128 as path, with Da Boom as authority
ensure_equals("scheme", u.scheme(), "GIS");
ensure_equals("authority", u.authority(), "Da Boom");
ensure_equals("path", u.path(), "/128/128/128");
ensure_equals("pathmap", u.pathArray()[0].asString(), "128");
ensure_equals("pathmap", u.pathArray()[1].asString(), "128");
ensure_equals("pathmap", u.pathArray()[2].asString(), "128");
ensure_equals("query", u.query(), "");
}
示例12: candidate_uri
// static
bool LLMediaEntry::checkUrlAgainstWhitelist(const std::string& url,
const std::vector<std::string> &whitelist)
{
bool passes = true;
// *NOTE: no entries? Don't check
if (whitelist.size() > 0)
{
passes = false;
// Case insensitive: the reason why we toUpper both this and the
// filter
std::string candidate_url = url;
// Use lluri to see if there is a path part in the candidate URL. No path? Assume "/"
LLURI candidate_uri(candidate_url);
std::vector<std::string>::const_iterator iter = whitelist.begin();
std::vector<std::string>::const_iterator end = whitelist.end();
for ( ; iter < end; ++iter )
{
std::string filter = *iter;
LLURI filter_uri(filter);
bool scheme_passes = pattern_match( candidate_uri.scheme(), filter_uri.scheme() );
if (filter_uri.scheme().empty())
{
filter_uri = LLURI(DEFAULT_URL_PREFIX + filter);
}
bool authority_passes = pattern_match( candidate_uri.authority(), filter_uri.authority() );
bool path_passes = pattern_match( candidate_uri.escapedPath(), filter_uri.escapedPath() );
if (scheme_passes && authority_passes && path_passes)
{
passes = true;
break;
}
}
}
return passes;
}
示例13: LLURI
void LLPanelLogin::loadLoginPage()
{
if (!sInstance) return;
std::string login_page = gHippoGridManager->getCurrentGrid()->getLoginPage();
if (login_page.empty())
{
sInstance->setSiteIsAlive(false);
return;
}
std::ostringstream oStr;
oStr << login_page;
// Use the right delimeter depending on how LLURI parses the URL
LLURI login_page_uri = LLURI(login_page);
std::string first_query_delimiter = "&";
if (login_page_uri.queryMap().size() == 0)
{
first_query_delimiter = "?";
}
// Language
std::string language = LLUI::getLanguage();
oStr << first_query_delimiter<<"lang=" << language;
// First Login?
if (gSavedSettings.getBOOL("FirstLoginThisInstall"))
{
oStr << "&firstlogin=TRUE";
}
// Channel and Version
std::string version = llformat("%d.%d.%d %s",
ViewerVersion::getImpMajorVersion(), ViewerVersion::getImpMinorVersion(),
ViewerVersion::getImpPatchVersion(), ViewerVersion::getImpTestVersion().c_str() );
char* curl_channel = curl_escape(gSavedSettings.getString("VersionChannelName").c_str(), 0);
char* curl_version = curl_escape(version.c_str(), 0);
oStr << "&channel=" << curl_channel;
oStr << "&version=" << curl_version;
curl_free(curl_channel);
curl_free(curl_version);
// Grid
char* curl_grid = curl_escape(LLViewerLogin::getInstance()->getGridLabel().c_str(), 0);
oStr << "&grid=" << curl_grid;
curl_free(curl_grid);
gViewerWindow->setMenuBackgroundColor(false, !LLViewerLogin::getInstance()->isInProductionGrid());
//LLViewerLogin::getInstance()->setMenuColor();
gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor());
#if USE_VIEWER_AUTH
LLURLSimString::sInstance.parse();
std::string location;
std::string region;
std::string password;
if (LLURLSimString::parse())
{
std::ostringstream oRegionStr;
location = "specify";
oRegionStr << LLURLSimString::sInstance.mSimName << "/" << LLURLSimString::sInstance.mX << "/"
<< LLURLSimString::sInstance.mY << "/"
<< LLURLSimString::sInstance.mZ;
region = oRegionStr.str();
}
else
{
if (gSavedSettings.getBOOL("LoginLastLocation"))
{
location = "last";
}
else
{
location = "home";
}
}
std::string firstname, lastname;
if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
{
LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
firstname = cmd_line_login[0].asString();
lastname = cmd_line_login[1].asString();
password = cmd_line_login[2].asString();
}
if (firstname.empty())
{
firstname = gSavedSettings.getString("FirstName");
}
//.........这里部分代码省略.........
示例14: LLURI
void LLPanelLogin::loadLoginPage()
{
if (!sInstance) return;
sInstance->updateGridCombo();
std::ostringstream oStr;
std::string login_page = gHippoGridManager->getConnectedGrid()->getLoginPage();
if (login_page.empty())
{
sInstance->setSiteIsAlive(false);
return;
}
oStr << login_page;
// Use the right delimeter depending on how LLURI parses the URL
LLURI login_page_uri = LLURI(login_page);
std::string first_query_delimiter = "&";
if (login_page_uri.queryMap().size() == 0)
{
first_query_delimiter = "?";
}
// Language
std::string language = LLUI::getLanguage();
oStr << first_query_delimiter<<"lang=" << language;
// First Login?
if (gSavedSettings.getBOOL("FirstLoginThisInstall"))
{
oStr << "&firstlogin=TRUE";
}
std::string version = llformat("%d.%d.%d (%d)",
LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VERSION_BUILD);
if(login_page.find("secondlife.com") == -1) {
oStr << "&channel=" << LLWeb::curlEscape(LL_CHANNEL);
oStr << "&version=" << LLWeb::curlEscape(version);
}
// Grid
oStr << "&grid=" << LLWeb::curlEscape(LLViewerLogin::getInstance()->getGridLabel());
if (gHippoGridManager->getConnectedGrid()->isSecondLife()) {
// find second life grid from login URI
// yes, this is heuristic, but hey, it is just to get the right login page...
std::string tmp = gHippoGridManager->getConnectedGrid()->getLoginUri();
int i = tmp.find(".lindenlab.com");
if (i != std::string::npos) {
tmp = tmp.substr(0, i);
i = tmp.rfind('.');
if (i == std::string::npos)
i = tmp.rfind('/');
if (i != std::string::npos) {
tmp = tmp.substr(i+1);
oStr << "&grid=" << LLWeb::curlEscape(tmp);
}
}
}
gViewerWindow->setMenuBackgroundColor(false, !LLViewerLogin::getInstance()->isInProductionGrid());
gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor());
#if USE_VIEWER_AUTH
LLURLSimString::sInstance.parse();
std::string location;
std::string region;
std::string password;
if (LLURLSimString::parse())
{
std::ostringstream oRegionStr;
location = "specify";
oRegionStr << LLURLSimString::sInstance.mSimName << "/" << LLURLSimString::sInstance.mX << "/"
<< LLURLSimString::sInstance.mY << "/"
<< LLURLSimString::sInstance.mZ;
region = oRegionStr.str();
}
else
{
if (gSavedSettings.getBOOL("LoginLastLocation"))
{
location = "last";
}
else
{
location = "home";
}
}
std::string firstname, lastname;
if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
{
LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
firstname = cmd_line_login[0].asString();
//.........这里部分代码省略.........
示例15: LLURI
void LLPanelLogin::loadLoginPage()
{
if (!sInstance) return;
std::ostringstream oStr;
LLViewerLogin* vl = LLViewerLogin::getInstance();
std::string login_page = vl->getLoginPageURI();
if (login_page.empty())
{
login_page = sInstance->getString( "real_url" );
vl->setLoginPageURI(login_page);
}
oStr << login_page;
// Use the right delimeter depending on how LLURI parses the URL
LLURI login_page_uri = LLURI(login_page);
std::string first_query_delimiter = "&";
if (login_page_uri.queryMap().size() == 0)
{
first_query_delimiter = "?";
}
// Language
std::string language = LLUI::getLanguage();
oStr << first_query_delimiter<<"lang=" << language;
// First Login?
if (gSavedSettings.getBOOL("FirstLoginThisInstall"))
{
oStr << "&firstlogin=TRUE";
}
// Channel and Version
std::string version = llformat("%d.%d.%d (%d)",
LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD);
char* curl_channel = curl_escape(LL_CHANNEL, 0);
char* curl_version = curl_escape(version.c_str(), 0);
char* curl_t = curl_escape(LLAppViewer::instance()->getWindowTitle().c_str(), 0);
oStr << "&channel=" << curl_channel;
oStr << "&version=" << curl_version;
oStr << "&t=" << curl_t;
if(LL_CHANNEL != EMERALD_RELEASE_CHANNEL)
oStr << "&unsupported=1";
curl_free(curl_channel);
curl_free(curl_version);
curl_free(curl_t);
// grid=blah code was here. Due to the implementation of the Emerald login manager, sending
// this information is a very bad idea. Don't do it.
gViewerWindow->setMenuBackgroundColor(false, !LLViewerLogin::getInstance()->isInProductionGrid());
gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor());
#if USE_VIEWER_AUTH
LLURLSimString::sInstance.parse();
std::string location;
std::string region;
std::string password;
if (LLURLSimString::parse())
{
std::ostringstream oRegionStr;
location = "specify";
oRegionStr << LLURLSimString::sInstance.mSimName << "/" << LLURLSimString::sInstance.mX << "/"
<< LLURLSimString::sInstance.mY << "/"
<< LLURLSimString::sInstance.mZ;
region = oRegionStr.str();
}
else
{
if (gSavedSettings.getBOOL("LoginLastLocation"))
{
location = "last";
}
else
{
location = "home";
}
}
std::string firstname, lastname;
if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
{
LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
firstname = cmd_line_login[0].asString();
lastname = cmd_line_login[1].asString();
password = cmd_line_login[2].asString();
}
if (firstname.empty())
{
firstname = gSavedSettings.getString("FirstName");
}
//.........这里部分代码省略.........