diff options
| author | Bryan O'Sullivan <bos@lindenlab.com> | 2009-08-31 13:47:47 -0700 |
|---|---|---|
| committer | Bryan O'Sullivan <bos@lindenlab.com> | 2009-08-31 13:47:47 -0700 |
| commit | 30ff6cabd61f2f083df5df1e6e70cc94742af477 (patch) | |
| tree | 631935f1cf59d19a91cdad65e9a75fe825afda7d /indra/llui/lluistring.cpp | |
| parent | ff11d74820c89822cd067b51727d9df1dc87d0d0 (diff) | |
| parent | 3ac3a4b206c08ed06b889bdaa24074b6aa0e020a (diff) | |
Merge with trunk
Diffstat (limited to 'indra/llui/lluistring.cpp')
| -rw-r--r-- | indra/llui/lluistring.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp index 0b76b8e814..20ff71378e 100644 --- a/indra/llui/lluistring.cpp +++ b/indra/llui/lluistring.cpp @@ -33,9 +33,12 @@ #include "linden_common.h" #include "lluistring.h" #include "llsd.h" +#include "lltrans.h" const LLStringUtil::format_map_t LLUIString::sNullArgs; +LLFastTimer::DeclareTimer FTM_UI_STRING("UI String"); + LLUIString::LLUIString(const std::string& instring, const LLStringUtil::format_map_t& args) : mOrig(instring), @@ -58,6 +61,8 @@ void LLUIString::setArgList(const LLStringUtil::format_map_t& args) void LLUIString::setArgs(const LLSD& sd) { + LLFastTimer timer(FTM_UI_STRING); + if (!sd.isMap()) return; for(LLSD::map_const_iterator sd_it = sd.beginMap(); sd_it != sd.endMap(); @@ -111,7 +116,20 @@ void LLUIString::clear() void LLUIString::format() { + LLFastTimer timer(FTM_UI_STRING); + + // optimize for empty strings (don't attempt string replacement) + if (mOrig.empty()) + { + mResult.clear(); + mWResult.clear(); + return; + } mResult = mOrig; - LLStringUtil::format(mResult, mArgs); + + // get the defailt args + local args + LLStringUtil::format_map_t combined_args = LLTrans::getDefaultArgs(); + combined_args.insert(mArgs.begin(), mArgs.end()); + LLStringUtil::format(mResult, combined_args); mWResult = utf8str_to_wstring(mResult); } |
