本文整理汇总了C++中LLSD::beginArray方法的典型用法代码示例。如果您正苦于以下问题:C++ LLSD::beginArray方法的具体用法?C++ LLSD::beginArray怎么用?C++ LLSD::beginArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLSD
的用法示例。
在下文中一共展示了LLSD::beginArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseSimulatorFeatures
void LLMuteList::parseSimulatorFeatures()
{
LLViewerRegion* regionp = gAgent.getRegion();
if (!regionp) return;
LLSD info;
regionp->getSimulatorFeatures(info);
mGodLastNames.clear();
mGodFullNames.clear();
if (info.has("god_names"))
{
if (info["god_names"].has("last_names"))
{
LLSD godNames = info["god_names"]["last_names"];
for (LLSD::array_iterator godNames_it = godNames.beginArray(); godNames_it != godNames.endArray(); ++godNames_it)
mGodLastNames.insert((*godNames_it).asString());
}
if (info["god_names"].has("full_names"))
{
LLSD godNames = info["god_names"]["full_names"];
for (LLSD::array_iterator godNames_it = godNames.beginArray(); godNames_it != godNames.endArray(); ++godNames_it)
mGodFullNames.insert((*godNames_it).asString());
}
}
else // Just use Linden
{
mGodLastNames.insert("Linden");
}
}
示例2: parseData
void HippoGridManager::parseData(LLSD &gridInfo, bool mergeIfNewer)
{
if (mergeIfNewer) {
LLSD::array_const_iterator it, end = gridInfo.endArray();
for (it = gridInfo.beginArray(); it != end; ++it) {
LLSD gridMap = *it;
if (gridMap.has("default_grids_version")) {
int version = gridMap["default_grids_version"];
if (version <= mDefaultGridsVersion) return;
else break;
}
}
if (it == end) {
llwarns << "Grid data has no version number." << llendl;
return;
}
}
llinfos << "Loading grid data." << llendl;
LLSD::array_const_iterator it, end = gridInfo.endArray();
for (it = gridInfo.beginArray(); it != end; ++it) {
LLSD gridMap = *it;
if (gridMap.has("default_grids_version")) {
mDefaultGridsVersion = gridMap["default_grids_version"];
} else if (gridMap.has("gridnick") && gridMap.has("loginuri")) {
std::string gridnick = gridMap["gridnick"];
HippoGridInfo *grid;
GridIterator it = mGridInfo.find(gridnick);
bool newGrid = (it == mGridInfo.end());
if (newGrid) {
// create new grid info
grid = new HippoGridInfo(gridnick);
} else {
// update existing grid info
grid = it->second;
}
grid->setLoginUri(gridMap["loginuri"]);
if (gridMap.has("platform")) grid->setPlatform(gridMap["platform"]);
if (gridMap.has("gridname")) grid->setGridName(gridMap["gridname"]);
if (gridMap.has("loginpage")) grid->setLoginPage(gridMap["loginpage"]);
if (gridMap.has("helperuri")) grid->setHelperUri(gridMap["helperuri"]);
if (gridMap.has("website")) grid->setWebSite(gridMap["website"]);
if (gridMap.has("support")) grid->setSupportUrl(gridMap["support"]);
if (gridMap.has("register")) grid->setRegisterUrl(gridMap["register"]);
if (gridMap.has("password")) grid->setPasswordUrl(gridMap["password"]);
//if (gridMap.has("search")) grid->setSearchUrl(gridMap["search"]);
if (gridMap.has("render_compat")) grid->setRenderCompat(gridMap["render_compat"]);
if (gridMap.has("firstname")) grid->setFirstName(gridMap["firstname"]);
if (gridMap.has("lastname")) grid->setLastName(gridMap["lastname"]);
if (gridMap.has("avatarpassword")) grid->setAvatarPassword(gridMap["avatarpassword"]);
if (newGrid) addGrid(grid);
}
}
}
示例3: addObjectToScrollList
void LLFloaterPathfindingObjects::addObjectToScrollList(const LLPathfindingObjectPtr pObjectPtr, const LLSD &pScrollListItemData)
{
LLScrollListCell::Params cellParams;
//cellParams.font = LLFontGL::getFontSansSerif();
LLScrollListItem::Params rowParams;
rowParams.value = pObjectPtr->getUUID().asString();
llassert(pScrollListItemData.isArray());
for (LLSD::array_const_iterator cellIter = pScrollListItemData.beginArray();
cellIter != pScrollListItemData.endArray(); ++cellIter)
{
const LLSD &cellElement = *cellIter;
llassert(cellElement.has("column"));
llassert(cellElement.get("column").isString());
cellParams.column = cellElement.get("column").asString();
llassert(cellElement.has("value"));
llassert(cellElement.get("value").isString());
cellParams.value = cellElement.get("value").asString();
rowParams.columns.add(cellParams);
}
LLScrollListItem *scrollListItem = mObjectsScrollList->addRow(rowParams);
if (pObjectPtr->hasOwner() && !pObjectPtr->hasOwnerName())
{
mMissingNameObjectsScrollListItems.insert(std::make_pair(pObjectPtr->getUUID().asString(), scrollListItem));
pObjectPtr->registerOwnerNameListener(boost::bind(&LLFloaterPathfindingObjects::handleObjectNameResponse, this, _1));
}
}
示例4: return
bool LLNotificationsListener::Forwarder::matchType(const LLSD& filter, const std::string& type) const
{
// Decide whether this notification matches filter:
// undefined: forward all notifications
if (filter.isUndefined())
{
return true;
}
// array of string: forward any notification matching any named type
if (filter.isArray())
{
for (LLSD::array_const_iterator ti(filter.beginArray()), tend(filter.endArray());
ti != tend; ++ti)
{
if (ti->asString() == type)
{
return true;
}
}
// Didn't match any entry in the array
return false;
}
// string: forward only the specific named type
return (filter.asString() == type);
}
示例5: doPrefetchImages
void LLViewerTextureList::doPrefetchImages()
{
if (LLAppViewer::instance()->getPurgeCache())
{
// cache was purged, no point
return;
}
// Pre-fetch textures from last logout
LLSD imagelist;
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name());
llifstream file;
file.open(filename);
if (file.is_open())
{
LLSDSerialize::fromXML(imagelist, file);
}
for (LLSD::array_iterator iter = imagelist.beginArray();
iter != imagelist.endArray(); ++iter)
{
LLSD imagesd = *iter;
LLUUID uuid = imagesd["uuid"];
S32 pixel_area = imagesd["area"];
S32 texture_type = imagesd["type"];
if(LLViewerTexture::FETCHED_TEXTURE == texture_type || LLViewerTexture::LOD_TEXTURE == texture_type)
{
LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(uuid, MIPMAP_TRUE, LLViewerTexture::BOOST_NONE, texture_type);
if (image)
{
image->addTextureStats((F32)pixel_area);
}
}
}
}
示例6: doPrefetchImages
void LLViewerImageList::doPrefetchImages()
{
#if 1
if (LLAppViewer::instance()->getPurgeCache())
{
// cache was purged, no point
return;
}
// Pre-fetch textures from last logout
LLSD imagelist;
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name());
llifstream file;
file.open(filename);
if (file.is_open())
{
LLSDSerialize::fromXML(imagelist, file);
}
for (LLSD::array_iterator iter = imagelist.beginArray();
iter != imagelist.endArray(); ++iter)
{
LLSD imagesd = *iter;
LLUUID uuid = imagesd["uuid"];
S32 pixel_area = imagesd["area"];
LLViewerImage* image = getImage(uuid, MIPMAP_TRUE, FALSE);
if (image)
{
image->addTextureStats((F32)pixel_area);
}
}
#endif
}
示例7: receivePluginMessage
// This function is called when a new message is received from the plugin.
// We get here when calling mPluginManager->update() in the first line of
// AIFilePicker::multiplex_impl.
//
// Note that we can't call finish() or abort() directly in this function,
// as that deletes mPluginManager and we're using the plugin manager
// right now (to receive this message)!
void AIFilePicker::receivePluginMessage(const LLPluginMessage &message)
{
std::string message_class = message.getClass();
if (message_class == LLPLUGIN_MESSAGE_CLASS_BASIC)
{
std::string message_name = message.getName();
if (message_name == "canceled")
{
LL_DEBUGS("Plugin") << "received message \"canceled\"" << LL_ENDL;
set_state(AIFilePicker_canceled);
}
else if (message_name == "done")
{
LL_DEBUGS("Plugin") << "received message \"done\"" << LL_ENDL;
LLSD filenames = message.getValueLLSD("filenames");
mFilenames.clear();
for(LLSD::array_iterator filename = filenames.beginArray(); filename != filenames.endArray(); ++filename)
{
mFilenames.push_back(*filename);
}
set_state(AIFilePicker_done);
}
else
{
LL_WARNS("Plugin") << "Unknown " << message_class << " class message: " << message_name << LL_ENDL;
}
}
}
示例8: configure
void configure(const LLSD& config)
{
Globals& g = Globals::get();
Settings& s = Settings::get();
g.invalidateCallSites();
s.functionLevelMap.clear();
s.classLevelMap.clear();
s.fileLevelMap.clear();
setPrintLocation(config["print-location"]);
setDefaultLevel(decodeLevel(config["default-level"]));
LLSD sets = config["settings"];
LLSD::array_const_iterator a, end;
for (a = sets.beginArray(), end = sets.endArray(); a != end; ++a)
{
const LLSD& entry = *a;
ELevel level = decodeLevel(entry["level"]);
setLevels(s.functionLevelMap, entry["functions"], level);
setLevels(s.classLevelMap, entry["classes"], level);
setLevels(s.fileLevelMap, entry["files"], level);
}
}
示例9: handleCopyProtectedItem
// static
bool LLGiveInventory::handleCopyProtectedItem(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
LLSD itmes = notification["payload"]["items"];
LLInventoryItem* item = NULL;
switch(option)
{
case 0: // "Yes"
for (LLSD::array_iterator it = itmes.beginArray(); it != itmes.endArray(); it++)
{
item = gInventory.getItem((*it).asUUID());
if (item)
{
LLGiveInventory::commitGiveInventoryItem(notification["payload"]["agent_id"].asUUID(),
item);
// delete it for now - it will be deleted on the server
// quickly enough.
gInventory.deleteObject(item->getUUID());
gInventory.notifyObservers();
}
else
{
LLNotificationsUtil::add("CannotGiveItem");
}
}
break;
default: // no, cancel, whatever, who cares, not yes.
LLNotificationsUtil::add("TransactionCancelled");
break;
}
return false;
}
示例10: updateSuggestedFriendList
bool LLFacebookFriendsPanel::updateSuggestedFriendList()
{
const LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
uuid_vec_t& second_life_friends = mSecondLifeFriends->getIDs();
second_life_friends.clear();
uuid_vec_t& suggested_friends = mSuggestedFriends->getIDs();
suggested_friends.clear();
//Add suggested friends
LLSD friends = LLFacebookConnect::instance().getContent();
for (LLSD::array_const_iterator i = friends.beginArray(); i != friends.endArray(); ++i)
{
LLUUID agent_id = (*i).asUUID();
if (agent_id.notNull())
{
bool second_life_buddy = av_tracker.isBuddy(agent_id);
if (second_life_buddy)
{
second_life_friends.push_back(agent_id);
}
else
{
//FB+SL but not SL friend
suggested_friends.push_back(agent_id);
}
}
}
//Force a refresh when there aren't any filter matches (prevent displaying content that shouldn't display)
mSecondLifeFriends->setDirty(true, !mSecondLifeFriends->filterHasMatches());
mSuggestedFriends->setDirty(true, !mSuggestedFriends->filterHasMatches());
showFriendsAccordionsIfNeeded();
return false;
}
示例11: configure
void configure(const LLSD& config)
{
AIAccess<Settings> settings_w(Settings::get());
AIAccess<Globals>(Globals::get())->invalidateCallSites();
settings_w->functionLevelMap.clear();
settings_w->classLevelMap.clear();
settings_w->fileLevelMap.clear();
settings_w->tagLevelMap.clear();
settings_w->uniqueLogMessages.clear();
setPrintLocation(settings_w, config["print-location"]);
setDefaultLevel(settings_w, decodeLevel(config["default-level"]));
LLSD sets = config["settings"];
LLSD::array_const_iterator a, end;
for (a = sets.beginArray(), end = sets.endArray(); a != end; ++a)
{
const LLSD& entry = *a;
ELevel level = decodeLevel(entry["level"]);
setLevels(settings_w->functionLevelMap, entry["functions"], level);
setLevels(settings_w->classLevelMap, entry["classes"], level);
setLevels(settings_w->fileLevelMap, entry["files"], level);
setLevels(settings_w->tagLevelMap, entry["tags"], level);
}
}
示例12: getContent
/*virtual*/ void httpCompleted()
{
LLSD experiences = getContent()["experience_keys"];
LLSD::array_const_iterator it = experiences.beginArray();
for( /**/ ; it != experiences.endArray(); ++it)
{
const LLSD& row = *it;
LLUUID public_key = row[EXPERIENCE_ID].asUUID();
LL_DEBUGS("ExperienceCache") << "Received result for " << public_key
<< " display '" << row[LLExperienceCache::NAME].asString() << "'" << LL_ENDL ;
processExperience(public_key, row);
}
LLSD error_ids = getContent()["error_ids"];
LLSD::array_const_iterator errIt = error_ids.beginArray();
for( /**/ ; errIt != error_ids.endArray() ; ++errIt )
{
LLUUID id = errIt->asUUID();
LLSD exp;
exp[EXPIRES]=DEFAULT_EXPIRATION;
exp[EXPERIENCE_ID] = id;
exp[PROPERTIES]=PROPERTY_INVALID;
exp[MISSING]=true;
exp[QUOTA] = DEFAULT_QUOTA;
processExperience(id, exp);
LL_WARNS("ExperienceCache") << "LLExperienceResponder::result() error result for " << id << LL_ENDL ;
}
LL_DEBUGS("ExperienceCache") << sCache.size() << " cached experiences" << LL_ENDL;
}
示例13:
/*virtual*/ void result(const LLSD& content)
{
// Pull expiration out of headers if available
F64 expires = LLAvatarNameCache::nameExpirationFromHeaders(mHeaders);
F64 now = LLFrameTimer::getTotalSeconds();
LLSD agents = content["agents"];
LLSD::array_const_iterator it = agents.beginArray();
for ( ; it != agents.endArray(); ++it)
{
const LLSD& row = *it;
LLUUID agent_id = row["id"].asUUID();
LLAvatarName av_name;
av_name.fromLLSD(row);
// Use expiration time from header
av_name.mExpires = expires;
// Some avatars don't have explicit display names set
if (av_name.mDisplayName.empty())
{
av_name.mDisplayName = av_name.mUsername;
}
LL_DEBUGS("AvNameCache") << "LLAvatarNameResponder::result for " << agent_id << " "
<< "user '" << av_name.mUsername << "' "
<< "display '" << av_name.mDisplayName << "' "
<< "expires in " << expires - now << " seconds"
<< LL_ENDL;
// cache it and fire signals
LLAvatarNameCache::processName(agent_id, av_name, true);
}
// Same logic as error response case
LLSD unresolved_agents = content["bad_ids"];
S32 num_unresolved = unresolved_agents.size();
if (num_unresolved > 0)
{
LL_WARNS("AvNameCache") << "LLAvatarNameResponder::result " << num_unresolved << " unresolved ids; "
<< "expires in " << expires - now << " seconds"
<< LL_ENDL;
it = unresolved_agents.beginArray();
for ( ; it != unresolved_agents.endArray(); ++it)
{
const LLUUID& agent_id = *it;
LL_WARNS("AvNameCache") << "LLAvatarNameResponder::result "
<< "failed id " << agent_id
<< LL_ENDL;
LLAvatarNameCache::handleAgentError(agent_id);
}
}
LL_DEBUGS("AvNameCache") << "LLAvatarNameResponder::result "
<< LLAvatarNameCache::sCache.size() << " cached names"
<< LL_ENDL;
}
示例14:
/*virtual*/ void result(const LLSD& content)
{
// Pull expiration out of headers if available
F64 expires = LLAvatarNameCache::nameExpirationFromHeaders(mHeaders);
LLSD agents = content["agents"];
LLSD::array_const_iterator it = agents.beginArray();
for ( ; it != agents.endArray(); ++it)
{
const LLSD& row = *it;
LLUUID agent_id = row["id"].asUUID();
LLAvatarName av_name;
av_name.fromLLSD(row);
// Use expiration time from header
av_name.mExpires = expires;
// Some avatars don't have explicit display names set
if (av_name.mDisplayName.empty())
{
av_name.mDisplayName = av_name.mUsername;
}
// cache it and fire signals
LLAvatarNameCache::processName(agent_id, av_name, true);
}
// Same logic as error response case
LLSD unresolved_agents = content["bad_ids"];
if (unresolved_agents.size() > 0)
{
const std::string DUMMY_NAME("\?\?\?");
LLAvatarName av_name;
av_name.mUsername = DUMMY_NAME;
av_name.mDisplayName = DUMMY_NAME;
av_name.mIsDisplayNameDefault = false;
av_name.mIsDummy = true;
av_name.mExpires = expires;
it = unresolved_agents.beginArray();
for ( ; it != unresolved_agents.endArray(); ++it)
{
const LLUUID& agent_id = *it;
// cache it and fire signals
// Wolfspirit: Do not use ??? as username. Try to get a username out of the old legacy name
std::string oldname;
gCacheName->getFullName(agent_id, oldname);
LLStringUtil::toLower(oldname);
LLStringUtil::replaceString(oldname," ",".");
LLStringUtil::replaceString(oldname,".resident","");
av_name.mUsername = oldname;
LLAvatarNameCache::processName(agent_id, av_name, true);
}
}
}
示例15: setWhiteList
U32 LLMediaEntry::setWhiteList( const LLSD &whitelist )
{
// If whitelist is undef, the whitelist is cleared
if (whitelist.isUndefined())
{
mWhiteList.clear();
return LSL_STATUS_OK;
}
// However, if the whitelist is an empty array, erase it.
if (whitelist.isArray())
{
// *NOTE: This code is VERY similar to the setWhitelist above.
// IF YOU CHANGE THIS IMPLEMENTATION, BE SURE TO CHANGE THE OTHER!
U32 size = 0;
U32 count = 0;
// First check to make sure the size and count constraints are not violated
LLSD::array_const_iterator iter = whitelist.beginArray();
LLSD::array_const_iterator end = whitelist.endArray();
for ( ; iter < end; ++iter)
{
const std::string &entry = (*iter).asString();
size += entry.length() + 1; // Include one for \0
count ++;
if (size > MAX_WHITELIST_SIZE || count > MAX_WHITELIST_COUNT)
{
return LSL_STATUS_BOUNDS_ERROR;
}
}
// Next clear the vector
mWhiteList.clear();
// Then re-iterate and copy entries
iter = whitelist.beginArray();
for ( ; iter < end; ++iter)
{
const std::string &entry = (*iter).asString();
mWhiteList.push_back(entry);
}
return LSL_STATUS_OK;
}
else
{
return LSL_STATUS_MALFORMED_PARAMS;
}
}