Skip to content
Snippets Groups Projects
Commit 7eabd5e0 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Add move support to LLUIString

parent cb9b7644
No related branches found
No related tags found
No related merge requests found
......@@ -1086,7 +1086,7 @@ void LLButton::autoResize()
resize(getCurrentLabel());
}
void LLButton::resize(LLUIString label)
void LLButton::resize(const LLUIString& label)
{
// get label length
S32 label_width = mGLFont->getWidth(label.getString());
......
......@@ -237,7 +237,7 @@ class LLButton
LLFontGL::HAlign getImageOverlayHAlign() const { return mImageOverlayAlignment; }
void autoResize(); // resize with label of current btn state
void resize(LLUIString label); // resize with label input
void resize(const LLUIString& label); // resize with label input
void setLabel( const LLStringExplicit& label);
virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text );
void setLabelUnselected(const LLStringExplicit& label);
......
......@@ -41,12 +41,25 @@ LLUIString::LLUIString(const std::string& instring, const LLStringUtil::format_m
dirty();
}
LLUIString::LLUIString(std::string&& instring, const LLStringUtil::format_map_t& args)
: mOrig(std::move(instring)),
mArgs(new LLStringUtil::format_map_t(args))
{
dirty();
}
void LLUIString::assign(const std::string& s)
{
mOrig = s;
dirty();
}
void LLUIString::assign(std::string&& s)
{
mOrig = std::move(s);
dirty();
}
void LLUIString::setArgList(const LLStringUtil::format_map_t& args)
{
......
......@@ -60,11 +60,15 @@ class LLUIString
// and modify mOrig where appropriate
LLUIString() : mArgs(NULL), mNeedsResult(false), mNeedsWResult(false) {}
LLUIString(const std::string& instring, const LLStringUtil::format_map_t& args);
LLUIString(std::string&& instring, const LLStringUtil::format_map_t& args);
LLUIString(const std::string& instring) : mArgs(NULL) { assign(instring); }
LLUIString(std::string&& instring) : mArgs(NULL) { assign(std::move(instring)); }
~LLUIString() { delete mArgs; }
void assign(const std::string& instring);
void assign(std::string&& instring);
LLUIString& operator=(const std::string& s) { assign(s); return *this; }
LLUIString& operator=(std::string&& s) { assign(std::move(s)); return *this; }
void setArgList(const LLStringUtil::format_map_t& args);
void setArgs(const LLStringUtil::format_map_t& args) { setArgList(args); }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment