本文整理汇总了C++中LLSD::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ LLSD::erase方法的具体用法?C++ LLSD::erase怎么用?C++ LLSD::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLSD
的用法示例。
在下文中一共展示了LLSD::erase方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dispatchApp
// static
bool LLURLDispatcherImpl::dispatchApp(const std::string& url,
bool right_mouse,
LLMediaCtrl* web,
bool trusted_browser)
{
// ensure the URL is in the secondlife:///app/ format
if (!LLSLURL::isSLURLCommand(url))
{
return false;
}
LLURI uri(url);
LLSD pathArray = uri.pathArray();
pathArray.erase(0); // erase "app"
std::string cmd = pathArray.get(0);
pathArray.erase(0); // erase "cmd"
bool handled = LLCommandDispatcher::dispatch(
cmd, pathArray, uri.queryMap(), web, trusted_browser);
// alert if we didn't handle this secondlife:///app/ SLURL
// (but still return true because it is a valid app SLURL)
if (! handled)
{
LLNotificationsUtil::add("UnsupportedCommandSLURL");
}
return true;
}
示例2: get
void SDTestObject::test<10>()
// map operations
{
SDCleanupCheck check;
LLSD v;
ensure("undefined has no members", !v.has("amy"));
ensure("undefined get() is undefined", v.get("bob").isUndefined());
v = LLSD::emptyMap();
ensure("empty map is a map", v.isMap());
ensure("empty map has no members", !v.has("cam"));
ensure("empty map get() is undefined", v.get("don").isUndefined());
v.clear();
v.insert("eli", 43);
ensure("insert converts to map", v.isMap());
ensure("inserted key is present", v.has("eli"));
ensureTypeAndValue("inserted value", v.get("eli"), 43);
v.insert("fra", false);
ensure("first key still present", v.has("eli"));
ensure("second key is present", v.has("fra"));
ensureTypeAndValue("first value", v.get("eli"), 43);
ensureTypeAndValue("second value", v.get("fra"), false);
v.erase("eli");
ensure("first key now gone", !v.has("eli"));
ensure("second key still present", v.has("fra"));
ensure("first value gone", v.get("eli").isUndefined());
ensureTypeAndValue("second value sill there", v.get("fra"), false);
v.erase("fra");
ensure("second key now gone", !v.has("fra"));
ensure("second value gone", v.get("fra").isUndefined());
v["gil"] = (std::string)"good morning";
ensure("third key present", v.has("gil"));
ensureTypeAndValue("third key value", v.get("gil"), "good morning");
const LLSD& cv = v; // FIX ME IF POSSIBLE
ensure("missing key", cv["ham"].isUndefined());
ensure("key not present", !v.has("ham"));
LLSD w = 43;
const LLSD& cw = w; // FIX ME IF POSSIBLE
int i = cw["ian"];
ensureTypeAndValue("other missing value", i, 0);
ensure("other missing key", !w.has("ian"));
ensure("no conversion", w.isInteger());
LLSD x;
x = v;
ensure("copy map type", x.isMap());
ensureTypeAndValue("copy map value gil", x.get("gil"), "good morning");
}
示例3: asLLSD
//
// LLSD functions
//
void LLMediaEntry::asLLSD(LLSD& sd) const
{
// "general" fields
sd[ALT_IMAGE_ENABLE_KEY] = mAltImageEnable;
sd[CONTROLS_KEY] = (LLSD::Integer)mControls;
sd[CURRENT_URL_KEY] = mCurrentURL;
sd[HOME_URL_KEY] = mHomeURL;
sd[AUTO_LOOP_KEY] = mAutoLoop;
sd[AUTO_PLAY_KEY] = mAutoPlay;
sd[AUTO_SCALE_KEY] = mAutoScale;
sd[AUTO_ZOOM_KEY] = mAutoZoom;
sd[FIRST_CLICK_INTERACT_KEY] = mFirstClickInteract;
sd[WIDTH_PIXELS_KEY] = mWidthPixels;
sd[HEIGHT_PIXELS_KEY] = mHeightPixels;
// "security" fields
sd[WHITELIST_ENABLE_KEY] = mWhiteListEnable;
sd.erase(WHITELIST_KEY);
for (U32 i=0; i<mWhiteList.size(); i++)
{
sd[WHITELIST_KEY].append(mWhiteList[i]);
}
// "permissions" fields
sd[PERMS_INTERACT_KEY] = mPermsInteract;
sd[PERMS_CONTROL_KEY] = mPermsControl;
}
示例4: onClickRemoveURLFilter
// static
void LLPanelLandMedia::onClickRemoveURLFilter(void *data)
{
LLPanelLandMedia* panelp = (LLPanelLandMedia*)data;
if (panelp && panelp->mURLFilterList)
{
LLParcel* parcel = panelp->mParcel->getParcel();
if (parcel)
{
LLSD list = parcel->getMediaURLFilterList();
std::vector<LLScrollListItem*> domains = panelp->mURLFilterList->getAllSelected();
for (std::vector<LLScrollListItem*>::iterator iter = domains.begin(); iter != domains.end(); iter++)
{
LLScrollListItem* item = *iter;
const std::string domain = item->getValue().asString();
for(S32 i = 0; i < list.size(); i++)
{
if (list[i].asString() == domain)
{
list.erase(i);
break;
}
}
}
parcel->setMediaURLFilterList(list);
LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
panelp->refresh();
}
}
}
示例5: lsltobridge
bool JCLSLBridge::lsltobridge(std::string message, std::string from_name, LLUUID source_id, LLUUID owner_id)
{
if(message == "someshit")
{
////cmdline_printchat("got someshit from "+source_id.asString());
return true;
}else
{
std::string clip = message.substr(0,5);
if(clip == "#@#@#")
{
std::string rest = message.substr(5);
LLSD arguments = JCLSLBridge::parse_string_to_list(rest, '|');
////cmdline_printchat(std::string(LLSD::dumpXML(arguments)));
U32 call = atoi(arguments[0].asString().c_str());
if(call)
{
arguments.erase(0);
////cmdline_printchat(std::string(LLSD::dumpXML(arguments)));
callback_fire(call, arguments);
return true;
}
}else if(clip == "rotat")
{
LLViewerObject* obj = gObjectList.findObject(source_id);
if(obj)
{
if(obj->isAttachment())
{
if(owner_id == gAgent.getID())
{
std::string rot = message.substr(5);
LLQuaternion rotation;
if(LLQuaternion::parseQuat(rot,&rotation))
{
//cmdline_printchat("script rotating!");
gAgent.getAvatarObject()->setRotation(rotation,TRUE);
}else
{
//cmdline_printchat("script rotate failed");
}
}
}
}
}else if(message.substr(0,3) == "l2c")
{
std::string lolnum = message.substr(3);
//cmdline_printchat("num="+lolnum);
l2c = atoi(lolnum.c_str());
//cmdline_printchat("rnum="+llformat("%d",l2c));
l2c_inuse = true;
return true;
}
}
return false;
}
示例6: dispatchApp
// static
bool LLURLDispatcherImpl::dispatchApp(const std::string& url,
bool right_mouse,
LLWebBrowserCtrl* web,
bool trusted_browser)
{
if (!isSLURL(url))
{
return false;
}
LLURI uri(url);
LLSD pathArray = uri.pathArray();
pathArray.erase(0); // erase "app"
std::string cmd = pathArray.get(0);
pathArray.erase(0); // erase "cmd"
bool handled = LLCommandDispatcher::dispatch(
cmd, pathArray, uri.queryMap(), web, trusted_browser);
return handled;
}
示例7: dispatchApp
// static
bool LLURLDispatcherImpl::dispatchApp(const std::string& url,
bool right_mouse,
LLMediaCtrl* web,
bool trusted_browser)
{
// we support legacy secondlife:///app links as well as inworldz:/// *only* in the text editor -- MC
if (isIZURL(url) || isSLURL(url))
{
LLURI uri(url);
LLSD pathArray = uri.pathArray();
pathArray.erase(0); // erase "app"
std::string cmd = pathArray.get(0);
pathArray.erase(0); // erase "cmd"
bool handled = LLCommandDispatcher::dispatch(
cmd, pathArray, uri.queryMap(), web, trusted_browser);
return handled;
}
return false;
}
示例8: onOpen
void LLPanelProfile::onOpen(const LLSD& key)
{
// open the desired panel
if (key.has("open_tab_name"))
{
getTabContainer()[PANEL_PICKS]->onClosePanel();
// onOpen from selected panel will be called from onTabSelected callback
getTabCtrl()->selectTabByName(key["open_tab_name"]);
}
else
{
getTabCtrl()->getCurrentPanel()->onOpen(getAvatarId());
}
// support commands to open further pieces of UI
if (key.has("show_tab_panel"))
{
std::string panel = key["show_tab_panel"].asString();
if (panel == "create_classified")
{
LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]);
if (picks)
{
picks->createNewClassified();
}
}
else if (panel == "classified_details")
{
LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]);
if (picks)
{
LLSD params = key;
params.erase("show_tab_panel");
params.erase("open_tab_name");
picks->openClassifiedInfo(params);
}
}
}
}
示例9: onOpen
void LLPanelProfile::onOpen(const LLSD& key)
{
getTabContainer()[PANEL_PICKS]->onOpen(getAvatarId());
// support commands to open further pieces of UI
if (key.has("show_tab_panel"))
{
std::string panel = key["show_tab_panel"].asString();
if (panel == "create_classified")
{
LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]);
if (picks)
{
picks->createNewClassified();
}
}
else if (panel == "classified_details")
{
LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]);
if (picks)
{
LLSD params = key;
params.erase("show_tab_panel");
params.erase("open_tab_name");
picks->openClassifiedInfo(params);
}
}
else if (panel == "edit_classified")
{
LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]);
if (picks)
{
LLSD params = key;
params.erase("show_tab_panel");
params.erase("open_tab_name");
picks->openClassifiedEdit(params);
}
}
else if (panel == "create_pick")
{
LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]);
if (picks)
{
picks->createNewPick();
}
}
else if (panel == "edit_pick")
{
LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]);
if (picks)
{
LLSD params = key;
params.erase("show_tab_panel");
params.erase("open_tab_name");
picks->openPickEdit(params);
}
}
}
}
示例10: del
virtual void del(
LLHTTPNode::ResponsePtr response,
const LLSD& context) const
{
std::string name = context["request"]["wildcard"]["option-name"];
LLSD options = LLApp::instance()->getOptionData(
LLApp::PRIORITY_RUNTIME_OVERRIDE);
options.erase(name);
LLApp::instance()->setOptionData(
LLApp::PRIORITY_RUNTIME_OVERRIDE,
options);
response->result(LLSD());
}
示例11: FriendImportState
void LLPanelFriends::FriendImportState(LLUUID id, bool accepted)
{
std::string importstate = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "friendimportstate.dat");
if(LLFile::isfile(importstate))
{
llifstream importer(importstate);
LLSD data;
LLSDSerialize::fromXMLDocument(data, importer);
if(!data.has(id.asString()))return;
LLSD user = data[id.asString()];
if(accepted)
{
BOOL can_map = user["can_map"].asBoolean();
BOOL can_mod = user["can_mod"].asBoolean();
BOOL see_online = user["see_online"].asBoolean();
S32 rights = 0;
if(can_map)rights |= LLRelationship::GRANT_MAP_LOCATION;
if(can_mod)rights |= LLRelationship::GRANT_MODIFY_OBJECTS;
if(see_online)rights |= LLRelationship::GRANT_ONLINE_STATUS;
if(is_agent_friend(id))//is this legit shit yo
{
const LLRelationship* friend_status = LLAvatarTracker::instance().getBuddyInfo(id);
if(friend_status)
{
S32 tr = friend_status->getRightsGrantedTo();
if(tr != rights)
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_GrantUserRights);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUID(_PREHASH_AgentID, gAgent.getID());
msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_Rights);
msg->addUUID(_PREHASH_AgentRelated, id);
msg->addS32(_PREHASH_RelatedRights, rights);
gAgent.sendReliableMessage();
}
}
}
}
data.erase(id.asString());//if they declined then we need to forget about it, if they accepted it is done
llofstream export_file;
export_file.open(importstate);
LLSDSerialize::toPrettyXML(data, export_file);
export_file.close();
}
}
示例12: error
//.........这里部分代码省略.........
// map element matching
data_map["foo"] = LLSD::String();
ensure_equals("undefined prototype map entry", llsd_matches(proto_map, data_map), "");
proto_map["foo"] = LLSD::Binary();
ensure_equals("scalar prototype map entry", llsd_matches(proto_map, data_map),
"['foo']: Binary required instead of String");
data_map["foo"] = LLSD::Binary();
ensure_equals("matching prototype map entry", llsd_matches(proto_map, data_map), "");
// String
{
static const char* matches[] = { "String", "NumString", "Boolean", "Integer",
"Real", "UUID", "Date", "URI" };
test_matches("String", map, boost::begin(matches), boost::end(matches));
}
// Boolean, Integer, Real
static const char* numerics[] = { "Boolean", "Integer", "Real" };
for (const char **ni = boost::begin(numerics), **nend = boost::end(numerics);
ni != nend; ++ni)
{
static const char* matches[] = { "Boolean", "Integer", "Real", "String", "NumString" };
test_matches(*ni, map, boost::begin(matches), boost::end(matches));
}
// UUID
{
static const char* matches[] = { "UUID", "String", "NumString" };
test_matches("UUID", map, boost::begin(matches), boost::end(matches));
}
// Date
{
static const char* matches[] = { "Date", "String", "NumString" };
test_matches("Date", map, boost::begin(matches), boost::end(matches));
}
// URI
{
static const char* matches[] = { "URI", "String", "NumString" };
test_matches("URI", map, boost::begin(matches), boost::end(matches));
}
// Binary
{
static const char* matches[] = { "Binary" };
test_matches("Binary", map, boost::begin(matches), boost::end(matches));
}
/*-------------------------- llsd_equals ---------------------------*/
// Cross-product of each LLSD type with every other
for (LLSD::map_const_iterator lmi(map.beginMap()), lmend(map.endMap());
lmi != lmend; ++lmi)
{
for (LLSD::map_const_iterator rmi(map.beginMap()), rmend(map.endMap());
rmi != rmend; ++rmi)
{
// Name this test based on the map keys naming the types of
// interest, e.g "String::Integer".
// We expect the values (xmi->second) to be equal if and only
// if the type names (xmi->first) are equal.
ensure(STRINGIZE(lmi->first << "::" << rmi->first),
bool(lmi->first == rmi->first) ==
bool(llsd_equals(lmi->second, rmi->second)));
}
}
// Array cases
LLSD rarray;
rarray.append(1.0);
rarray.append(2);
rarray.append("3");
LLSD larray(rarray);
ensure("llsd_equals(equal arrays)", llsd_equals(larray, rarray));
rarray[2] = "4";
ensure("llsd_equals(different [2])", ! llsd_equals(larray, rarray));
rarray = larray;
rarray.append(LLSD::Date());
ensure("llsd_equals(longer right array)", ! llsd_equals(larray, rarray));
rarray = larray;
rarray.erase(2);
ensure("llsd_equals(shorter right array)", ! llsd_equals(larray, rarray));
// Map cases
LLSD rmap;
rmap["San Francisco"] = 65;
rmap["Phoenix"] = 92;
rmap["Boston"] = 77;
LLSD lmap(rmap);
ensure("llsd_equals(equal maps)", llsd_equals(lmap, rmap));
rmap["Boston"] = 80;
ensure("llsd_equals(different [\"Boston\"])", ! llsd_equals(lmap, rmap));
rmap = lmap;
rmap["Atlanta"] = 95;
ensure("llsd_equals(superset right map)", ! llsd_equals(lmap, rmap));
rmap = lmap;
lmap["Seattle"] = 72;
ensure("llsd_equals(superset left map)", ! llsd_equals(lmap, rmap));
}
示例13: onClickImport
void LLPanelFriends::onClickImport(void* user_data)
//THIS CODE IS DESIGNED SO THAT EXP/IMP BETWEEN GRIDS WILL FAIL
//because assuming someone having the same name on another grid is the same person is generally a bad idea
//i might add the option to query the user as to intelligently detecting matching names on a alternative grid
// jcool410
{
//LLPanelFriends* panelp = (LLPanelFriends*)user_data;
//is_agent_friend(
const std::string filename = upload_pick((void*)LLFilePicker::FFLOAD_ALL);
if (filename.empty())
return;
llifstream importer(filename);
LLSD data;
LLSDSerialize::fromXMLDocument(data, importer);
if(data.has("GRID"))
{
std::string grid = gHippoGridManager->getConnectedGrid()->getLoginUri();
if(grid != data["GRID"])return;
data.erase("GRID");
}
#if LL_WINDOWS
std::string file = filename.substr(filename.find_last_of("\\")+1);
#else
std::string file = filename.substr(filename.find_last_of("/")+1);
#endif
std::string importstate = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "friendimportstate.dat");
llifstream stateload(importstate);
LLSD importstatellsd;
LLSDSerialize::fromXMLDocument(importstatellsd, stateload);
//LLMessageSystem* msg = gMessageSystem;
LLSD newdata;
LLSD::map_const_iterator iter;
for(iter = data.beginMap(); iter != data.endMap(); ++iter)
{//first= var second = val
LLSD content = iter->second;
if(!content.has("name"))continue;
if(!content.has("see_online"))continue;
if(!content.has("can_map"))continue;
if(!content.has("can_mod"))continue;
LLUUID agent_id = LLUUID(iter->first);
if(merging && importstatellsd.has(agent_id.asString()))continue;//dont need to request what weve already requested from another list import and have not got a reply yet
std::string agent_name = content["name"];
if(!is_agent_friend(agent_id))//dont need to request what we have
{
if(merging)importstatellsd[agent_id.asString()] = content;//MERGEEEE
requestFriendship(agent_id, agent_name, "Imported from "+file);
newdata[iter->first] = iter->second;
}else
{
//data.erase(iter->first);
//--iter;//god help us all
}
}
data = newdata;
newdata = LLSD();
if(!merging)
{
merging = true;//this hack is to support importing multiple account lists without spamming users but considering LLs fail in forcing silent declines
importstatellsd = data;
}
llofstream export_file;
export_file.open(importstate);
LLSDSerialize::toPrettyXML(importstatellsd, export_file);
export_file.close();
}
示例14: onClickImport_filepicker_continued
//THIS CODE IS DESIGNED SO THAT EXP/IMP BETWEEN GRIDS WILL FAIL
//because assuming someone having the same name on another grid is the same person is generally a bad idea
//i might add the option to query the user as to intelligently detecting matching names on a alternative grid
// jcool410
void LLPanelFriends::onClickImport_filepicker_continued(AIFilePicker* filepicker)
{
if (!filepicker->hasFilename())
return;
std::string filename = filepicker->getFilename();
llifstream importer(filename);
LLSD data;
LLSDSerialize::fromXMLDocument(data, importer);
if(data.has("GRID"))
{
std::string grid = gHippoGridManager->getConnectedGrid()->getLoginUri();
if(grid != data["GRID"])return;
data.erase("GRID");
}
#if LL_WINDOWS
std::string file = filename.substr(filename.find_last_of("\\")+1);
#else
std::string file = filename.substr(filename.find_last_of("/")+1);
#endif
std::string importstate = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "friendimportstate.dat");
llifstream stateload(importstate);
LLSD importstatellsd;
LLSDSerialize::fromXMLDocument(importstatellsd, stateload);
//LLMessageSystem* msg = gMessageSystem;
LLSD newdata;
LLSD::map_const_iterator iter;
for(iter = data.beginMap(); iter != data.endMap(); ++iter)
{//first= var second = val
LLSD content = iter->second;
if(!content.has("name"))continue;
if(!content.has("see_online"))continue;
if(!content.has("can_map"))continue;
if(!content.has("can_mod"))continue;
LLUUID agent_id = LLUUID(iter->first);
if(merging && importstatellsd.has(agent_id.asString()))continue;//dont need to request what weve already requested from another list import and have not got a reply yet
std::string agent_name = content["name"];
if(!is_agent_friend(agent_id))//dont need to request what we have
{
if(merging)importstatellsd[agent_id.asString()] = content;//MERGEEEE
requestFriendship(agent_id, agent_name, "Imported from "+file);
newdata[iter->first] = iter->second;
}else
{
//data.erase(iter->first);
//--iter;//god help us all
}
}
data = newdata;
newdata = LLSD();
if(!merging)
{
merging = true;//this hack is to support importing multiple account lists without spamming users but considering LLs fail in forcing silent declines
importstatellsd = data;
}
llofstream export_file;
export_file.open(importstate);
LLSDSerialize::toPrettyXML(importstatellsd, export_file);
export_file.close();
}