当前位置: 首页>>代码示例>>C++>>正文


C++ LLSD::isDefined方法代码示例

本文整理汇总了C++中LLSD::isDefined方法的典型用法代码示例。如果您正苦于以下问题:C++ LLSD::isDefined方法的具体用法?C++ LLSD::isDefined怎么用?C++ LLSD::isDefined使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LLSD的用法示例。


在下文中一共展示了LLSD::isDefined方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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;
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:29,代码来源:llflatlistview.cpp

示例2: loadCategories

// static
void LLClassifiedInfo::loadCategories(const LLSD& options)
{
	for(LLSD::array_const_iterator resp_it = options.beginArray(),
		end = options.endArray(); resp_it != end; ++resp_it)
	{
		LLSD name = (*resp_it)["category_name"];
		if(name.isDefined())
		{
			LLSD id = (*resp_it)["category_id"];
			if(id.isDefined())
			{
				LLClassifiedInfo::sCategories[id.asInteger()] = name.asString();
			}
		}
	}
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例3: mstr

	void sd_object::test<9>()
	{
		std::ostringstream resp;
		resp << "{'label':'short binary test', 'singlebinary':b(1)\"A\", 'singlerawstring':s(1)\"A\", 'endoftest':'end' }";
		std::string str = resp.str();
		LLSD sd;
		LLMemoryStream mstr((U8*)str.c_str(), str.size());
		S32 count = LLSDSerialize::fromNotation(sd, mstr, str.size());
		ensure_equals("parse count", count, 5);
		ensure("sd created", sd.isDefined());
		ensure_equals("sd type", sd.type(), LLSD::TypeMap);
		ensure_equals("map element count", sd.size(), 4);
		ensure_equals(
			"label",
			sd["label"].asString(),
			"short binary test");
		std::vector<U8> bin =  sd["singlebinary"].asBinary();
		std::vector<U8> expected;
		expected.resize(1);
		expected[0] = 'A';
		ensure("single binary", (0 == memcmp(&bin[0], &expected[0], 1)));
		ensure_equals(
			"single string",
			sd["singlerawstring"].asString(),
			std::string("A"));
		ensure_equals("end", sd["endoftest"].asString(), "end");
	}
开发者ID:Xara,项目名称:Opensource-V2-SL-Viewer,代码行数:27,代码来源:commonmisc_test.cpp

示例4: validate

	virtual bool validate(const std::string& name, LLSD& context) const
	{
		llinfos << "LLHTTPLiveConfigSingleService::validate(" << name
			<< ")" << llendl;
		LLSD option = LLApp::instance()->getOption(name);
		if(option.isDefined()) return true;
		else return false;
	}
开发者ID:mmorciegov,项目名称:emeraldviewer,代码行数:8,代码来源:llsdappservices.cpp

示例5: process_impl

// virtual
LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(
	const LLChannelDescriptors& channels,
	buffer_ptr_t& buffer,
	bool& eos,
	LLSD& context,
	LLPumpIO* pump)
{
	PUMP_DEBUG;
	LLMemType m1(LLMemType::MTYPE_IO_HTTP_SERVER);
	if(eos)
	{
		PUMP_DEBUG;
		//mGotEOS = true;
		std::ostringstream ostr;
		std::string message = context[CONTEXT_RESPONSE]["statusMessage"];
		
		int code = context[CONTEXT_RESPONSE]["statusCode"];
		if (code < 200)
		{
			code = 200;
			message = "OK";
		}
		
		ostr << HTTP_VERSION_STR << " " << code << " " << message << "\r\n";
		S32 content_length = buffer->countAfter(channels.in(), NULL);
		if(0 < content_length)
		{
			ostr << "Content-Length: " << content_length << "\r\n";
		}
		// *NOTE: This guard can go away once the LLSD static map
		// iterator is available. Phoenix. 2008-05-09
		LLSD headers = context[CONTEXT_RESPONSE][CONTEXT_HEADERS];
		if(headers.isDefined())
		{
			LLSD::map_iterator iter = headers.beginMap();
			LLSD::map_iterator end = headers.endMap();
			for(; iter != end; ++iter)
			{
				ostr << (*iter).first << ": " << (*iter).second.asString()
					<< "\r\n";
			}
		}
		ostr << "\r\n";

		LLChangeChannel change(channels.in(), channels.out());
		std::for_each(buffer->beginSegment(), buffer->endSegment(), change);
		std::string header = ostr.str();
		buffer->prepend(channels.out(), (U8*)header.c_str(), header.size());
		PUMP_DEBUG;
		return STATUS_DONE;
	}
	PUMP_DEBUG;
	return STATUS_OK;
}
开发者ID:Nora28,项目名称:imprudence,代码行数:55,代码来源:lliohttpserver.cpp

示例6: onClickDelete

//static
void LLPanelPicks::onClickDelete()
{
	LLSD value = mPicksList->getSelectedValue();
	if (value.isDefined())
	{
		LLSD args; 
		args["PICK"] = value[PICK_NAME]; 
		LLNotificationsUtil::add("DeleteAvatarPick", args, LLSD(), boost::bind(&LLPanelPicks::callbackDeletePick, this, _1, _2)); 
		return;
	}

	value = mClassifiedsList->getSelectedValue();
	if(value.isDefined())
	{
		LLSD args; 
		args["NAME"] = value[CLASSIFIED_NAME]; 
		LLNotificationsUtil::add("DeleteClassified", args, LLSD(), boost::bind(&LLPanelPicks::callbackDeleteClassified, this, _1, _2)); 
		return;
	}
}
开发者ID:Belxjander,项目名称:Kirito,代码行数:21,代码来源:llpanelpicks.cpp

示例7: onDeleteEntry

// called when the Delete Entry button is pressed
void LLFloaterAutoReplaceSettings::onDeleteEntry()
{
	LLSD selectedRow = mReplacementsList->getSelectedValue();
	if (selectedRow.isDefined())
	{	
		std::string keyword = selectedRow.asString();
		mReplacementsList->deleteSelectedItems(); // delete from the control
		mSettings.removeEntryFromList(keyword, mSelectedListName); // delete from the local settings copy
		disableReplacementEntry(); // no selection active, so turn off the buttons
	}
}
开发者ID:1234-,项目名称:SingularityViewer,代码行数:12,代码来源:llfloaterautoreplacesettings.cpp

示例8: init

bool LLCrashLogger::init()
{
	// We assume that all the logs we're looking for reside on the current drive
	gDirUtilp->initAppDirs("SecondLife");

	// Default to the product name "Second Life" (this is overridden by the -name argument)
	mProductName = "Second Life";
	
	mCrashSettings.declareS32(CRASH_BEHAVIOR_SETTING, CRASH_BEHAVIOR_ASK, "Controls behavior when viewer crashes "
		"(0 = ask before sending crash report, 1 = always send crash report, 2 = never send crash report)");

	llinfos << "Loading crash behavior setting" << llendl;
	mCrashBehavior = loadCrashBehaviorSetting();

	//Run through command line options
	if(getOption("previous").isDefined())
	{
		llinfos << "Previous execution did not remove SecondLife.exec_marker" << llendl;
		mCrashInPreviousExec = TRUE;
	}

	if(getOption("dialog").isDefined())
	{
		llinfos << "Show the user dialog" << llendl;
		mCrashBehavior = CRASH_BEHAVIOR_ASK;
	}
	
	LLSD name = getOption("name");
	if(name.isDefined())
	{	
		mProductName = name.asString();
	}

	// If user doesn't want to send, bail out
	if (mCrashBehavior == CRASH_BEHAVIOR_NEVER_SEND)
	{
		llinfos << "Crash behavior is never_send, quitting" << llendl;
		return false;
	}

	gServicePump = new LLPumpIO(gAPRPoolp);
	gServicePump->prime(gAPRPoolp);
	LLHTTPClient::setPump(*gServicePump);

	//If we've opened the crash logger, assume we can delete the marker file if it exists	
	if( gDirUtilp )
	{
		std::string marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.exec_marker");
		ll_apr_file_remove( marker_file );
	}
	
	return true;
}
开发者ID:,项目名称:,代码行数:53,代码来源:

示例9: getOption

LLSD LLApp::getOption(const std::string& name) const
{
	LLSD rv;
	LLSD::array_const_iterator iter = mOptions.beginArray();
	LLSD::array_const_iterator end = mOptions.endArray();
	for(; iter != end; ++iter)
	{
		rv = (*iter)[name];
		if(rv.isDefined()) break;
	}
	return rv;
}
开发者ID:Barosonix,项目名称:AstraViewer,代码行数:12,代码来源:llapp.cpp

示例10: handleUpdate

bool LLProgressView::handleUpdate(const LLSD& event_data)
{
	LLSD message = event_data.get("message");
	LLSD desc = event_data.get("desc");
	LLSD percent = event_data.get("percent");

	if(message.isDefined())
	{
		setMessage(message.asString());
	}

	if(desc.isDefined())
	{
		setText(desc.asString());
	}
	
	if(percent.isDefined())
	{
		setPercent(percent.asReal());
	}
	return false;
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:22,代码来源:llprogressview.cpp

示例11: onOpen

void LLFloaterChatterBox::onOpen(const LLSD& key)
{
	//*TODO:Skinning show the session id associated with key
	if (key.asString() == "local")
	{
	}
	else if (key.isDefined())
	{
		/*LLFloaterIMPanel* impanel = gIMMgr->findFloaterBySession(key.asUUID());
		if (impanel)
		{
			impanel->openFloater();
		}*/
	}
}
开发者ID:OS-Development,项目名称:VW.Kirsten,代码行数:15,代码来源:llfloaterchatterbox.cpp

示例12: handleIndeterminate

void LLLoginInstance::handleIndeterminate(const LLSD& event)
{
	// The indeterminate response means that the server
	// gave the viewer a new url and params to try.
	// The login module handles the retry, but it gives us the
	// server response so that we may show
	// the user some status.
	LLSD message = event.get("data").get("message");
	if(message.isDefined())
	{
		LLSD progress_update;
		progress_update["desc"] = message;
		LLEventPumps::getInstance()->obtain("LLProgressView").post(progress_update);
	}
}
开发者ID:JohnMcCaffery,项目名称:Armadillo-Phoenix,代码行数:15,代码来源:lllogininstance.cpp

示例13: setSecondaryDictionaries

void LLSpellChecker::setSecondaryDictionaries(dict_list_t dict_list)
{
	if (!getUseSpellCheck())
	{
		return;
	}

	// Check if we're only adding secondary dictionaries, or removing them
	dict_list_t dict_add(llmax(dict_list.size(), mDictSecondary.size())), dict_rem(llmax(dict_list.size(), mDictSecondary.size()));
	dict_list.sort();
	mDictSecondary.sort();
	dict_list_t::iterator end_added = std::set_difference(dict_list.begin(), dict_list.end(), mDictSecondary.begin(), mDictSecondary.end(), dict_add.begin());
	dict_list_t::iterator end_removed = std::set_difference(mDictSecondary.begin(), mDictSecondary.end(), dict_list.begin(), dict_list.end(), dict_rem.begin());

	if (end_removed != dict_rem.begin())		// We can't remove secondary dictionaries so we need to recreate the Hunspell instance
	{
		mDictSecondary = dict_list;

		std::string dict_language = mDictLanguage;
		initHunspell(dict_language);
	}
	else if (end_added != dict_add.begin())		// Add the new secondary dictionaries one by one
	{
		const std::string app_path = getDictionaryAppPath();
		const std::string user_path = getDictionaryUserPath();
		for (dict_list_t::const_iterator it_added = dict_add.begin(); it_added != end_added; ++it_added)
		{
			const LLSD dict_entry = getDictionaryData(*it_added);
			if ( (!dict_entry.isDefined()) || (!dict_entry["installed"].asBoolean()) )
			{
				continue;
			}

			const std::string strFileDic = dict_entry["name"].asString() + ".dic";
			if (gDirUtilp->fileExists(user_path + strFileDic))
			{
				mHunspell->add_dic((user_path + strFileDic).c_str());
			}
			else if (gDirUtilp->fileExists(app_path + strFileDic))
			{
				mHunspell->add_dic((app_path + strFileDic).c_str());
			}
		}
		mDictSecondary = dict_list;
		sSettingsChangeSignal();
	}
}
开发者ID:Belxjander,项目名称:Kirito,代码行数:47,代码来源:llspellcheck.cpp

示例14: message

	void sd_object::test<10>()
	{

		std::string message("parcel '' is naughty.");
		std::stringstream str;
		str << "{'message':'" << LLSDNotationFormatter::escapeString(message)
			<< "'}";
		std::string expected_str("{'message':'parcel \\'\\' is naughty.'}");
		std::string actual_str = str.str();
		ensure_equals("stream contents", actual_str, expected_str);
		LLSD sd;
		S32 count = LLSDSerialize::fromNotation(sd, str, actual_str.size());
		ensure_equals("parse count", count, 2);
		ensure("valid parse", sd.isDefined());
		std::string actual = sd["message"].asString();
		ensure_equals("message contents", actual, message);
	}
开发者ID:Xara,项目名称:Opensource-V2-SL-Viewer,代码行数:17,代码来源:commonmisc_test.cpp

示例15: getProgressEventLLSD

	LLSD getProgressEventLLSD(const std::string& state, const std::string& change,
						   const LLSD& data = LLSD())
	{
		LLSD status_data;
		status_data["state"] = state;
		status_data["change"] = change;
		status_data["progress"] = 0.0f;

		if(mAuthResponse.has("transfer_rate"))
		{
			status_data["transfer_rate"] = mAuthResponse["transfer_rate"];
		}

		if(data.isDefined())
		{
			status_data["data"] = data;
		}
		return status_data;
	}
开发者ID:Krazy-Bish-Margie,项目名称:Thunderstorm,代码行数:19,代码来源:lllogin.cpp


注:本文中的LLSD::isDefined方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。