本文整理汇总了C++中LLString::find_last_of方法的典型用法代码示例。如果您正苦于以下问题:C++ LLString::find_last_of方法的具体用法?C++ LLString::find_last_of怎么用?C++ LLString::find_last_of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLString
的用法示例。
在下文中一共展示了LLString::find_last_of方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: upload_new_resource
void upload_new_resource(const LLString& src_filename, std::string name,
std::string desc, S32 compression_info,
LLAssetType::EType destination_folder_type,
LLInventoryType::EType inv_type,
U32 next_owner_perm,
const LLString& display_name,
LLAssetStorage::LLStoreAssetCallback callback,
void *userdata)
{
// Generate the temporary UUID.
LLString filename = gDirUtilp->getTempFilename();
LLTransactionID tid;
LLAssetID uuid;
LLStringBase<char>::format_map_t args;
LLString ext = src_filename.substr(src_filename.find_last_of('.'));
LLAssetType::EType asset_type = LLAssetType::AT_NONE;
char error_message[MAX_STRING]; /* Flawfinder: ignore */
error_message[0] = '\0';
LLString temp_str;
BOOL error = FALSE;
if (ext.empty())
{
LLString::size_type offset = filename.find_last_of(gDirUtilp->getDirDelimiter());
if (offset != LLString::npos)
offset++;
LLString short_name = filename.substr(offset);
// No extension
snprintf(error_message, /* Flawfinder: ignore */
MAX_STRING,
"No file extension for the file: '%s'\nPlease make sure the file has a correct file extension",
short_name.c_str());
args["[FILE]"] = short_name;
upload_error(error_message, "NofileExtension", filename, args);
return;
}
else if( LLString::compareInsensitive(ext.c_str(),".bmp") == 0 )
{
asset_type = LLAssetType::AT_TEXTURE;
if (!LLViewerImageList::createUploadFile(src_filename,
filename,
IMG_CODEC_BMP ))
{
snprintf(error_message, MAX_STRING, "Problem with file %s:\n\n%s\n", /* Flawfinder: ignore */
src_filename.c_str(), LLImageBase::getLastError().c_str());
args["[FILE]"] = src_filename;
args["[ERROR]"] = LLImageBase::getLastError();
upload_error(error_message, "ProblemWithFile", filename, args);
return;
}
}
else if( LLString::compareInsensitive(ext.c_str(),".tga") == 0 )
{
asset_type = LLAssetType::AT_TEXTURE;
if (!LLViewerImageList::createUploadFile(src_filename,
filename,
IMG_CODEC_TGA ))
{
snprintf(error_message, MAX_STRING, "Problem with file %s:\n\n%s\n", /* Flawfinder: ignore */
src_filename.c_str(), LLImageBase::getLastError().c_str());
args["[FILE]"] = src_filename;
args["[ERROR]"] = LLImageBase::getLastError();
upload_error(error_message, "ProblemWithFile", filename, args);
return;
}
}
else if( LLString::compareInsensitive(ext.c_str(),".jpg") == 0 || LLString::compareInsensitive(ext.c_str(),".jpeg") == 0)
{
asset_type = LLAssetType::AT_TEXTURE;
if (!LLViewerImageList::createUploadFile(src_filename,
filename,
IMG_CODEC_JPEG ))
{
snprintf(error_message, MAX_STRING, "Problem with file %s:\n\n%s\n", /* Flawfinder: ignore */
src_filename.c_str(), LLImageBase::getLastError().c_str());
args["[FILE]"] = src_filename;
args["[ERROR]"] = LLImageBase::getLastError();
upload_error(error_message, "ProblemWithFile", filename, args);
return;
}
}
else if(LLString::compareInsensitive(ext.c_str(),".wav") == 0)
{
asset_type = LLAssetType::AT_SOUND; // tag it as audio
S32 encode_result = 0;
S32 bitrate = 128;
if (compression_info)
{
bitrate = compression_info;
}
llinfos << "Attempting to encode wav as an ogg file at " << bitrate << "kbps" << llendl;
encode_result = encode_vorbis_file_at(src_filename.c_str(), filename.c_str(), bitrate*1000);
//.........这里部分代码省略.........