summaryrefslogtreecommitdiff
path: root/indra/llui/lluistring.h
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2010-12-04 09:14:58 -0500
committerOz Linden <oz@lindenlab.com>2010-12-04 09:14:58 -0500
commitefa42a6aab6d3ada198072c0e2be2b7d9b4e1eb5 (patch)
tree39a949e1570c3524c8560522b693328fc7d9afbf /indra/llui/lluistring.h
parenteed7b7201188e01a452c7f4c511c0cb157dc7a5f (diff)
parent7549df0eaf347e9f490f9cfaf4950dd623a08237 (diff)
merge up to viewer-development
Diffstat (limited to 'indra/llui/lluistring.h')
-rw-r--r--indra/llui/lluistring.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/indra/llui/lluistring.h b/indra/llui/lluistring.h
index fc7ac37d99..4faa0e070e 100644
--- a/indra/llui/lluistring.h
+++ b/indra/llui/lluistring.h
@@ -58,9 +58,11 @@ class LLUIString
public:
// These methods all perform appropriate argument substitution
// and modify mOrig where appropriate
- LLUIString() : mNeedsResult(false), mNeedsWResult(false) {}
+ LLUIString() : mArgs(NULL), mNeedsResult(false), mNeedsWResult(false) {}
LLUIString(const std::string& instring, const LLStringUtil::format_map_t& args);
- LLUIString(const std::string& instring) { assign(instring); }
+ LLUIString(const std::string& instring) : mArgs(NULL) { assign(instring); }
+
+ ~LLUIString() { delete mArgs; }
void assign(const std::string& instring);
LLUIString& operator=(const std::string& s) { assign(s); return *this; }
@@ -80,15 +82,15 @@ public:
S32 length() const { return getUpdatedWResult().size(); }
void clear();
- void clearArgs() { mArgs.clear(); }
-
+ void clearArgs() { if (mArgs) mArgs->clear(); }
+
// These utility functions are included for text editing.
// They do not affect mOrig and do not perform argument substitution
void truncate(S32 maxchars);
void erase(S32 charidx, S32 len);
void insert(S32 charidx, const LLWString& wchars);
void replace(S32 charidx, llwchar wc);
-
+
private:
// something changed, requiring reformatting of strings
void dirty();
@@ -99,11 +101,12 @@ private:
// do actual work of updating strings (non-inlined)
void updateResult() const;
void updateWResult() const;
-
+ LLStringUtil::format_map_t& getArgs();
+
std::string mOrig;
mutable std::string mResult;
mutable LLWString mWResult; // for displaying
- LLStringUtil::format_map_t mArgs;
+ LLStringUtil::format_map_t* mArgs;
// controls lazy evaluation
mutable bool mNeedsResult;