本文整理汇总了C++中LLPointer::format方法的典型用法代码示例。如果您正苦于以下问题:C++ LLPointer::format方法的具体用法?C++ LLPointer::format怎么用?C++ LLPointer::format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLPointer
的用法示例。
在下文中一共展示了LLPointer::format方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: savePersistentNotifications
void savePersistentNotifications()
{
//llinfos << "Saving open notifications to " << mFileName << llendl;
llofstream notify_file(mFileName.c_str());
if (!notify_file.is_open())
{
llwarns << "Failed to open " << mFileName << llendl;
return;
}
LLSD output;
output["version"] = NOTIFICATION_PERSIST_VERSION;
LLSD& data = output["data"];
for (LLNotificationSet::iterator it = mItems.begin(); it != mItems.end(); ++it)
{
if (!LLNotifications::instance().templateExists((*it)->getName())) continue;
// only store notifications flagged as persisting
LLNotificationTemplatePtr templatep = LLNotifications::instance().getTemplate((*it)->getName());
if (!templatep->mPersist) continue;
data.append((*it)->asLLSD());
}
LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
formatter->format(output, notify_file, LLSDFormatter::OPTIONS_PRETTY);
}
示例2: serialize
// static
void LLSDSerialize::serialize(const LLSD& sd, std::ostream& str, ELLSD_Serialize type, U32 options)
{
LLPointer<LLSDFormatter> f = NULL;
switch (type)
{
case LLSD_BINARY:
str << "<? " << LLSD_BINARY_HEADER << " ?>\n";
f = new LLSDBinaryFormatter;
break;
case LLSD_XML:
str << "<? " << LLSD_XML_HEADER << " ?>\n";
f = new LLSDXMLFormatter;
break;
default:
llwarns << "serialize request for unkown ELLSD_Serialize" << llendl;
}
if (f.notNull())
{
f->format(sd, str, options);
}
}
示例3: savePresets
void LLWLParamManager::savePresets(const std::string & fileName)
{
//Nobody currently calls me, but if they did, then its reasonable to write the data out to the user's folder
//and not over the RO system wide version.
LLSD paramsData(LLSD::emptyMap());
std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", fileName));
for(std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.begin();
mIt != mParamList.end();
++mIt)
{
paramsData[mIt->first] = mIt->second.getAll();
}
llofstream presetsXML(pathName);
LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY);
presetsXML.close();
propagateParameters();
}
示例4: savePreset
void LLWLParamManager::savePreset(const std::string & name)
{
// bugfix for SL-46920: preventing filenames that break stuff.
char * curl_str = curl_escape(name.c_str(), name.size());
std::string escaped_filename(curl_str);
curl_free(curl_str);
curl_str = NULL;
escaped_filename += ".xml";
// make an empty llsd
LLSD paramsData(LLSD::emptyMap());
std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", escaped_filename));
// fill it with LLSD windlight params
paramsData = mParamList[name].getAll();
// write to file
llofstream presetsXML(pathName);
LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY);
presetsXML.close();
propagateParameters();
notifyObservers();
}
示例5: savePresetToNotecard
bool LLWLParamManager::savePresetToNotecard(const std::string & name)
{
// make an empty llsd
LLSD paramsData(LLSD::emptyMap());
LLWLParamKey key(name, LLEnvKey::SCOPE_LOCAL);
if(!hasParamSet(key)) return false;
// fill it with LLSD windlight params
paramsData = mParamList[key].getAll();
// get some XML
std::ostringstream presetsXML;
LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY);
// Write it to a notecard
LLNotecard notecard;
notecard.setText(presetsXML.str());
LLInventoryItem *item = gInventory.getItem(mParamList[key].mInventoryID);
if(!item)
{
mParamList[key].mInventoryID = LLUUID::null;
return false;
}
std::string agent_url = gAgent.getRegion()->getCapability("UpdateNotecardAgentInventory");
if(!agent_url.empty())
{
LLTransactionID tid;
LLAssetID asset_id;
tid.generate();
asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
LLVFile file(gVFS, asset_id, LLAssetType::AT_NOTECARD, LLVFile::APPEND);
std::ostringstream stream;
notecard.exportStream(stream);
std::string buffer = stream.str();
S32 size = buffer.length() + 1;
file.setMaxSize(size);
file.write((U8*)buffer.c_str(), size);
LLSD body;
body["item_id"] = item->getUUID();
LLHTTPClient::post(agent_url, body, new LLUpdateAgentInventoryResponder(body, asset_id, LLAssetType::AT_NOTECARD));
}
else
{
LL_WARNS("WindLight") << "Failed to save notecard." << LL_ENDL;
return false;
}
return true;
}
示例6: saveEffectAs
void LLPostProcess::saveEffectAs(std::string const & effectName)
{
mAllEffectInfo[effectName] = mSelectedEffectInfo;
std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME));
//llinfos << "Saving PostProcess Effects settings to " << pathName << llendl;
llofstream effectsXML(pathName);
LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
formatter->format(mAllEffectInfo, effectsXML);
}
示例7: savePreset
void LLWLParamManager::savePreset(LLWLParamKey key)
{
llassert(key.scope == LLEnvKey::SCOPE_LOCAL && !key.name.empty());
// make an empty llsd
LLSD paramsData(LLSD::emptyMap());
std::string pathName(getUserDir() + LLWeb::curlEscape(key.name) + ".xml");
// fill it with LLSD windlight params
paramsData = mParamList[key].getAll();
// write to file
llofstream presetsXML(pathName);
LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY);
presetsXML.close();
propagateParameters();
}
示例8: savePreset
void LLWaterParamManager::savePreset(const std::string & name)
{
llassert(!name.empty());
// make an empty llsd
LLSD paramsData(LLSD::emptyMap());
std::string pathName(getUserDir() + LLURI::escape(name) + ".xml");
// fill it with LLSD windlight params
paramsData = mParamList[name].getAll();
// write to file
llofstream presetsXML(pathName.c_str());
LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY);
presetsXML.close();
propagateParameters();
}
示例9: savePreset
void AscentDayCycleManager::savePreset(const std::string & name)
{
// bugfix for SL-46920: preventing filenames that break stuff.
std::string escaped_filename = LLWeb::curlEscape(name);
escaped_filename += ".xml";
// make an empty llsd
LLSD paramsData(LLSD::emptyMap());
std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/days", escaped_filename));
// fill it with LLSD windlight params
//paramsData = mParamList[name].getAll();
// write to file
llofstream presetsXML(pathName);
LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY);
presetsXML.close();
}
示例10: savePreset
void LLWaterParamManager::savePreset(const std::string & name)
{
std::string escaped_filename = LLCurl::escapeSafe(name);
escaped_filename += ".xml";
// make an empty llsd
LLSD paramsData(LLSD::emptyMap());
std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", escaped_filename));
// fill it with LLSD windlight params
paramsData = mParamList[name].getAll();
// write to file
llofstream presetsXML(pathName);
LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY);
presetsXML.close();
propagateParameters();
}
示例11: saveDayCycle
void LLWLDayCycle::saveDayCycle(const std::string & fileName)
{
// bugfix for SL-46920: preventing filenames that break stuff.
char * curl_str = curl_escape(fileName.c_str(), fileName.size());
std::string escaped_filename(curl_str);
curl_free(curl_str);
curl_str = NULL;
escaped_filename += ".xml";
std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/days", escaped_filename));
llinfos << "Saving Day Cycle preset from " << pathName << llendl;
llofstream day_cycle_xml;
day_cycle_xml.open(pathName.c_str());
// That failed, try loading from the users area instead.
if(!day_cycle_xml)
{
pathName=gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/days", escaped_filename);
llinfos << "Saving User Day Cycle preset from " << pathName << llendl;
day_cycle_xml.open(pathName.c_str());
}
LLSD day_data(LLSD::emptyArray());
for(std::map<F32, std::string>::const_iterator mIt = mTimeMap.begin();
mIt != mTimeMap.end();
++mIt)
{
LLSD key(LLSD::emptyArray());
key.append(mIt->first);
key.append(mIt->second);
day_data.append(key);
}
LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
formatter->format(day_data, day_cycle_xml, LLSDFormatter::OPTIONS_PRETTY);
day_cycle_xml.close();
}
示例12: savePresets
void LLWLParamManager::savePresets(const std::string & fileName)
{
LLSD paramsData(LLSD::emptyMap());
std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", fileName));
for(std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.begin();
mIt != mParamList.end();
++mIt)
{
paramsData[mIt->first] = mIt->second.getAll();
}
llofstream presetsXML(pathName);
LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY);
presetsXML.close();
}
示例13: saveDayCycle
void LLWLDayCycle::saveDayCycle(const std::string & fileName)
{
LLSD day_data(LLSD::emptyArray());
std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/days", fileName));
//llinfos << "Saving WindLight settings to " << pathName << llendl;
for(std::map<F32, std::string>::const_iterator mIt = mTimeMap.begin();
mIt != mTimeMap.end();
++mIt)
{
LLSD key(LLSD::emptyArray());
key.append(mIt->first);
key.append(mIt->second);
day_data.append(key);
}
llofstream day_cycle_xml(pathName);
LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
formatter->format(day_data, day_cycle_xml, LLSDFormatter::OPTIONS_PRETTY);
day_cycle_xml.close();
}