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


C++ lliopipe::buffer_ptr_t类代码示例

本文整理汇总了C++中lliopipe::buffer_ptr_t的典型用法代码示例。如果您正苦于以下问题:C++ buffer_ptr_t类的具体用法?C++ buffer_ptr_t怎么用?C++ buffer_ptr_t使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: completedRaw

	void completedRaw(
		const LLChannelDescriptors& channels,
		const LLIOPipe::buffer_ptr_t& buffer)
	{
		completedHeader();

		if (!isGoodStatus())
		{
			if (getStatus() == HTTP_NOT_MODIFIED)
			{
				LL_INFOS("fsdata") << "Got [304] not modified for " << mURL << LL_ENDL;
			}
			else
			{
				LL_WARNS("fsdata") << "Error fetching " << mURL << " Status: [" << getStatus() << "]" << LL_ENDL;
			}
			return;
		}

		S32 data_size = buffer->countAfter(channels.in(), NULL);
		if (data_size <= 0)
		{
			LL_WARNS("fsdata") << "Received zero data for " << mURL << LL_ENDL;
			return;
		}

		U8* data = new U8[data_size];
		buffer->readAfter(channels.in(), NULL, data, data_size);

		// basic check for valid data received
		LLXMLNodePtr xml_root;
		if ( (!LLXMLNode::parseBuffer(data, data_size, xml_root, NULL)) || (xml_root.isNull()) || (!xml_root->hasName("script_library")) )
		{
			LL_WARNS("fsdata") << "Could not read the script library data from "<< mURL << LL_ENDL;
			delete[] data;
			data = NULL;
			return;
		}
		
		LLAPRFile outfile ;
		outfile.open(mFilename, LL_APR_WB);
		if (!outfile.getFileHandle())
		{
			LL_WARNS("fsdata") << "Unable to open file for writing: " << mFilename << LL_ENDL;
		}
		else
		{
			LL_INFOS("fsdata") << "Saving " << mFilename << LL_ENDL;
			outfile.write(data, data_size);
			outfile.close() ;
		}
		delete[] data;
		data = NULL;
	}
开发者ID:CaseyraeStarfinder,项目名称:Firestorm-Viewer,代码行数:54,代码来源:fsdata.cpp

示例2: completedRaw

void EmeraldDicDownloader::completedRaw(U32 status, const std::string& reason, const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer)
{
	if (status < 200 || status >= 300)
	{
		return;
	}
	LLBufferStream istr(channels, buffer.get());
	std::string dicpath(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "dictionaries", name.c_str()));

	llofstream ostr(dicpath, std::ios::binary);

	while (istr.good() && ostr.good())
	{
		ostr << istr.rdbuf();
	}
	ostr.close();
	if (panel)
	{
        if (panel->empanel)
        {
    		panel->empanel->refresh();
        }
        else
        {
            llinfos << "completedRaw(): No empanel to refresh()!" << llendl;
        }

		panel->close();
	}
}
开发者ID:BillBarnhill,项目名称:SingularityViewer,代码行数:30,代码来源:lggdicdownload.cpp

示例3: completedRaw

void exoFlickrResponse::completedRaw(
									U32 status,
									const std::string& reason,
									const LLChannelDescriptors& channels,
									const LLIOPipe::buffer_ptr_t& buffer)
{
	LLBufferStream istr(channels, buffer.get());
	std::stringstream strstrm;
	strstrm << istr.rdbuf();
	std::string result = strstrm.str();
	Json::Value root;
	Json::Reader reader;

	bool success = reader.parse(result, root);
	if(!success)
	{
		mCallback(false, LLSD());
		return;
	}
	else
	{
		LL_INFOS("FlickrAPI") << "Got response string: " << result << LL_ENDL;
		LLSD response;
		JsonToLLSD(root, response);
		mCallback(isGoodStatus(status), response);
	}
}
开发者ID:JohnMcCaffery,项目名称:Armadillo-Phoenix,代码行数:27,代码来源:exoflickr.cpp

示例4: completedRaw

	virtual void completedRaw(U32 status,
				const std::string& reason,
				const LLChannelDescriptors& channels,
				const LLIOPipe::buffer_ptr_t& buffer)
	{
		if (!isGoodStatus(status))
		{
			llinfos << mURL << " [" << status << "]: " << reason << llendl;
			if (mURL == legacy_client_list)
			{
				LL_WARNS("ClientTags") << "client_list_v2.xml download failed with status of " << status << LL_ENDL;
				// Wolfspirit: If something failes, try to use the local file
				FSData::getInstance()->updateClientTagsLocal();
			}
			return;
		}
	  
		LLSD content;
		LLBufferStream istr(channels, buffer.get());
		if (!LLSDSerialize::fromXML(content, istr))
		{
			llinfos << "Failed to deserialize LLSD. " << mURL << " [" << status << "]: " << reason << llendl;
			if (mURL == legacy_client_list)
			{
				LL_WARNS("ClientTags") << "Downloaded client_list_v2.xml decode failed." << LL_ENDL;
				// Wolfspirit: If something failes, try to use the local file
				FSData::getInstance()->updateClientTagsLocal();
			}
			return;
		}
		
		FSData::getInstance()->processResponder(content, mURL);
	}
开发者ID:wish-ds,项目名称:firestorm-ds,代码行数:33,代码来源:fsdata.cpp

示例5: completedRaw

void exoFlickrAuthResponse::completedRaw(U32 status, const std::string& reason, const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer)
{
	LLBufferStream istr(channels, buffer.get());
	std::ostringstream oss;
	oss << istr.rdbuf();
	std::string str = oss.str();
	LLSD result = LLURI::queryMap(str);
	mCallback((status == 200), result);
}
开发者ID:wish-ds,项目名称:firestorm-ds,代码行数:9,代码来源:exoflickrauth.cpp

示例6: istr

// virtual
void LLCurl::Responder::completedRaw(
	U32 status,
	const std::string& reason,
	const LLChannelDescriptors& channels,
	const LLIOPipe::buffer_ptr_t& buffer)
{
	LLSD content;
	LLBufferStream istr(channels, buffer.get());
	LLSDSerialize::fromXML(content, istr);
	completed(status, reason, content);
}
开发者ID:Boy,项目名称:rainbow,代码行数:12,代码来源:llcurl.cpp

示例7: completedRaw

void ModularSystemsDownloader::completedRaw(
			U32 status,
			const std::string& reason,
			const LLChannelDescriptors& channels,
			const LLIOPipe::buffer_ptr_t& buffer)
{
	LLBufferStream istr(channels, buffer.get());
	std::stringstream strstrm;
	strstrm << istr.rdbuf();
	std::string result = std::string(strstrm.str());
	mCallback(status, result);
}
开发者ID:N3X15,项目名称:Luna-Viewer,代码行数:12,代码来源:a_phoenixviewerlink.cpp

示例8: istr

// virtual
void LLCurl::Responder::completedRaw(
	U32 status,
	const std::string& reason,
	const LLChannelDescriptors& channels,
	const LLIOPipe::buffer_ptr_t& buffer)
{
	LLSD content;
	LLBufferStream istr(channels, buffer.get());
	if (!LLSDSerialize::fromXML(content, istr))
	{
		llinfos << "Failed to deserialize LLSD. " << mURL << " [" << status << "]: " << reason << llendl;
	}
	completed(status, reason, content);
}
开发者ID:Kiera,项目名称:Crow,代码行数:15,代码来源:llcurl.cpp

示例9: istr

	/*virtual*/ void completedRaw(
		U32 status,
		const std::string& reason,
		const LLChannelDescriptors& channels,
		const LLIOPipe::buffer_ptr_t& buffer)
	{
		LLBufferStream istr(channels, buffer.get());
		std::stringstream strstrm;
		strstrm << istr.rdbuf();
		const std::string body = strstrm.str();

		if (status != 200)
		{
			llwarns << "Failed to get upload config (" << status << ")" << llendl;
			LLWebProfile::reportImageUploadStatus(false);
			return;
		}

		Json::Value root;
		Json::Reader reader;
		if (!reader.parse(body, root))
		{
			llwarns << "Failed to parse upload config: " << reader.getFormatedErrorMessages() << llendl;
			LLWebProfile::reportImageUploadStatus(false);
			return;
		}

		// *TODO: 404 = not supported by the grid
		// *TODO: increase timeout or handle 499 Expired

		// Convert config to LLSD.
		const Json::Value data = root["data"];
		const std::string upload_url = root["url"].asString();
		LLSD config;
		config["acl"]						= data["acl"].asString();
		config["AWSAccessKeyId"]			= data["AWSAccessKeyId"].asString();
		config["Content-Type"]				= data["Content-Type"].asString();
		config["key"]						= data["key"].asString();
		config["policy"]					= data["policy"].asString();
		config["success_action_redirect"]	= data["success_action_redirect"].asString();
		config["signature"]					= data["signature"].asString();
		config["add_loc"]					= data.get("add_loc", "0").asString();
		config["caption"]					= data.get("caption", "").asString();

		// Do the actual image upload using the configuration.
		LL_DEBUGS("Snapshots") << "Got upload config, POSTing image to " << upload_url << ", config=[" << config << "]" << llendl;
		LLWebProfile::post(mImagep, config, upload_url);
	}
开发者ID:wish-ds,项目名称:firestorm-ds,代码行数:48,代码来源:llwebprofile.cpp

示例10: istr

// virtual
void LLCurl::Responder::completedRaw(
	const LLChannelDescriptors& channels,
	const LLIOPipe::buffer_ptr_t& buffer)
{
	LLBufferStream istr(channels, buffer.get());
	const bool emit_parse_errors = false;

	// <Techwolf Lupindo> pass parse error down code path
	mDeserializeError = false;

	std::string debug_body("(empty)");
	bool parsed=true;
	if (EOF == istr.peek())
	{
		parsed=false;
	}
	// Try to parse body as llsd, no matter what 'content-type' says.
	else if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(mContent, istr, emit_parse_errors))
	{
		parsed=false;
		char body[1025]; 
		body[1024] = '\0';
		istr.seekg(0, std::ios::beg);
		istr.get(body,1024);
		if (strlen(body) > 0)
		{
			mContent = body;
			debug_body = body;
		}
		// <Techwolf Lupindo> pass parse error down code path
		mDeserializeError = true;
	}

	// Only emit a warning if we failed to parse when 'content-type' == 'application/llsd+xml'
	if (!parsed && (HTTP_CONTENT_LLSD_XML == getResponseHeader(HTTP_IN_HEADER_CONTENT_TYPE)))
	{
		LL_WARNS() << "Failed to deserialize . " << mURL << " [status:" << mStatus << "] " 
			<< "(" << mReason << ") body: " << debug_body << LL_ENDL;
	}

	httpCompleted();
}
开发者ID:CaseyraeStarfinder,项目名称:Firestorm-Viewer,代码行数:43,代码来源:llcurl.cpp


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