本文整理汇总了C++中LLUUID::toString方法的典型用法代码示例。如果您正苦于以下问题:C++ LLUUID::toString方法的具体用法?C++ LLUUID::toString怎么用?C++ LLUUID::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLUUID
的用法示例。
在下文中一共展示了LLUUID::toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: packUUID
BOOL LLDataPackerAsciiBuffer::packUUID(const LLUUID &value, const char *name)
{
BOOL success = TRUE;
writeIndentedName(name);
int numCopied = 0;
if (mWriteEnabled)
{
char tmp_str[64]; /* Flawfinder: ignore */
value.toString(tmp_str);
numCopied = snprintf(mCurBufferp,getBufferSize()-getCurrentSize(),"%s\n", tmp_str); /* Flawfinder: ignore */
}
else
{
numCopied = 64 + 1; // UUID + newline
}
// snprintf returns number of bytes that would have been written
// had the output not being truncated. In that case, it will
// return either -1 or value >= passed in size value . So a check needs to be added
// to detect truncation, and if there is any, only account for the
// actual number of bytes written..and not what could have been
// written.
if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize())
{
numCopied = getBufferSize()-getCurrentSize();
llwarns << "LLDataPackerAsciiBuffer::packUUID: truncated: " << llendl;
success = FALSE;
}
mCurBufferp += numCopied;
return success;
}
示例2: asset_id_to_filename
std::string asset_id_to_filename(const LLUUID &asset_id)
{
std::string asset_id_string;
asset_id.toString(asset_id_string);
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_id_string) + ".wbl";
return filename;
}
示例3: onSaveNewAssetComplete
// static
void LLWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userdata, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
LLWearableSaveData* data = (LLWearableSaveData*)userdata;
const std::string& type_name = LLWearable::typeToTypeName(data->mType);
if(0 == status)
{
// Success
llinfos << "Saved wearable " << type_name << llendl;
}
else
{
std::string buffer = llformat("Unable to save %s to central asset store.", type_name.c_str());
llwarns << buffer << " Status: " << status << llendl;
LLSD args;
args["NAME"] = type_name;
LLNotifications::instance().add("CannotSaveToAssetStore", args);
}
// Delete temp file
std::string new_asset_id_string;
new_asset_id.toString(new_asset_id_string);
std::string src_filename;
src_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,new_asset_id_string) + ".wbl";
LLFile::remove(src_filename);
// delete the context data
delete data;
}
示例4: uploadNextAsset
void LLObjectBackup::uploadNextAsset()
{
if (mTexturesList.empty())
{
llinfos << "Texture list is empty, moving to rez stage." << llendl;
mCurrentAsset = LLUUID::null;
importFirstObject();
return;
}
updateImportNumbers();
std::list<LLUUID>::iterator iter;
iter = mTexturesList.begin();
LLUUID id = *iter;
mTexturesList.pop_front();
llinfos << "Got texture ID " << id << ": trying to upload" << llendl;
mCurrentAsset = id;
std::string struid;
id.toString(struid);
std::string filename = mFolder + "//" + struid;
LLAssetID uuid;
LLTransactionID tid;
// generate a new transaction ID for this asset
tid.generate();
uuid = tid.makeAssetID(gAgent.getSecureSessionID());
S32 file_size;
LLAPRFile outfile;
outfile.open(filename, LL_APR_RB, LLAPRFile::global, &file_size);
if (outfile.getFileHandle())
{
const S32 buf_size = 65536;
U8 copy_buf[buf_size];
LLVFile file(gVFS, uuid, LLAssetType::AT_TEXTURE, LLVFile::WRITE);
file.setMaxSize(file_size);
while ((file_size = outfile.read(copy_buf, buf_size)))
{
file.write(copy_buf, file_size);
}
outfile.close();
}
else
{
llwarns << "Unable to access output file " << filename << llendl;
uploadNextAsset();
return;
}
myupload_new_resource(tid, LLAssetType::AT_TEXTURE, struid, struid, 0,
LLAssetType::AT_TEXTURE, LLInventoryType::defaultForAssetType(LLAssetType::AT_TEXTURE),
0x0, "Uploaded texture", NULL, NULL);
}
示例5: execTPH
void execTPH(LLUUID& target)
{
cmdline_printchat("Moderation: Teleporting "+ keyasname(target)+" home.");
strings_t strings;
std::string buffer;
gAgent.getID().toString(buffer);
strings.push_back(buffer);
target.toString(buffer);
strings.push_back(strings_t::value_type(buffer));
LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
sendEstateOwnerMessage(gMessageSystem, "teleporthomeuser", invoice, strings);
}
示例6: cache
void LLMuteList::cache(const LLUUID& agent_id)
{
// Write to disk even if empty.
if(mIsLoaded)
{
std::string agent_id_string;
std::string filename;
agent_id.toString(agent_id_string);
filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string) + ".cached_mute";
saveToFile(filename);
}
}
示例7: packUUID
BOOL LLDataPackerAsciiFile::packUUID(const LLUUID &value, const char *name)
{
BOOL success = TRUE;
writeIndentedName(name);
std::string tmp_str;
value.toString(tmp_str);
if (mFP)
{
fprintf(mFP,"%s\n", tmp_str.c_str());
}
else if (mOutputStream)
{
*mOutputStream <<"" << tmp_str << "\n";
}
return success;
}
示例8: legacyGetDataCallback
// static
void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, void *user_data, S32 status, LLExtStat ext_status)
{
LLLegacyAssetRequest *legacy = (LLLegacyAssetRequest *)user_data;
std::string filename;
// Check if the asset is marked toxic, and don't load bad stuff
BOOL toxic = gAssetStorage->isAssetToxic( uuid );
if ( !status
&& !toxic )
{
LLVFile file(vfs, uuid, type);
std::string uuid_str;
uuid.toString(uuid_str);
filename = llformat("%s.%s",gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str).c_str(),LLAssetType::lookup(type));
LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */
if (fp)
{
const S32 buf_size = 65536;
U8 copy_buf[buf_size];
while (file.read(copy_buf, buf_size)) /* Flawfinder: ignore */
{
if (fwrite(copy_buf, file.getLastBytesRead(), 1, fp) < 1)
{
// return a bad file error if we can't write the whole thing
status = LL_ERR_CANNOT_OPEN_FILE;
}
}
fclose(fp);
}
else
{
status = LL_ERR_CANNOT_OPEN_FILE;
}
}
if (status != LL_ERR_NOERR)
{
add(sFailedDownloadCount, 1);
}
legacy->mDownCallback(filename.c_str(), uuid, legacy->mUserData, status, ext_status);
delete legacy;
}
示例9: requestFromServer
//-----------------------------------------------------------------------------
// requestFromServer()
//-----------------------------------------------------------------------------
void LLMuteList::requestFromServer(const LLUUID& agent_id)
{
std::string agent_id_string;
std::string filename;
agent_id.toString(agent_id_string);
filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,agent_id_string) + ".cached_mute";
LLCRC crc;
crc.update(filename);
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_MuteListRequest);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, agent_id);
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_MuteData);
msg->addU32Fast(_PREHASH_MuteCRC, crc.getCRC());
gAgent.sendReliableMessage();
}
示例10: hasDecodedFile
bool LLAudioEngine::hasDecodedFile(const LLUUID &uuid)
{
std::string uuid_str;
uuid.toString(uuid_str);
std::string wav_path;
wav_path = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str);
wav_path += ".dsf";
if (gDirUtilp->fileExists(wav_path))
{
return true;
}
else
{
return false;
}
}
示例11: hasDecodedFile
bool LLAudioEngine::hasDecodedFile(const LLUUID &uuid)
{
std::string uuid_str;
uuid.toString(uuid_str);
std::string wav_path;
if(gDirUtilp->mm_usesnd()) //::MODMOD::
wav_path = gDirUtilp->getExpandedFilename(MM_SNDLOC,uuid_str);
else
wav_path = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str);
wav_path += ".dsf";
//llinfos << wav_path << llendl;
if (gDirUtilp->fileExists(wav_path))
{
return TRUE;
}
else
{
return FALSE;
}
}
示例12: onSaveComplete
// static
void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
LLSaveNotecardInfo* info = static_cast<LLSaveNotecardInfo*>(user_data);
if (0 == status)
{
if(info->mObjectUUID.isNull())
{
LLViewerInventoryItem* item;
item = (LLViewerInventoryItem*)gInventory.getItem(info->mItemUUID);
if(item)
{
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
new_item->setAssetUUID(asset_uuid);
new_item->setTransactionID(info->mTransactionID);
new_item->updateServer(FALSE);
gInventory.updateItem(new_item);
gInventory.notifyObservers();
}
else
{
llwarns << "Inventory item for script " << info->mItemUUID
<< " is no longer in agent inventory." << llendl;
}
}
else
{
LLViewerObject* object = gObjectList.findObject(info->mObjectUUID);
LLViewerInventoryItem* item = NULL;
if(object)
{
item = (LLViewerInventoryItem*)object->getInventoryObject(info->mItemUUID);
}
if(object && item)
{
item->setAssetUUID(asset_uuid);
item->setTransactionID(info->mTransactionID);
object->updateInventory(item, TASK_INVENTORY_ITEM_KEY, false);
dialog_refresh_all();
}
else
{
LLNotificationsUtil::add("SaveNotecardFailObjectNotFound");
}
}
// Perform item copy to inventory
if (info->mCopyItem.notNull())
{
if (LLViewerTextEditor* editor = info->mSelf->findChild<LLViewerTextEditor>("Notecard Editor"))
{
editor->copyInventory(info->mCopyItem);
}
}
// Find our window and close it if requested.
LLPreviewNotecard* previewp = (LLPreviewNotecard*)LLPreview::find(info->mItemUUID);
if (previewp && previewp->mCloseAfterSave)
{
previewp->close();
}
}
else
{
llwarns << "Problem saving notecard: " << status << llendl;
LLSD args;
args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
LLNotificationsUtil::add("SaveNotecardFailReason", args);
}
std::string uuid_string;
asset_uuid.toString(uuid_string);
std::string filename;
filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string) + ".tmp";
LLFile::remove(filename);
delete info;
}
示例13: scriptArrived
// This is the callback for when each script arrives
// static
void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id,
LLAssetType::EType type,
void* user_data, S32 status, LLExtStat ext_status)
{
llinfos << "LLFloaterCompileQueue::scriptArrived()" << llendl;
LLScriptQueueData* data = (LLScriptQueueData*)user_data;
if(!data) return;
LLFloaterCompileQueue* queue = static_cast<LLFloaterCompileQueue*>
(LLFloaterScriptQueue::findInstance(data->mQueueID));
std::string buffer;
if(queue && (0 == status))
{
//llinfos << "ITEM NAME 3: " << data->mScriptName << llendl;
// Dump this into a file on the local disk so we can compile it.
std::string filename;
LLVFile file(vfs, asset_id, type);
std::string uuid_str;
asset_id.toString(uuid_str);
filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str) + llformat(".%s",LLAssetType::lookup(type));
const bool is_running = true;
LLViewerObject* object = gObjectList.findObject(data->mTaskId);
if (object)
{
std::string url = object->getRegion()->getCapability("UpdateScriptTask");
if(!url.empty())
{
// Read script source in to buffer.
U32 script_size = file.getSize();
U8* script_data = new U8[script_size];
file.read(script_data, script_size);
queue->mUploadQueue->queue(filename, data->mTaskId,
data->mItemId, is_running, queue->mMono, queue->getID(),
script_data, script_size, data->mScriptName);
}
else
{
// It's now in the file, now compile it.
buffer = std::string("Downloaded, now compiling: ") + data->mScriptName; // *TODO: Translate
// Write script to local file for compilation.
LLFILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/
if (fp)
{
const S32 buf_size = 65536;
U8 copy_buf[buf_size];
while (file.read(copy_buf, buf_size)) /*Flawfinder: ignore*/
{
if (fwrite(copy_buf, file.getLastBytesRead(), 1, fp) < 1)
{
// return a bad file error if we can't write the whole thing
status = LL_ERR_CANNOT_OPEN_FILE;
}
}
fclose(fp);
}
else
{
llwarns << "Unable to find object to compile" << llendl; // why an error? KL
}
// TODO: babbage: No compile if no cap.
queue->compile(filename, data->mItemId);
// Delete it after we're done compiling?
LLFile::remove(filename);
}
}
}
else
{
LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED );
if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status )
{
LLChat chat(std::string("Script not found on server.")); // *TODO: Translate
LLFloaterChat::addChat(chat);
buffer = std::string("Problem downloading: ") + data->mScriptName; // *TODO: Translate
}
else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
{
LLChat chat(std::string("Insufficient permissions to download a script.")); // *TODO: Translate
LLFloaterChat::addChat(chat);
buffer = std::string("Insufficient permissions for: ") + data->mScriptName; // *TODO: Translate
}
else
{
buffer = std::string("Unknown failure to download ") + data->mScriptName; // *TODO: Translate
}
llwarns << "Problem downloading script asset." << llendl;
if(queue) queue->removeItemByItemID(data->mItemId);
}
if(queue && (buffer.size() > 0))
//.........这里部分代码省略.........
示例14: setGroupID
void LLPanelGroup::setGroupID(const LLUUID& group_id)
{
std::string str_group_id;
group_id.toString(str_group_id);
bool is_same_id = group_id == mID;
LLGroupMgr::getInstance()->removeObserver(this);
mID = group_id;
LLGroupMgr::getInstance()->addObserver(this);
for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin(); it!=mTabs.end(); ++it)
(*it)->setGroupID(group_id);
LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID);
if(gdatap)
{
std::string group_name = gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName;
childSetValue("group_name", group_name);
childSetToolTip("group_name",group_name);
}
LLButton* button_apply = findChild<LLButton>("btn_apply");
LLButton* button_refresh = findChild<LLButton>("btn_refresh");
LLButton* button_create = findChild<LLButton>("btn_create");
LLButton* button_cancel = findChild<LLButton>("btn_cancel");
LLButton* button_call = findChild<LLButton>("btn_call");
LLButton* button_chat = findChild<LLButton>("btn_chat");
bool is_null_group_id = group_id == LLUUID::null;
if(button_apply)
button_apply->setVisible(!is_null_group_id);
if(button_refresh)
button_refresh->setVisible(!is_null_group_id);
if(button_create)
button_create->setVisible(is_null_group_id);
if(button_cancel)
button_cancel->setVisible(!is_null_group_id);
if(button_call)
button_call->setVisible(!is_null_group_id);
if(button_chat)
button_chat->setVisible(!is_null_group_id);
getChild<LLUICtrl>("prepend_founded_by")->setVisible(!is_null_group_id);
LLAccordionCtrl* tab_ctrl = getChild<LLAccordionCtrl>("groups_accordion");
tab_ctrl->reset();
LLAccordionCtrlTab* tab_general = getChild<LLAccordionCtrlTab>("group_general_tab");
LLAccordionCtrlTab* tab_roles = getChild<LLAccordionCtrlTab>("group_roles_tab");
LLAccordionCtrlTab* tab_notices = getChild<LLAccordionCtrlTab>("group_notices_tab");
LLAccordionCtrlTab* tab_land = getChild<LLAccordionCtrlTab>("group_land_tab");
if(mButtonJoin)
mButtonJoin->setVisible(false);
if(is_null_group_id)//creating new group
{
if(!tab_general->getDisplayChildren())
tab_general->changeOpenClose(tab_general->getDisplayChildren());
if(tab_roles->getDisplayChildren())
tab_roles->changeOpenClose(tab_roles->getDisplayChildren());
if(tab_notices->getDisplayChildren())
tab_notices->changeOpenClose(tab_notices->getDisplayChildren());
if(tab_land->getDisplayChildren())
tab_land->changeOpenClose(tab_land->getDisplayChildren());
tab_roles->setVisible(false);
tab_notices->setVisible(false);
tab_land->setVisible(false);
getChild<LLUICtrl>("group_name")->setVisible(false);
getChild<LLUICtrl>("group_name_editor")->setVisible(true);
if(button_call)
button_call->setVisible(false);
if(button_chat)
button_chat->setVisible(false);
}
else
{
if(!is_same_id)
{
if(!tab_general->getDisplayChildren())
tab_general->changeOpenClose(tab_general->getDisplayChildren());
if(tab_roles->getDisplayChildren())
tab_roles->changeOpenClose(tab_roles->getDisplayChildren());
if(tab_notices->getDisplayChildren())
tab_notices->changeOpenClose(tab_notices->getDisplayChildren());
if(tab_land->getDisplayChildren())
tab_land->changeOpenClose(tab_land->getDisplayChildren());
}
LLGroupData agent_gdatap;
//.........这里部分代码省略.........
示例15: onSaveComplete
// static
void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
LLSaveNotecardInfo* info = (LLSaveNotecardInfo*)user_data;
if(info && (0 == status))
{
if(info->mObjectUUID.isNull())
{
LLViewerInventoryItem* item;
item = (LLViewerInventoryItem*)gInventory.getItem(info->mItemUUID);
if(item)
{
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
new_item->setAssetUUID(asset_uuid);
new_item->setTransactionID(info->mTransactionID);
new_item->updateServer(FALSE);
gInventory.updateItem(new_item);
gInventory.notifyObservers();
}
else
{
llwarns << "Inventory item for script " << info->mItemUUID
<< " is no longer in agent inventory." << llendl;
}
}
else
{
LLViewerObject* object = gObjectList.findObject(info->mObjectUUID);
LLViewerInventoryItem* item = NULL;
if(object)
{
item = (LLViewerInventoryItem*)object->getInventoryObject(info->mItemUUID);
}
if(object && item)
{
item->setAssetUUID(asset_uuid);
item->setTransactionID(info->mTransactionID);
object->updateInventory(item, TASK_INVENTORY_ITEM_KEY, false);
dialog_refresh_all();
}
else
{
gViewerWindow->alertXml("SaveNotecardFailObjectNotFound");
}
}
// Perform item copy to inventory
if (info->mCopyItem.notNull())
{
LLViewerTextEditor* editor = LLViewerUICtrlFactory::getViewerTextEditorByName(info->mSelf, "Notecard Editor");
if (editor)
{
editor->copyInventory(info->mCopyItem);
}
}
// Find our window and close it if requested.
LLPreviewNotecard* previewp = (LLPreviewNotecard*)LLPreview::find(info->mItemUUID);
if (previewp && previewp->mCloseAfterSave)
{
previewp->close();
}
}
else
{
llwarns << "Problem saving notecard: " << status << llendl;
LLStringBase<char>::format_map_t args;
args["[REASON]"] = std::string(LLAssetStorage::getErrorString(status));
gViewerWindow->alertXml("SaveNotecardFailReason",args);
}
char uuid_string[UUID_STR_LENGTH]; /*Flawfinder: ignore*/
asset_uuid.toString(uuid_string);
char filename[LL_MAX_PATH]; /*Flawfinder: ignore*/
snprintf(filename, LL_MAX_PATH, "%s.tmp", gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string).c_str()); /* Flawfinder: ignore */
LLFile::remove(filename);
delete info;
}