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


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

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


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

示例1: newResult

		LLHTTPClient::ResponderPtr newResult()
		{
			mSawError = false;
			mStatus = 0;
			mSawCompleted = false;
			mSawCompletedHeader = false;
			mResult.clear();
			mHeader.clear();
			mResultDeleted = false;
			
			return Result::build(*this);
		}
开发者ID:DarkSpyro003,项目名称:DarkSpyros_Viewer,代码行数:12,代码来源:llhttpclient_tut.cpp

示例2: actual

	void sd_object::test<2>()
	{
		const std::string decoded("random");
		//const std::string encoded("cmFuZG9t\n");
		const std::string streamed("b(6)\"random\"");
		typedef std::vector<U8> buf_t;
		buf_t buf;
		std::copy(
			decoded.begin(),
			decoded.end(),
			std::back_insert_iterator<buf_t>(buf));
		LLSD sd;
		sd = buf;
		std::stringstream str;
		S32 count = LLSDSerialize::toNotation(sd, str);
		ensure_equals("output count", count, 1);
		std::string actual(str.str());
		ensure_equals("formatted binary encoding", actual, streamed);
		sd.clear();
		LLSDSerialize::fromNotation(sd, str, str.str().size());
		std::vector<U8> after;
		after = sd.asBinary();
		ensure_equals("binary decoded size", after.size(), decoded.size());
		ensure("binary decoding", (0 == memcmp(
									   &after[0],
									   decoded.c_str(),
									   decoded.size())));
	}
开发者ID:Xara,项目名称:Opensource-V2-SL-Viewer,代码行数:28,代码来源:commonmisc_test.cpp

示例3: parseMap

S32 LLSDNotationParser::parseMap(std::istream& istr, LLSD& map) const
{
	// map: { string:object, string:object }
	map = LLSD::emptyMap();
	S32 parse_count = 0;
	char c = get(istr);
	if(c == '{')
	{
		// eat commas, white
		bool found_name = false;
		std::string name;
		c = get(istr);
		while(c != '}' && istr.good())
		{
			if(!found_name)
			{
				if((c == '\"') || (c == '\'') || (c == 's'))
				{
					putback(istr, c);
					found_name = true;
					int count = deserialize_string(istr, name, mMaxBytesLeft);
					if(PARSE_FAILURE == count) return PARSE_FAILURE;
					account(count);
				}
				c = get(istr);
			}
			else
			{
				if(isspace(c) || (c == ':'))
				{
					c = get(istr);
					continue;
				}
				putback(istr, c);
				LLSD child;
				S32 count = doParse(istr, child);
				if(count > 0)
				{
					// There must be a value for every key, thus
					// child_count must be greater than 0.
					parse_count += count;
					map.insert(name, child);
				}
				else
				{
					return PARSE_FAILURE;
				}
				found_name = false;
				c = get(istr);
			}
		}
		if(c != '}')
		{
			map.clear();
			return PARSE_FAILURE;
		}
	}
	return parse_count;
}
开发者ID:greythane,项目名称:slitechat,代码行数:59,代码来源:llsdserialize.cpp

示例4:

	void llsdutil_object::test<4>()
	{
		LLSD sd;
		LLVector3 vec1(-1.0, 2.0, -3.0);
		sd = ll_sd_from_vector3(vec1); 
		LLVector3 vec2 = ll_vector3_from_sd(sd);
		ensure_equals("vector3 -> sd -> vector3: 1", vec1, vec2);

		LLVector3 vec3(sd);
		ensure_equals("vector3 -> sd -> vector3: 2", vec1, vec3);

		sd.clear();
		vec1.setVec(0., 0., 0.);
		sd = ll_sd_from_vector3(vec1); 
		vec2 = ll_vector3_from_sd(sd);
		ensure_equals("vector3 -> sd -> vector3: 3", vec1, vec2);
		sd.clear();
	}
开发者ID:Krazy-Bish-Margie,项目名称:Thunderstorm,代码行数:18,代码来源:llsdutil_tut.cpp

示例5: aDay

	void SDTestObject::test<2>()
		// setting and fetching scalar types
	{
		SDCleanupCheck check;
		
		LLSD v;

		v = true;		ensureTypeAndValue("set true", v, true);
		v = false;		ensureTypeAndValue("set false", v, false);
		v = true;		ensureTypeAndValue("set true again", v, true);
		
		v = 42;			ensureTypeAndValue("set to 42", v, 42);
		v = 0;			ensureTypeAndValue("set to zero", v, 0);
		v = -12345;		ensureTypeAndValue("set to neg", v, -12345);
		v = 2000000000;	ensureTypeAndValue("set to big", v, 2000000000);
		
		v = 3.14159265359;
						ensureTypeAndValue("set to pi", v, 3.14159265359);
						ensure_not_equals("isn't float", v.asReal(),
							(float)3.14159265359);
		v = 6.7e256;	ensureTypeAndValue("set to big", v, 6.7e256);
		
		LLUUID nullUUID;
		LLUUID newUUID;
		newUUID.generate();
		
		v = nullUUID;	ensureTypeAndValue("set to null UUID", v, nullUUID);
		v = newUUID;	ensureTypeAndValue("set to new UUID", v, newUUID);
		v = nullUUID;	ensureTypeAndValue("set to null again", v, nullUUID);
		
		// strings must be tested with two types of string objects
		std::string s = "now is the time";
		const char* cs = "for all good zorks";

		v = s;			ensureTypeAndValue("set to std::string", v, s);		
		v = cs;			ensureTypeAndValue("set to const char*", v, cs);
	
		LLDate epoch;
		LLDate aDay("2001-10-22T10:11:12.00Z");
		
		v = epoch;		ensureTypeAndValue("set to epoch", v, epoch);
		v = aDay;		ensureTypeAndValue("set to a day", v, aDay);
		
		LLURI path("http://slurl.com/secondlife/Ambleside/57/104/26/");
		
		v = path;		ensureTypeAndValue("set to a uri", v, path);
		
		const char source[] = "once in a blue moon";
		std::vector<U8> data;
		copy(&source[0], &source[sizeof(source)], back_inserter(data));
		
		v = data;		ensureTypeAndValue("set to data", v, data);
		
		v.clear();
		ensure("reset to undefined", v.type() == LLSD::TypeUndefined);
	}
开发者ID:Krazy-Bish-Margie,项目名称:Thunderstorm,代码行数:56,代码来源:llsd_new_tut.cpp

示例6: 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");
	}
开发者ID:Krazy-Bish-Margie,项目名称:Thunderstorm,代码行数:56,代码来源:llsd_new_tut.cpp

示例7:

    void lllogininstance_object::test<1>()
    {
		set_test_name("Test Simple Success And Disconnect");

		// Test default connect.
		logininstance->connect(credentials);

		ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); 

		// Dummy success response.
		LLSD response;
		response["state"] = "online";
		response["change"] = "connect";
		response["progress"] = 1.0;
		response["transfer_rate"] = 7;
		response["data"] = "test_data";

		gTestPump.post(response);

		ensure("Success response", logininstance->authSuccess());
		ensure_equals("Test Response Data", logininstance->getResponse().asString(), "test_data");

		logininstance->disconnect();

		ensure_equals("Called Login Module Disconnect", gDisconnectCalled, true);

		response.clear();
		response["state"] = "offline";
		response["change"] = "disconnect";
		response["progress"] = 0.0;
		response["transfer_rate"] = 0;
		response["data"] = "test_data";

		gTestPump.post(response);

		ensure("Disconnected", !(logininstance->authSuccess()));
    }
开发者ID:,项目名称:,代码行数:37,代码来源:

示例8: deserialize_boolean

int deserialize_boolean(
	std::istream& istr,
	LLSD& data,
	const std::string& compare,
	bool value)
{
	//
	// this method is a little goofy, because it gets the stream at
	// the point where the t or f has already been
	// consumed. Basically, parse for a patch to the string passed in
	// starting at index 1. If it's a match:
	//  * assign data to value
	//  * return the number of bytes read
	// otherwise:
	//  * set data to LLSD::null
	//  * return LLSDParser::PARSE_FAILURE (-1)
	//
	int bytes_read = 0;
	std::string::size_type ii = 0;
	char c = istr.peek();
	while((++ii < compare.size())
		  && (tolower(c) == (int)compare[ii])
		  && istr.good())
	{
		istr.ignore();
		++bytes_read;
		c = istr.peek();
	}
	if(compare.size() != ii)
	{
		data.clear();
		return LLSDParser::PARSE_FAILURE;
	}
	data = value;
	return bytes_read;
}
开发者ID:greythane,项目名称:slitechat,代码行数:36,代码来源:llsdserialize.cpp

示例9: doParse

// virtual
S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const
{
/**
 * Undefined: '!'<br>
 * Boolean: 't' for true 'f' for false<br>
 * Integer: 'i' + 4 bytes network byte order<br>
 * Real: 'r' + 8 bytes IEEE double<br>
 * UUID: 'u' + 16 byte unsigned integer<br>
 * String: 's' + 4 byte integer size + string<br>
 *  strings also secretly support the notation format
 * Date: 'd' + 8 byte IEEE double for seconds since epoch<br>
 * URI: 'l' + 4 byte integer size + string uri<br>
 * Binary: 'b' + 4 byte integer size + binary data<br>
 * Array: '[' + 4 byte integer size  + all values + ']'<br>
 * Map: '{' + 4 byte integer size  every(key + value) + '}'<br>
 *  map keys are serialized as s + 4 byte integer size + string or in the
 *  notation format.
 */
	char c;
	c = get(istr);
	if(!istr.good())
	{
		return 0;
	}
	S32 parse_count = 1;
	switch(c)
	{
	case '{':
	{
		S32 child_count = parseMap(istr, data);
		if((child_count == PARSE_FAILURE) || data.isUndefined())
		{
			parse_count = PARSE_FAILURE;
		}
		else
		{
			parse_count += child_count;
		}
		if(istr.fail())
		{
			llinfos << "STREAM FAILURE reading binary map." << llendl;
			parse_count = PARSE_FAILURE;
		}
		break;
	}

	case '[':
	{
		S32 child_count = parseArray(istr, data);
		if((child_count == PARSE_FAILURE) || data.isUndefined())
		{
			parse_count = PARSE_FAILURE;
		}
		else
		{
			parse_count += child_count;
		}
		if(istr.fail())
		{
			llinfos << "STREAM FAILURE reading binary array." << llendl;
			parse_count = PARSE_FAILURE;
		}
		break;
	}

	case '!':
		data.clear();
		break;

	case '0':
		data = false;
		break;

	case '1':
		data = true;
		break;

	case 'i':
	{
		U32 value_nbo = 0;
		read(istr, (char*)&value_nbo, sizeof(U32));	 /*Flawfinder: ignore*/
		data = (S32)ntohl(value_nbo);
		if(istr.fail())
		{
			llinfos << "STREAM FAILURE reading binary integer." << llendl;
		}
		break;
	}

	case 'r':
	{
		F64 real_nbo = 0.0;
		read(istr, (char*)&real_nbo, sizeof(F64));	 /*Flawfinder: ignore*/
		data = ll_ntohd(real_nbo);
		if(istr.fail())
		{
			llinfos << "STREAM FAILURE reading binary real." << llendl;
		}
		break;
//.........这里部分代码省略.........
开发者ID:greythane,项目名称:slitechat,代码行数:101,代码来源:llsdserialize.cpp

示例10: resolveClientTag


//.........这里部分代码省略.........
			{
				curtag["name"] = "Phoenix";
				curtag["color"] = LLColor4::purple.getValue();
				curtag["alt"] = "ed63fbd0-589e-fe1d-a3d0-16905efaa96b";
			}
			else if(id == LLUUID("5f0e7c32-38c3-9214-01f0-fb16a5b40128"))//yellow
			{
				curtag["name"] = "Phoenix";
				curtag["color"] = LLColor4::yellow.getValue();
				curtag["alt"] = "ed63fbd0-589e-fe1d-a3d0-16905efaa96b";
			}
			else if(id == LLUUID("5bb6e4a6-8e24-7c92-be2e-91419bb0ebcb"))//blue
			{
				curtag["name"] = "Phoenix";
				curtag["color"] = LLColor4::blue.getValue();
				curtag["alt"] = "ed63fbd0-589e-fe1d-a3d0-16905efaa96b";
			}
			else if(id == LLUUID("ed63fbd0-589e-fe1d-a3d0-16905efaa96b"))//default (red)
			{
				curtag["name"] = "Phoenix";
				curtag["color"] = LLColor4::red.getValue();
			}	
			else if(id == LLUUID("c228d1cf-4b5d-4ba8-84f4-899a0796aa97"))//viewer 2.0
			{
				curtag["name"] = "LL Viewer";
			}
			else if(id == LLUUID("cc7a030f-282f-c165-44d2-b5ee572e72bf"))
			{
				curtag["name"] = "Imprudence";
			}
			else if(id == LLUUID("54d93609-1392-2a93-255c-a9dd429ecca5"))
			{
				curtag["name"] = "Emergence";
			}
			else if(id == LLUUID("8873757c-092a-98fb-1afd-ecd347566fcd"))
			{
				curtag["name"] = "Ascent";
			}
			else if(id == LLUUID("f25263b7-6167-4f34-a4ef-af65213b2e39"))
			{
				curtag["name"] = "Singularity";
			}
			if(curtag.has("name")) curtag["tpvd"]=true;
		}
	}
	
	
	// Filtering starts here:
	//WS: If the current tag has an "alt" definied and we don't want multiple colors. Resolve the alt.
	if((gSavedSettings.getU32("FSColorClienttags") == 1) && curtag.has("alt"))
	{
		curtag = resolveClientTag(curtag["alt"], new_system, color);
	}

	//WS: If we have a tag using the new system, check if we want to display it's name and/or color
	if(new_system)
	{
		if(gSavedSettings.getU32("FSClientTagsVisibility2") >= 3)
		{
			// strnlen() doesn't exist on OS X before 10.7. -- TS
			char tag_temp[UUID_BYTES+1];
			strncpy(tag_temp,(const char*)&id.mData[0], UUID_BYTES);
			tag_temp[UUID_BYTES] = '\0';
			U32 tag_len = strlen(tag_temp);
			std::string clienttagname = std::string((const char*)&id.mData[0], tag_len);
			LLStringFn::replace_ascii_controlchars(clienttagname, LL_UNKNOWN_CHAR);
			curtag["name"] = clienttagname;
		}
		if(gSavedSettings.getU32("FSColorClienttags") >= 3 || curtag["tpvd"].asBoolean())
		{
			if(curtag["tpvd"].asBoolean() && gSavedSettings.getU32("FSColorClienttags") < 3)
			{
				if(color == LLColor4::blue || color == LLColor4::yellow ||
				   color == LLColor4::purple || color == LLColor4((F32)0.99,(F32)0.39,(F32)0.12,(F32)1) ||
				   color == LLColor4::red || color == LLColor4((F32)0.99,(F32)0.56,(F32)0.65,(F32)1) ||
				   color == LLColor4::white || color == LLColor4::green)
				{
					curtag["color"] = color.getValue();
				}
			}
			else 
			{
				curtag["color"] = color.getValue();
			}
		}
	}

	//If we only want to display tpvd viewer. And "tpvd" is not available or false, then
	// clear the data, but keep the basedata (like uuid, id_based and tex_color) for (maybe) later displaying.
	if(gSavedSettings.getU32("FSClientTagsVisibility2") <= 1 && (!curtag.has("tpvd") || !curtag["tpvd"].asBoolean()))
	{
		curtag.clear();
	}

	curtag["uuid"]=id.asString();
	curtag["id_based"]=new_system;	
	curtag["tex_color"]=color.getValue();	

	return curtag;
}
开发者ID:wish-ds,项目名称:firestorm-ds,代码行数:101,代码来源:fsdata.cpp


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