//static void LLFloaterBlacklist::addEntry(LLUUID key, LLSD data) { if(key.notNull()) { if(!data.has("entry_type")) LL_WARNS("FloaterBlacklistAdd") << "addEntry called with no entry type, specify LLAssetType::Etype" << LL_ENDL; else if(!data.has("entry_name")) LL_WARNS("FloaterBlacklistAdd") << "addEntry called with no entry name, specify the name that should appear in the listing for this entry." << LL_ENDL; else { if(!data.has("entry_date")) { LLDate* curdate = new LLDate(time_corrected()); std::string input_date = curdate->asString(); input_date.replace(input_date.find("T"),1," "); input_date.resize(input_date.size() - 1); data["entry_date"] = input_date; } if(data["entry_type"].asString() == "1") { //remove sounds LLUUID sound_id=LLUUID(key); gVFS->removeFile(sound_id,LLAssetType::AT_SOUND); std::string wav_path= gDirUtilp->getExpandedFilename(LL_PATH_CACHE,sound_id.asString()) + ".dsf"; if(LLAPRFile::isExist(wav_path, LL_APR_RPB)) LLAPRFile::remove(wav_path); gAudiop->removeAudioData(sound_id); } blacklist_entries.insert(std::pair<LLUUID,LLSD>(key,data)); updateBlacklists(); } } else LL_WARNS("FloaterBlacklistAdd") << "addEntry called with a null entry key, please specify LLUUID of asset." << LL_ENDL; }
void date_test_object_t::test<3>() { LLDate date; std::istringstream stream(VALID_DATE); std::string expected_string = VALID_DATE; date.fromStream(stream); ensure_equals("fromStream failed", date.asString(), expected_string); }
void date_test_object_t::test<7>() { LLDate date; std::istringstream stream(VALID_DATE); stream >> date; std::string expected_str = VALID_DATE; std::ostringstream out_stream; out_stream << date; ensure_equals("<< failed", date.asString(),expected_str); ensure_equals("<< to >> failed", stream.str(),out_stream.str()); }
void SDTestObject::test<7>() // Test assignment and casting to various scalar types. These // assignments should invoke the right conversion without it being // mentioned explicitly. The few exceptions are marked SAD. { SDCleanupCheck check; LLSD v(" 42.375"); bool b = false; b = v; ensure_equals("assign to bool", b, true); b = (bool)v; ensure_equals("cast to bool", b, true); int i = 99; i = v; ensure_equals("assign to int", i, 42); i = (int)v; ensure_equals("cast to int", i, 42); double d = 3.14159; d = v; ensure_equals("assign to double", d, 42.375); d = (double)v; ensure_equals("cast to double", d, 42.375); std::string s = "yo"; // SAD s = v; ensure_equals("assign to string", s, " 42.375"); s = (std::string)v; ensure_equals("cast to string", s, " 42.375"); std::string uuidStr = "b1e50c2b-b627-4d23-8a86-a65d97b6319b"; v = uuidStr; LLUUID u; u = v; ensure_equals("assign to LLUUID", u, LLUUID(uuidStr)); // SAD u = (LLUUID)v; // ensure_equals("cast to LLUUID", u, LLUUID(uuidStr)); std::string dateStr = "2005-10-24T15:00:00Z"; v = dateStr; LLDate date; date = v; ensure_equals("assign to LLDate", date.asString(), dateStr); // SAD date = (LLDate)v; // ensure_equals("cast to LLDate", date.asString(), dateStr); std::string uriStr = "http://secondlife.com"; v = uriStr; LLURI uri; uri = v; ensure_equals("assign to LLURI", uri.asString(), uriStr); // SAD uri = (LLURI)v; // ensure_equals("cast to LLURI", uri.asString(), uriStr); }
void FSWSAssetBlacklist::addNewItemToBlacklist(LLUUID id, std::string name, std::string region, LLAssetType::EType type, bool save) { LLDate curdate = LLDate(time_corrected()); std::string input_date = curdate.asString(); input_date.replace(input_date.find("T"),1," "); input_date.resize(input_date.size() - 1); LLSD data; data["asset_name"] = name; data["asset_region"] = region; data["asset_type"] = type; data["asset_date"] = input_date; addNewItemToBlacklistData(LLUUID::generateNewID(id.asString() + "hash"), data, save); }
void FSWSAssetBlacklist::addNewItemToBlacklist(const LLUUID& id, const std::string& name, const std::string& region, LLAssetType::EType type, bool save) { if (isBlacklisted(id, type)) { return; } LLDate curdate = LLDate(time_corrected()); std::string input_date = curdate.asString(); input_date.replace(input_date.find("T"), 1, " "); input_date.resize(input_date.size() - 1); LLSD data; data["asset_name"] = name; data["asset_region"] = region; data["asset_type"] = type; data["asset_date"] = input_date; addNewItemToBlacklistData(id, data, save); }