summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/lltextbase.cpp8
-rw-r--r--indra/llui/lltextparser.cpp40
-rw-r--r--indra/llui/lltextparser.h15
-rw-r--r--indra/newview/llappviewer.cpp2
-rw-r--r--indra/newview/llfloaterpreference.cpp2
-rw-r--r--indra/newview/llsecapi.cpp8
6 files changed, 30 insertions, 45 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 616033f77f..71c7811757 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1704,13 +1704,11 @@ void LLTextBase::appendAndHighlightText(const std::string &new_text, bool prepen
setCursorPos(old_length);
- LLTextParser* highlight = LLTextParser::getInstance();
-
- if (mParseHighlights && highlight)
+ if (mParseHighlights)
{
LLStyle::Params highlight_params(style_params);
-
- LLSD pieces = highlight->parsePartialLineHighlights(new_text, highlight_params.color(), (LLTextParser::EHighlightPosition)highlight_part);
+.
+ LLSD pieces = LLTextParser::instance().parsePartialLineHighlights(new_text, highlight_params.color(), (LLTextParser::EHighlightPosition)highlight_part);
for (S32 i = 0; i < pieces.size(); i++)
{
LLSD color_llsd = pieces[i]["color"];
diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp
index 76a39e3094..2493afcb5d 100644
--- a/indra/llui/lltextparser.cpp
+++ b/indra/llui/lltextparser.cpp
@@ -43,29 +43,14 @@
#include "v4color.h"
#include "lldir.h"
-// Routines used for parsing text for TextParsers and html
-
-LLTextParser* LLTextParser::sInstance = NULL;
-
//
// Member Functions
//
-LLTextParser::~LLTextParser()
-{
- sInstance=NULL;
-}
+LLTextParser::LLTextParser()
+: mLoaded(false)
+{}
-// static
-LLTextParser* LLTextParser::getInstance()
-{
- if (!sInstance)
- {
- sInstance = new LLTextParser();
- sInstance->loadFromDisk();
- }
- return sInstance;
-}
// Moved triggerAlerts() to llfloaterchat.cpp to break llui/llaudio library dependency.
@@ -105,6 +90,8 @@ S32 LLTextParser::findPattern(const std::string &text, LLSD highlight)
LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLColor4 &color, EHighlightPosition part, S32 index)
{
+ loadKeywords();
+
//evil recursive string atomizer.
LLSD ret_llsd, start_llsd, middle_llsd, end_llsd;
@@ -195,6 +182,8 @@ LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLC
bool LLTextParser::parseFullLineHighlights(const std::string &text, LLColor4 *color)
{
+ loadKeywords();
+
for (S32 i=0;i<mHighlights.size();i++)
{
if ((S32)mHighlights[i]["highlight"]==ALL || (S32)mHighlights[i]["condition"]==MATCHES)
@@ -221,14 +210,14 @@ std::string LLTextParser::getFileName()
return path;
}
-LLSD LLTextParser::loadFromDisk()
+void LLTextParser::loadKeywords()
{
- std::string filename=getFileName();
- if (filename.empty())
- {
- llwarns << "LLTextParser::loadFromDisk() no valid user directory." << llendl;
+ if (mLoaded)
+ {// keywords already loaded
+ return;
}
- else
+ std::string filename=getFileName();
+ if (!filename.empty())
{
llifstream file;
file.open(filename.c_str());
@@ -237,9 +226,8 @@ LLSD LLTextParser::loadFromDisk()
LLSDSerialize::fromXML(mHighlights, file);
}
file.close();
+ mLoaded = true;
}
-
- return mHighlights;
}
bool LLTextParser::saveToDisk(LLSD highlights)
diff --git a/indra/llui/lltextparser.h b/indra/llui/lltextparser.h
index 072ac0f300..3005822f43 100644
--- a/indra/llui/lltextparser.h
+++ b/indra/llui/lltextparser.h
@@ -35,12 +35,13 @@
#define LL_LLTEXTPARSER_H
#include "llsd.h"
+#include "llsingleton.h"
class LLUUID;
class LLVector3d;
class LLColor4;
-class LLTextParser
+class LLTextParser : public LLSingleton<LLTextParser>
{
public:
typedef enum e_condition_type { CONTAINS, MATCHES, STARTS_WITH, ENDS_WITH } EConditionType;
@@ -48,22 +49,20 @@ public:
typedef enum e_highlight_position { WHOLE, START, MIDDLE, END } EHighlightPosition;
typedef enum e_dialog_action { ACTION_NONE, ACTION_CLOSE, ACTION_ADD, ACTION_COPY, ACTION_UPDATE } EDialogAction;
- static LLTextParser* getInstance();
- LLTextParser(){};
- ~LLTextParser();
+ LLTextParser();
- S32 findPattern(const std::string &text, LLSD highlight);
LLSD parsePartialLineHighlights(const std::string &text,const LLColor4 &color, EHighlightPosition part=WHOLE, S32 index=0);
bool parseFullLineHighlights(const std::string &text, LLColor4 *color);
+private:
+ S32 findPattern(const std::string &text, LLSD highlight);
std::string getFileName();
- LLSD loadFromDisk();
+ void loadKeywords();
bool saveToDisk(LLSD highlights);
public:
LLSD mHighlights;
-private:
- static LLTextParser* sInstance;
+ bool mLoaded;
};
#endif
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index deafb20af7..f0b3740086 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1817,7 +1817,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key,
}
else
{
- llwarns << "Cannot load " << full_settings_path << " - No settings found." << llendl;
+ llinfos << "Cannot load " << full_settings_path << " - No settings found." << llendl;
}
}
else
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 0eeef0039c..593d5c267e 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -966,7 +966,7 @@ void LLFloaterPreference::cleanupBadSetting()
{
if (gSavedPerAccountSettings.getString("BusyModeResponse2") == "|TOKEN COPY BusyModeResponse|")
{
- llwarns << "cleaning old BusyModeResponse" << llendl;
+ llinfos << "cleaning old BusyModeResponse" << llendl;
//LLTrans::getString("BusyModeResponseDefault") is used here for localization (EXT-5885)
gSavedPerAccountSettings.setString("BusyModeResponse2", LLTrans::getString("BusyModeResponseDefault"));
}
diff --git a/indra/newview/llsecapi.cpp b/indra/newview/llsecapi.cpp
index 9e636f38c0..6389fd292c 100644
--- a/indra/newview/llsecapi.cpp
+++ b/indra/newview/llsecapi.cpp
@@ -59,7 +59,7 @@ void initializeSecHandler()
gSecAPIHandler = gHandlerMap[BASIC_SECHANDLER];
// initialize all SecAPIHandlers
- LLProtectedDataException ex = LLProtectedDataException("");
+ std::string exception_msg;
std::map<std::string, LLPointer<LLSecAPIHandler> >::const_iterator itr;
for(itr = gHandlerMap.begin(); itr != gHandlerMap.end(); ++itr)
{
@@ -70,12 +70,12 @@ void initializeSecHandler()
}
catch (LLProtectedDataException e)
{
- ex = e;
+ exception_msg = e.getMessage();
}
}
- if (ex.getMessage().length() > 0 ) // an exception was thrown.
+ if (!exception_msg.empty()) // an exception was thrown.
{
- throw ex;
+ throw LLProtectedDataException(exception_msg.c_str());
}
}