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
0
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
0
// 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;
}
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");
			}
		}
	}
}
    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
0
// 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;
}
	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
0
//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
0
	/*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();
	}
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
0
	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
0
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
0
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
0
void LLBlockedListItem::setValue(const LLSD& value)
{
	if (!value.isMap() || !value.has("selected"))
	{
		return;
	}

	getChildView("selected_icon")->setVisible(value["selected"]);
}
/* 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;
}
bool LLGridManager::addGrid(LLSD& grid_data)
{
	if (grid_data.isMap() && grid_data.has(GRID_VALUE))
	{
		std::string grid = utf8str_tolower(grid_data[GRID_VALUE]);

		// grid should be in the form of a dns address
		if (!grid.empty() &&
			grid.find_first_not_of("abcdefghijklmnopqrstuvwxyz1234567890-_. ") != std::string::npos)
		{
			llinfos << "Invalid grid name " << grid << llendl;
			return false;
		}
		
		// populate the other values if they don't exist
		if (!grid_data.has(GRID_LABEL_VALUE)) 
		{
			grid_data[GRID_LABEL_VALUE] = grid;
		}
		if (!grid_data.has(GRID_ID_VALUE))
		{
			grid_data[GRID_ID_VALUE] = grid;
		}
		
		// if the grid data doesn't include any of the URIs, then 
		// generate them from the grid, which should be a dns address
		if (!grid_data.has(GRID_LOGIN_URI_VALUE)) 
		{
			grid_data[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
			grid_data[GRID_LOGIN_URI_VALUE].append(std::string("https://") + 
													grid + "/cgi-bin/login.cgi");
		}
		// Populate to the default values
		if (!grid_data.has(GRID_LOGIN_PAGE_VALUE)) 
		{
			grid_data[GRID_LOGIN_PAGE_VALUE] = std::string("http://") + grid + "/app/login/";
		}		
		if (!grid_data.has(GRID_HELPER_URI_VALUE)) 
		{
			grid_data[GRID_HELPER_URI_VALUE] = std::string("https://") + grid + "/helpers/";
		}
		
		if (!grid_data.has(GRID_LOGIN_IDENTIFIER_TYPES))
		{
			// non system grids and grids that haven't already been configured with values
			// get both types of credentials.
			grid_data[GRID_LOGIN_IDENTIFIER_TYPES] = LLSD::emptyArray();
			grid_data[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_AGENT);
			grid_data[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_ACCOUNT);
		}
		
		LL_DEBUGS("GridManager") << "ADDING: " << grid << LL_ENDL;
		mGridList[grid] = grid_data;		
	}
	return true;
}
//static
std::string LLNotification::format(const std::string& s, const LLSD& substitutions)
{
	if (!substitutions.isMap()) 
	{
		return s;
	}

	std::ostringstream output;
	// match strings like [NAME]
	const boost::regex key("\\[([0-9_A-Z]+)]");
	
	std::string::const_iterator start = s.begin();
	std::string::const_iterator end = s.end();
	boost::smatch match;
	
	while (boost::regex_search(start, end, match, key, boost::match_default))
	{
		bool found_replacement = false;
		std::string replacement;
		
		// see if we have a replacement for the bracketed string (without the brackets)
		// test first using has() because if we just look up with operator[] we get back an
		// empty string even if the value is missing. We want to distinguish between 
		// missing replacements and deliberately empty replacement strings.
		if (substitutions.has(std::string(match[1].first, match[1].second)))
		{
			replacement = substitutions[std::string(match[1].first, match[1].second)].asString();
			found_replacement = true;
		}
		// if not, see if there's one WITH brackets
		else if (substitutions.has(std::string(match[0].first, match[0].second)))
		{
			replacement = substitutions[std::string(match[0].first, match[0].second)].asString();
			found_replacement = true;
		}
		
		if (found_replacement)
		{
			// found a replacement
			// "hello world" is output
			output << std::string(start, match[0].first) << replacement;
		}
		else
		{
			// we had no replacement, so leave the string we searched for so that it gets noticed by QA
			// "hello [NAME_NOT_FOUND]" is output
			output << std::string(start, match[0].second);
		}
		
		// update search position 
		start = match[0].second; 
	}
	// send the remainder of the string (with no further matches for bracketed names)
	output << std::string(start, end);
	return output.str();
}
bool AscentDayCycleManager::setParamSet(const std::string& name, const LLSD & param)
{
	// quick, non robust (we won't be working with files, but assets) check
	if(!param.isMap()) 
	{
		return false;
	}
	
	return true;
}
示例#19
0
// static
void LLPanelLogin::setFields(LLPointer<LLCredential> credential,
							 BOOL remember)
{
	if (!sInstance)
	{
		llwarns << "Attempted fillFields with no login view shown" << llendl;
		return;
	}
	LL_INFOS("Credentials") << "Setting login fields to " << *credential << LL_ENDL;

	LLSD identifier = credential->getIdentifier();
	if((std::string)identifier["type"] == "agent") 
	{
		std::string firstname = identifier["first_name"].asString();
		std::string lastname = identifier["last_name"].asString();
	    std::string login_id = firstname;
	    if (!lastname.empty() && lastname != "Resident")
	    {
		    // support traditional First Last name SLURLs
		    login_id += " ";
		    login_id += lastname;
	    }
		sInstance->getChild<LLComboBox>("username_combo")->setLabel(login_id);	
	}
	else if((std::string)identifier["type"] == "account")
	{
		sInstance->getChild<LLComboBox>("username_combo")->setLabel((std::string)identifier["account_name"]);		
	}
	else
	{
	  sInstance->getChild<LLComboBox>("username_combo")->setLabel(std::string());	
	}
	sInstance->addFavoritesToStartLocation();
	// if the password exists in the credential, set the password field with
	// a filler to get some stars
	LLSD authenticator = credential->getAuthenticator();
	LL_INFOS("Credentials") << "Setting authenticator field " << authenticator["type"].asString() << LL_ENDL;
	if(authenticator.isMap() && 
	   authenticator.has("secret") && 
	   (authenticator["secret"].asString().size() > 0))
	{
		
		// This is a MD5 hex digest of a password.
		// We don't actually use the password input field, 
		// fill it with MAX_PASSWORD characters so we get a 
		// nice row of asterixes.
		const std::string filler("123456789!123456");
		sInstance->getChild<LLUICtrl>("password_edit")->setValue(std::string("123456789!123456"));
	}
	else
	{
		sInstance->getChild<LLUICtrl>("password_edit")->setValue(std::string());		
	}
	sInstance->getChild<LLUICtrl>("remember_check")->setValue(remember);
}
示例#20
0
void LLUIString::setArgs(const LLSD& sd)
{
	if (!sd.isMap()) return;
	for(LLSD::map_const_iterator sd_it = sd.beginMap();
		sd_it != sd.endMap();
		++sd_it)
	{
		setArg(sd_it->first, sd_it->second.asString());
	}
	format();
}
bool LLWLParamManager::setParamSet(const std::string& name, const LLSD & param)
{
	// quick, non robust (we won't be working with files, but assets) check
	if(!param.isMap()) 
	{
		return false;
	}
	
	mParamList[name].setAll(param);

	return true;
}
示例#22
0
void LLMessageConfigFile::loadMessageBans(const LLSD& data)
{
    LLSD bans = data["messageBans"];
    if (!bans.isMap())
    {
        LL_INFOS("AppInit") << "LLMessageConfigFile::loadMessageBans: missing messageBans section"
            << LL_ENDL;
        return;
    }
    
	gMessageSystem->setMessageBans(bans["trusted"], bans["untrusted"]);
}
示例#23
0
void LLUIString::setArgs(const LLSD& sd)
{
	LLFastTimer timer(FTM_UI_STRING);
	
	if (!sd.isMap()) return;
	for(LLSD::map_const_iterator sd_it = sd.beginMap();
		sd_it != sd.endMap();
		++sd_it)
	{
		setArg(sd_it->first, sd_it->second.asString());
	}
	dirty();
}
示例#24
0
void LLIMSpeakerMgr::setSpeakers(const LLSD& speakers)
{
	if ( !speakers.isMap() ) return;

	if ( speakers.has("agent_info") && speakers["agent_info"].isMap() )
	{
		LLSD::map_const_iterator speaker_it;
		for(speaker_it = speakers["agent_info"].beginMap();
			speaker_it != speakers["agent_info"].endMap();
			++speaker_it)
		{
			LLUUID agent_id(speaker_it->first);

			LLPointer<LLSpeaker> speakerp = setSpeaker(
				agent_id,
				LLStringUtil::null,
				LLSpeaker::STATUS_TEXT_ONLY);

			if ( speaker_it->second.isMap() )
			{
				BOOL is_moderator = speakerp->mIsModerator;
				speakerp->mIsModerator = speaker_it->second["is_moderator"];
				speakerp->mModeratorMutedText =
					speaker_it->second["mutes"]["text"];
				// Fire event only if moderator changed
				if ( is_moderator != speakerp->mIsModerator )
				{
					LL_DEBUGS("Speakers") << "Speaker " << agent_id << (is_moderator ? "is now" : "no longer is") << " a moderator" << llendl;
					fireEvent(new LLSpeakerUpdateModeratorEvent(speakerp), "update_moderator");
				}
			}
		}
	}
	else if ( speakers.has("agents" ) && speakers["agents"].isArray() )
	{
		//older, more decprecated way.  Need here for
		//using older version of servers
		LLSD::array_const_iterator speaker_it;
		for(speaker_it = speakers["agents"].beginArray();
			speaker_it != speakers["agents"].endArray();
			++speaker_it)
		{
			const LLUUID agent_id = (*speaker_it).asUUID();

			LLPointer<LLSpeaker> speakerp = setSpeaker(
				agent_id,
				LLStringUtil::null,
				LLSpeaker::STATUS_TEXT_ONLY);
		}
	}
}
void LLMaterialMgr::onPutResponse(bool success, const LLSD& content)
{
	if (!success)
	{
		// *TODO: is there any kind of error handling we can do here?
		LL_WARNS("Materials")<< "failed"<<LL_ENDL;
		return;
	}

	llassert(content.isMap());
	llassert(content.has(MATERIALS_CAP_ZIP_FIELD));
	llassert(content[MATERIALS_CAP_ZIP_FIELD].isBinary());

	LLSD::Binary content_binary = content[MATERIALS_CAP_ZIP_FIELD].asBinary();
	std::string content_string(reinterpret_cast<const char*>(content_binary.data()), content_binary.size());
	std::istringstream content_stream(content_string);

	LLSD response_data;
	if (!unzip_llsd(response_data, content_stream, content_binary.size()))
	{
		LL_WARNS("Materials") << "Cannot unzip LLSD binary content" << LL_ENDL;
		return;
	}
	else
	{
		llassert(response_data.isArray());
		LL_DEBUGS("Materials") << "response has "<< response_data.size() << " materials" << LL_ENDL;
		for (LLSD::array_const_iterator faceIter = response_data.beginArray(); faceIter != response_data.endArray(); ++faceIter)
		{
#           ifndef LL_RELEASE_FOR_DOWNLOAD
			const LLSD& face_data = *faceIter; // conditional to avoid unused variable warning
#           endif
			llassert(face_data.isMap());

			llassert(face_data.has(MATERIALS_CAP_OBJECT_ID_FIELD));
			llassert(face_data[MATERIALS_CAP_OBJECT_ID_FIELD].isInteger());
			// U32 local_id = face_data[MATERIALS_CAP_OBJECT_ID_FIELD].asInteger();

			llassert(face_data.has(MATERIALS_CAP_FACE_FIELD));
			llassert(face_data[MATERIALS_CAP_FACE_FIELD].isInteger());
			// S32 te = face_data[MATERIALS_CAP_FACE_FIELD].asInteger();

			llassert(face_data.has(MATERIALS_CAP_MATERIAL_ID_FIELD));
			llassert(face_data[MATERIALS_CAP_MATERIAL_ID_FIELD].isBinary());
			// LLMaterialID material_id(face_data[MATERIALS_CAP_MATERIAL_ID_FIELD].asBinary());

			// *TODO: do we really still need to process this?
		}
	}
}
示例#26
0
void LLMultiSlider::setValue(const LLSD& value)
{
	// only do if it's a map
	if(value.isMap()) {
		
		// add each value... the first in the map becomes the current
		LLSD::map_const_iterator mIt = value.beginMap();
		mCurSlider = mIt->first;

		for(; mIt != value.endMap(); mIt++) {
			setSliderValue(mIt->first, (F32)mIt->second.asReal(), TRUE);
		}
	}
}
示例#27
0
void LLMessageConfigFile::loadCapBans(const LLSD& data)
{
    LLSD bans = data["capBans"];
    if (!bans.isMap())
    {
        LL_INFOS("AppInit") << "LLMessageConfigFile::loadCapBans: missing capBans section"
            << LL_ENDL;
        return;
    }
    
	mCapBans = bans;
    
    LL_DEBUGS("AppInit") << "LLMessageConfigFile::loadCapBans: "
        << bans.size() << " ban tests" << LL_ENDL;
}
bool LLWLParamManager::setParamSet(const LLWLParamKey& key, const LLSD & param)
{
	llassert(!key.name.empty());
	// *TODO: validate params

	// quick, non robust (we won't be working with files, but assets) check
	// this might not actually be true anymore....
	if(!param.isMap()) 
	{
		return false;
	}
	
	LLWLParamSet param_set;
	param_set.setAll(param);
	return setParamSet(key, param_set);
}
void LLPanelLogin::setLoginHistory(LLSavedLogins const& login_history)
{
	sInstance->mLoginHistoryData = login_history;

	LLComboBox* login_combo = sInstance->getChild<LLComboBox>("first_name_combo");
	llassert(login_combo);
	login_combo->clear();

	LLSavedLoginsList const& saved_login_entries(login_history.getEntries());
	for (LLSavedLoginsList::const_reverse_iterator i = saved_login_entries.rbegin();
	     i != saved_login_entries.rend(); ++i)
	{
		LLSD e = i->asLLSD();
		if (e.isMap()) login_combo->add(i->getDisplayString(), e);
	}
}
bool LLAutoReplaceSettings::listIsValid(const LLSD& list)
{
	bool listValid = true;
	if ( ! list.isMap() )
	{
		listValid = false;
		LL_WARNS("AutoReplace") << "list is not a map" << LL_ENDL;
	}
	else if (   ! list.has(AUTOREPLACE_LIST_NAME)
			 || ! list[AUTOREPLACE_LIST_NAME].isString()
			 || list[AUTOREPLACE_LIST_NAME].asString().empty()
			 )
	{
		listValid = false;
		LL_WARNS("AutoReplace")
			<< "list found without " << AUTOREPLACE_LIST_NAME
			<< " (or it is empty)"
			<< LL_ENDL;
	}
	else if ( ! list.has(AUTOREPLACE_LIST_REPLACEMENTS) || ! list[AUTOREPLACE_LIST_REPLACEMENTS].isMap() )
	{
		listValid = false;
		LL_WARNS("AutoReplace") << "list '" << list[AUTOREPLACE_LIST_NAME].asString() << "' without " << AUTOREPLACE_LIST_REPLACEMENTS << LL_ENDL;
	}
	else
	{
		for ( LLSD::map_const_iterator
				  entry = list[AUTOREPLACE_LIST_REPLACEMENTS].beginMap(),
				  entriesEnd = list[AUTOREPLACE_LIST_REPLACEMENTS].endMap();
			  listValid && entry != entriesEnd;
			  entry++
			 )
		{
			if ( ! entry->second.isString() )
			{
				listValid = false;
				LL_WARNS("AutoReplace")
					<< "non-string replacement value found in list '"
					<< list[AUTOREPLACE_LIST_NAME].asString() << "'"
					<< LL_ENDL;
			}
		}
	}

	return listValid;
}