summaryrefslogtreecommitdiff
path: root/indra/llui/lluistring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/lluistring.cpp')
-rw-r--r--indra/llui/lluistring.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp
index 3e9b956ee6..ac69d3bf85 100644
--- a/indra/llui/lluistring.cpp
+++ b/indra/llui/lluistring.cpp
@@ -34,7 +34,7 @@ LLFastTimer::DeclareTimer FTM_UI_STRING("UI String");
LLUIString::LLUIString(const std::string& instring, const LLStringUtil::format_map_t& args)
: mOrig(instring),
- mArgs(args)
+ mArgs(new LLStringUtil::format_map_t(args))
{
dirty();
}
@@ -48,7 +48,7 @@ void LLUIString::assign(const std::string& s)
void LLUIString::setArgList(const LLStringUtil::format_map_t& args)
{
- mArgs = args;
+ getArgs() = args;
dirty();
}
@@ -68,7 +68,7 @@ void LLUIString::setArgs(const LLSD& sd)
void LLUIString::setArg(const std::string& key, const std::string& replacement)
{
- mArgs[key] = replacement;
+ getArgs()[key] = replacement;
dirty();
}
@@ -129,14 +129,14 @@ void LLUIString::updateResult() const
mResult = mOrig;
// get the defailt args + local args
- if (mArgs.empty())
+ if (!mArgs || mArgs->empty())
{
LLStringUtil::format(mResult, LLTrans::getDefaultArgs());
}
else
{
LLStringUtil::format_map_t combined_args = LLTrans::getDefaultArgs();
- combined_args.insert(mArgs.begin(), mArgs.end());
+ combined_args.insert(mArgs->begin(), mArgs->end());
LLStringUtil::format(mResult, combined_args);
}
}
@@ -147,3 +147,12 @@ void LLUIString::updateWResult() const
mWResult = utf8str_to_wstring(getUpdatedResult());
}
+
+LLStringUtil::format_map_t& LLUIString::getArgs()
+{
+ if (!mArgs)
+ {
+ mArgs = new LLStringUtil::format_map_t;
+ }
+ return *mArgs;
+}