本文整理汇总了C++中LLSD::isMap方法的典型用法代码示例。如果您正苦于以下问题:C++ LLSD::isMap方法的具体用法?C++ LLSD::isMap怎么用?C++ LLSD::isMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLSD
的用法示例。
在下文中一共展示了LLSD::isMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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");
}
示例2: mapToQueryString
std::string LLURI::mapToQueryString(const LLSD& queryMap)
{
std::string query_string;
if (queryMap.isMap())
{
bool first_element = true;
LLSD::map_const_iterator iter = queryMap.beginMap();
LLSD::map_const_iterator end = queryMap.endMap();
std::ostringstream ostr;
for (; iter != end; ++iter)
{
if(first_element)
{
ostr << "?";
first_element = false;
}
else
{
ostr << "&";
}
ostr << escapeQueryVariable(iter->first);
if(iter->second.isDefined())
{
ostr << "=" << escapeQueryValue(iter->second.asString());
}
}
query_string = ostr.str();
}
return query_string;
}
示例3: loadFile
// static
bool AIFilePicker::loadFile(std::string const& filename)
{
LLSD data;
std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, filename);
llifstream file(filepath);
if (file.is_open())
{
llinfos << "Loading filepicker context file at \"" << filepath << "\"." << llendl;
LLSDSerialize::fromXML(data, file);
}
if (!data.isMap())
{
llinfos << "File missing, ill-formed, or simply undefined; not changing the file (" << filepath << ")." << llendl;
return false;
}
AIAccess<context_map_type> wContextMap(sContextMap);
for (LLSD::map_const_iterator iter = data.beginMap(); iter != data.endMap(); ++iter)
{
wContextMap->insert(context_map_type::value_type(iter->first, iter->second.asString()));
}
return true;
}
示例4: processAgentListUpdates
void LLIMFloater::processAgentListUpdates(const LLSD& body)
{
if ( !body.isMap() ) return;
if ( body.has("agent_updates") && body["agent_updates"].isMap() )
{
LLSD agent_data = body["agent_updates"].get(gAgentID.asString());
if (agent_data.isMap() && agent_data.has("info"))
{
LLSD agent_info = agent_data["info"];
if (agent_info.has("mutes"))
{
BOOL moderator_muted_text = agent_info["mutes"]["text"].asBoolean();
mInputEditor->setEnabled(!moderator_muted_text);
std::string label;
if (moderator_muted_text)
label = LLTrans::getString("IM_muted_text_label");
else
label = LLTrans::getString("IM_to_label") + " " + LLIMModel::instance().getName(mSessionID);
mInputEditor->setLabel(label);
if (moderator_muted_text)
LLNotificationsUtil::add("TextChatIsMutedByModerator");
}
}
}
}
示例5: deserializeKeyboardData
void deserializeKeyboardData( LLSD native_key_data, uint32_t& native_scan_code, uint32_t& native_virtual_key, uint32_t& native_modifiers )
{
native_scan_code = 0;
native_virtual_key = 0;
native_modifiers = 0;
if( native_key_data.isMap() )
{
#if LL_DARWIN
native_scan_code = (uint32_t)(native_key_data["char_code"].asInteger());
native_virtual_key = (uint32_t)(native_key_data["key_code"].asInteger());
native_modifiers = (uint32_t)(native_key_data["modifiers"].asInteger());
#elif LL_WINDOWS
native_scan_code = (uint32_t)(native_key_data["scan_code"].asInteger());
native_virtual_key = (uint32_t)(native_key_data["virtual_key"].asInteger());
// TODO: I don't think we need to do anything with native modifiers here -- please verify
#elif LL_LINUX
native_scan_code = (uint32_t)(native_key_data["scan_code"].asInteger());
native_virtual_key = (uint32_t)(native_key_data["virtual_key"].asInteger());
native_modifiers = (uint32_t)(native_key_data["modifiers"].asInteger());
#else
// Add other platforms here as needed
#endif
};
};
示例6: loadFile
// virtual
bool LLLiveAppConfig::loadFile()
{
LL_INFOS() << "LLLiveAppConfig::loadFile(): reading from "
<< filename() << LL_ENDL;
llifstream file(filename().c_str());
LLSD config;
if (file.is_open())
{
LLSDSerialize::fromXML(config, file);
if(!config.isMap())
{
LL_WARNS() << "Live app config not an map in " << filename()
<< " Ignoring the data." << LL_ENDL;
return false;
}
file.close();
}
else
{
LL_INFOS() << "Live file " << filename() << " does not exit." << LL_ENDL;
}
// *NOTE: we do not handle the else case here because we would not
// have attempted to load the file unless LLLiveFile had
// determined there was a reason to load it. This only happens
// when either the file has been updated or it is either suddenly
// in existence or has passed out of existence. Therefore, we want
// to set the config to an empty config, and return that it
// changed.
LLApp* app = LLApp::instance();
if(app) app->setOptionData(mPriority, config);
return true;
}
示例7: result
void result( const LLSD& content )
{
//Check for error
if ( !content.isMap() || content.has("error") )
{
llwarns << "Error on fetched data"<< llendl;
clearPendingRequests();
}
else if (content.has("selected"))
{
F32 physicsCost = 0.0f;
F32 networkCost = 0.0f;
F32 simulationCost = 0.0f;
//LLTransactionID transactionID;
//transactionID = content["selected"][i]["local_id"].asUUID();
physicsCost = content["selected"]["physics"].asReal();
networkCost = content["selected"]["streaming"].asReal();
simulationCost = content["selected"]["simulation"].asReal();
SelectionCost selectionCost( /*transactionID,*/ physicsCost, networkCost, simulationCost );
}
clearPendingRequests();
}
示例8: llsds_are_equal
//compares two LLSD's
bool llsds_are_equal(const LLSD& llsd_1, const LLSD& llsd_2)
{
llassert(llsd_1.isDefined());
llassert(llsd_2.isDefined());
if (llsd_1.type() != llsd_2.type()) return false;
if (!llsd_1.isMap())
{
if (llsd_1.isUUID()) return llsd_1.asUUID() == llsd_2.asUUID();
//assumptions that string representaion is enough for other types
return llsd_1.asString() == llsd_2.asString();
}
if (llsd_1.size() != llsd_2.size()) return false;
LLSD::map_const_iterator llsd_1_it = llsd_1.beginMap();
LLSD::map_const_iterator llsd_2_it = llsd_2.beginMap();
for (S32 i = 0; i < llsd_1.size(); ++i)
{
if ((*llsd_1_it).first != (*llsd_2_it).first) return false;
if (!llsds_are_equal((*llsd_1_it).second, (*llsd_2_it).second)) return false;
++llsd_1_it;
++llsd_2_it;
}
return true;
}
示例9:
/*virtual*/ void post(LLHTTPNode::ResponsePtr response, const LLSD& context, const LLSD& input) const
{
if (!input || !context || !input.isMap() || !input.has("body"))
{
llinfos << "malformed WindLightRefresh!" << llendl;
return;
}
//std::string dump = input["body"].asString();
//llwarns << dump << llendl;
LLSD body = input["body"];
LLEnvManagerNew *env = &LLEnvManagerNew::instance();
LLViewerRegion* regionp = gAgent.getRegion();
LLUUID region_uuid = regionp ? regionp->getRegionID() : LLUUID::null;
env->mNewRegionPrefs.clear();
env->mCurRegionUUID = region_uuid;
env->mInterpNextChangeMessage = !body.has("Interpolate") || body["Interpolate"].asInteger() == 1;
llinfos << "Windlight Refresh, interpolate:" << env->mInterpNextChangeMessage << llendl;
env->requestRegionSettings();
env->mRegionChangeSignal();
}
示例10: deserializeKeyboardData
void MediaPluginCEF::deserializeKeyboardData(LLSD native_key_data, uint32_t& native_scan_code, uint32_t& native_virtual_key, uint32_t& native_modifiers)
{
native_scan_code = 0;
native_virtual_key = 0;
native_modifiers = 0;
if (native_key_data.isMap())
{
#if LL_DARWIN
native_scan_code = (uint32_t)(native_key_data["char_code"].asInteger());
native_virtual_key = (uint32_t)(native_key_data["key_code"].asInteger());
native_modifiers = (uint32_t)(native_key_data["modifiers"].asInteger());
#elif LL_WINDOWS
native_scan_code = (uint32_t)(native_key_data["scan_code"].asInteger());
native_virtual_key = (uint32_t)(native_key_data["virtual_key"].asInteger());
// TODO: I don't think we need to do anything with native modifiers here -- please verify
#elif LL_LINUX
native_scan_code = (uint32_t)(native_key_data["sdl_sym"].asInteger());
native_virtual_key = (uint32_t)(native_key_data["virtual_key"].asInteger());
native_modifiers = (uint32_t)(native_key_data["cef_modifiers"].asInteger());
if( native_scan_code == '\n' )
native_scan_code = '\r';
#endif
};
};
示例11: result
void result( const LLSD& content )
{
//Check for error
if ( !content.isMap() || content.has("error") )
{
llwarns << "Error on fetched data"<< llendl;
}
else if (content.has("selected"))
{
F32 physicsCost = 0.0f;
F32 networkCost = 0.0f;
F32 simulationCost = 0.0f;
physicsCost = content["selected"]["physics"].asReal();
networkCost = content["selected"]["streaming"].asReal();
simulationCost = content["selected"]["simulation"].asReal();
SelectionCost selectionCost( /*transactionID,*/ physicsCost, networkCost, simulationCost );
LLAccountingCostObserver* observer = mObserverHandle.get();
if (observer && observer->getTransactionID() == mTransactionID)
{
observer->onWeightsUpdate(selectionCost);
}
}
clearPendingRequests();
}
示例12: setValue
void LLPanelCameraItem::setValue(const LLSD& value)
{
if (!value.isMap()) return;;
if (!value.has("selected")) return;
getChildView("selected_icon")->setVisible( value["selected"]);
getChildView("picture")->setVisible( !value["selected"]);
getChildView("selected_picture")->setVisible( value["selected"]);
}
示例13: setValue
void LLPanelCameraItem::setValue(const LLSD& value)
{
if (!value.isMap()) return;;
if (!value.has("selected")) return;
childSetVisible("selected_icon", value["selected"]);
childSetVisible("picture", !value["selected"]);
childSetVisible("selected_picture", value["selected"]);
}
示例14: setValue
void LLBlockedListItem::setValue(const LLSD& value)
{
if (!value.isMap() || !value.has("selected"))
{
return;
}
getChildView("selected_icon")->setVisible(value["selected"]);
}
示例15: getListName
/* static */
std::string LLAutoReplaceSettings::getListName(LLSD& list)
{
std::string name;
if ( list.isMap() && list.has(AUTOREPLACE_LIST_NAME) && list[AUTOREPLACE_LIST_NAME].isString() )
{
name = list[AUTOREPLACE_LIST_NAME].asString();
}
return name;
}