diff options
Diffstat (limited to 'indra')
| -rwxr-xr-x | indra/llui/llkeywords.cpp | 65 | ||||
| -rwxr-xr-x | indra/llui/llkeywords.h | 24 | ||||
| -rw-r--r-- | indra/newview/llsyntaxid.cpp | 15 | ||||
| -rw-r--r-- | indra/newview/llsyntaxid.h | 5 | 
4 files changed, 59 insertions, 50 deletions
diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 9be15d8f1d..9c5a339b6d 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -67,8 +67,8 @@ inline bool LLKeywordToken::isTail(const llwchar* s) const  	return res;  } -LLKeywords::LLKeywords() : -	mLoaded(false) +LLKeywords::LLKeywords() +:	mLoaded(false)  {  } @@ -92,7 +92,7 @@ void LLKeywords::addToken(LLKeywordToken::ETokenType type,  	std::string tip_text = tool_tip_in;  	LLStringUtil::replaceString(tip_text, "\\n", "\n" );  	LLStringUtil::replaceString(tip_text, "\t", " " ); -	if (tip_text == "") +	if (tip_text.empty())  	{  		tip_text = "[no info]";  	} @@ -161,7 +161,7 @@ std::string LLKeywords::getArguments(LLSD& arguments)  	{  		LL_WARNS("SyntaxLSL") << "Not an array! Invalid arguments LLSD passed to function." << arguments << LL_ENDL;  	} -	return argString == "" ? "" : argString; +	return argString;  }  std::string LLKeywords::getAttribute(const std::string& key) @@ -299,14 +299,14 @@ void LLKeywords::processTokensGroup(const LLSD& tokens, const std::string& group  	if (tokens.isMap())  	{  		LLSD::map_const_iterator outer_itr = tokens.beginMap(); -		for ( ; outer_itr != tokens.endMap(); ++outer_itr) +		for ( ; outer_itr != tokens.endMap(); ++outer_itr )  		{  			if (outer_itr->second.isMap())  			{  				mAttributes.clear();  				LLSD arguments = LLSD();  				LLSD::map_const_iterator inner_itr = outer_itr->second.beginMap(); -				for ( ; inner_itr != outer_itr->second.endMap(); ++inner_itr) +				for ( ; inner_itr != outer_itr->second.endMap(); ++inner_itr )  				{  					if (inner_itr->first == "arguments")  					{  @@ -326,33 +326,34 @@ void LLKeywords::processTokensGroup(const LLSD& tokens, const std::string& group  				}  				std::string tooltip = ""; -				if (token_type == LLKeywordToken::TT_CONSTANT) +				switch (token_type)  				{ -					color_group = getColorGroup(group + "-" + getAttribute("type")); -					tooltip = "Type: " + getAttribute("type") + ", Value: " + getAttribute("value"); -				} -				else if (token_type == LLKeywordToken::TT_EVENT) -				{ -					tooltip = outer_itr->first + "(" + getArguments(arguments) + ")"; -				} -				else if (token_type == LLKeywordToken::TT_FUNCTION) -				{ -					tooltip = getAttribute("return") + " " + outer_itr->first + "(" + getArguments(arguments) + ");"; -					tooltip += "\nEnergy: "; -					tooltip += getAttribute("energy") == "" ? "0.0" : getAttribute("energy"); -					if (getAttribute("sleep") != "") -					{ -						tooltip += ", Sleep: " + getAttribute("sleep"); -					} +					case LLKeywordToken::TT_CONSTANT: +						color_group = getColorGroup(group + "-" + getAttribute("type")); +						tooltip = "Type: " + getAttribute("type") + ", Value: " + getAttribute("value"); +						break; +					case LLKeywordToken::TT_EVENT: +						tooltip = outer_itr->first + "(" + getArguments(arguments) + ")"; +						break; +					case LLKeywordToken::TT_FUNCTION: +						tooltip = getAttribute("return") + " " + outer_itr->first + "(" + getArguments(arguments) + ");"; +						tooltip.append("\nEnergy: "); +						tooltip.append(getAttribute("energy").empty() ? "0.0" : getAttribute("energy")); +						if (!getAttribute("sleep").empty()) +						{ +							tooltip += ", Sleep: " + getAttribute("sleep"); +						} +					default: +						break;  				} -				if (getAttribute("tooltip") != "") +				if (!getAttribute("tooltip").empty())  				{ -					if (tooltip != "") +					if (!tooltip.empty())  					{ -						tooltip += "\n"; +						tooltip.append("\n");  					} -					tooltip += getAttribute("tooltip"); +					tooltip.append(getAttribute("tooltip"));  				}  				color = getAttribute("deprecated") == "true" ? color_deprecated : color_group; @@ -399,15 +400,19 @@ LLKeywords::WStringMapIndex::WStringMapIndex(const LLWString& str)  	copyData(str.data(), str.size());  } -LLKeywords::WStringMapIndex::WStringMapIndex(const llwchar *start, size_t length): -mData(start), mLength(length), mOwner(false) +LLKeywords::WStringMapIndex::WStringMapIndex(const llwchar *start, size_t length) +:	mData(start) +,	mLength(length) +,	mOwner(false)  {  }  LLKeywords::WStringMapIndex::~WStringMapIndex()  { -	if(mOwner) +	if (mOwner) +	{  		delete[] mData; +	}  }  void LLKeywords::WStringMapIndex::copyData(const llwchar *start, size_t length) diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h index 4e20b4459e..18e2ed06c5 100755 --- a/indra/llui/llkeywords.h +++ b/indra/llui/llkeywords.h @@ -113,7 +113,10 @@ public:  	LLColor4	getColorGroup(const std::string& key_in);  	bool		isLoaded() const	{ return mLoaded; } -	void		findSegments(std::vector<LLTextSegmentPtr> *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor ); +	void		findSegments(std::vector<LLTextSegmentPtr> *seg_list, +							 const LLWString& text, +							 const LLColor4 &defaultColor, +							 class LLTextEditor& editor);  	void		initialize(LLSD SyntaxXML);  	void		processTokens(); @@ -167,8 +170,19 @@ public:  protected:  	void		processTokensGroup(const LLSD& Tokens, const std::string& Group); -	void		insertSegment(std::vector<LLTextSegmentPtr>& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, class LLTextEditor& editor); -	void		insertSegments(const LLWString& wtext, std::vector<LLTextSegmentPtr>& seg_list, LLKeywordToken* token, S32 text_len, S32 seg_start, S32 seg_end, const LLColor4 &defaultColor, LLTextEditor& editor); +	void		insertSegment(std::vector<LLTextSegmentPtr>& seg_list, +							  LLTextSegmentPtr new_segment, +							  S32 text_len, +							  const LLColor4 &defaultColor, +							  class LLTextEditor& editor); +	void		insertSegments(const LLWString& wtext, +							   std::vector<LLTextSegmentPtr>& seg_list, +							   LLKeywordToken* token, +							   S32 text_len, +							   S32 seg_start, +							   S32 seg_end, +							   const LLColor4 &defaultColor, +							   LLTextEditor& editor);  	bool		mLoaded;  	LLSD		mSyntax; @@ -182,9 +196,7 @@ protected:  	element_attributes_t mAttributes;  	std::string	getAttribute(const std::string& key); -	std::string	getArguments(LLSD& args); - -private: +	std::string	getArguments(LLSD& arguments);  };  #endif  // LL_LLKEYWORDS_H diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 7551c1a442..0ef5993ac1 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -37,9 +37,9 @@  //-----------------------------------------------------------------------------  // fetchKeywordsFileResponder  //----------------------------------------------------------------------------- -fetchKeywordsFileResponder::fetchKeywordsFileResponder(std::string filespec) +fetchKeywordsFileResponder::fetchKeywordsFileResponder(const std::string& filespec) +:	mFileSpec(filespec)  { -	mFileSpec = filespec;  	LL_DEBUGS("SyntaxLSL") << "Instantiating with file saving to: '" << filespec << "'" << LL_ENDL;  } @@ -128,18 +128,11 @@ LLSyntaxIdLSL::LLSyntaxIdLSL() :  {  } -std::string LLSyntaxIdLSL::buildFileNameNew() -{ -	mFileNameNew = mSyntaxIdNew.isNull() ? mFileNameDefault : "keywords_lsl_" + mSyntaxIdNew.asString() + ".llsd.xml"; -	return mFileNameNew; -} - -std::string LLSyntaxIdLSL::buildFullFileSpec() +void LLSyntaxIdLSL::buildFullFileSpec()  {  	ELLPath path = mSyntaxIdNew.isNull() ? LL_PATH_APP_SETTINGS : LL_PATH_CACHE; -	buildFileNameNew(); +	mFileNameNew = mSyntaxIdNew.isNull() ? mFileNameDefault : "keywords_lsl_" + mSyntaxIdNew.asString() + ".llsd.xml";  	mFullFileSpec = gDirUtilp->getExpandedFilename(path, mFileNameNew); -	return mFullFileSpec;  }  //----------------------------------------------------------------------------- diff --git a/indra/newview/llsyntaxid.h b/indra/newview/llsyntaxid.h index f14693d619..2288fb4ab8 100644 --- a/indra/newview/llsyntaxid.h +++ b/indra/newview/llsyntaxid.h @@ -62,8 +62,7 @@ public:  	boost::signals2::connection		addFileFetchedCallback(const file_fetched_signal_t::slot_type& cb);  protected: -	std::string		buildFileNameNew(); -	std::string		buildFullFileSpec(); +	void			buildFullFileSpec();  	void			fetchKeywordsFile();  	void			loadDefaultKeywordsIntoLLSD();  	void			loadKeywordsIntoLLSD(); @@ -105,7 +104,7 @@ public:  	 * @brief fetchKeywordsFileResponder  	 * @param filespec	File path and name of where to save the returned data  	 */ -	fetchKeywordsFileResponder(std::string filespec); +	fetchKeywordsFileResponder(const std::string& filespec);  	void errorWithContent(U32 status,  						const std::string& reason,  | 
