Beispiel #1
0
// static
void LLEventInfo::loadCategories(LLUserAuth::options_t event_options)
{
	LLUserAuth::options_t::iterator resp_it;
	for (resp_it = event_options.begin(); 
		 resp_it != event_options.end(); 
		 ++resp_it)
	{
		const LLUserAuth::response_t& response = *resp_it;

		LLUserAuth::response_t::const_iterator option_it;

		S32 cat_id = 0;
		option_it = response.find("category_id");
		if (option_it != response.end())
		{
			cat_id = atoi(option_it->second.c_str());
		}
		else
		{
			continue;
		}

		// Add the category id/name pair
		option_it = response.find("category_name");
		if (option_it != response.end())
		{
			LLEventInfo::sCategories[cat_id] = option_it->second;
		}

	}

}
void LLEventNotifier::load(const LLUserAuth::options_t& event_options)
{
	LLUserAuth::options_t::const_iterator resp_it;
	for (resp_it = event_options.begin(); 
		 resp_it != event_options.end(); 
		 ++resp_it)
	{
		const LLUserAuth::response_t& response = *resp_it;

		LLEventNotification *new_enp = new LLEventNotification();

		if (!new_enp->load(response))
		{
			delete new_enp;
			continue;
		}
		
		mEventNotifications[new_enp->getEventID()] = new_enp;
	}
}
static void parseOptionInto(
	const std::string& id, XMLRPC_VALUE option, LLUserAuth::options_t& options)
{
	std::string key;
	std::string val;
	XMLRPC_VALUE_TYPE_EASY type;
	XMLRPC_VALUE row = XMLRPC_VectorRewind(option);
	while(row)
	{
		XMLRPC_VALUE opt  = XMLRPC_VectorRewind(row);
		LLUserAuth::response_t responses;
		while(opt)
		{
			key.assign(XMLRPC_GetValueID(opt));
			//llinfos << "option key: " << key << llendl;
			type = XMLRPC_GetValueTypeEasy(opt);
			if(xmlrpc_type_string == type)
			{
				val.assign(XMLRPC_GetValueString(opt));
				//llinfos << "string val: " << val << llendl;
			}
			else if(xmlrpc_type_int == type)
			{
				val = llformat("%d", XMLRPC_GetValueInt(opt));
				//llinfos << "int val: " << val << llendl;
			}
			else if(xmlrpc_type_double == type)
			{
				val = llformat("%g", XMLRPC_GetValueDouble(opt));
				//llinfos << "double val: " << val << llendl;
			}
			else
			{	// Can't understand the type
				val = "???";
				//llinfos << "unknown value type: " << type << llendl;
			}

			responses.insert(LLUserAuth::response_t::value_type(key, val));
			opt = XMLRPC_VectorNext(row);
		}
		options.push_back(responses);
		row = XMLRPC_VectorNext(option);
	}
}