本文整理汇总了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;
}
示例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();
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}