Refactoring load routines to remove uneeded methods

master
Ima Mechanique 2013-11-10 21:58:17 +00:00
parent 488964157c
commit dc317ed70a
3 changed files with 11 additions and 54 deletions

View File

@ -205,42 +205,6 @@ bool LLKeywords::initialise(LLSD SyntaxXML)
return mReady;
}
BOOL LLKeywords::loadFromFile()
{
processTokens();
return true;
}
/**
* @brief Load xml serialised LLSD
* @desc Opens the specified filespec and attempts to deserialise the
* contained data to the specified LLSD object.
* @return Returns boolean true/false indicating success or failure.
*/
BOOL LLKeywords::loadIntoLLSD(const std::string& filename, LLSD& data)
{
mLoaded = false;
llifstream file;
file.open(filename);
if(file.is_open())
{
mLoaded = (BOOL)LLSDSerialize::fromXML(data, file);
if (!mLoaded)
{
LL_WARNS("") << "Unable to deserialise file: " << filename << LL_ENDL;
}
else
{
LL_INFOS("") << "Deserialised file: " << filename << LL_ENDL;
}
}
else
{
LL_WARNS("") << "Unable to open file: " << filename << LL_ENDL;
}
return mLoaded;
}
///**
// * @brief Start processing the colour LLSD from its beginning.
// *

View File

@ -2502,23 +2502,19 @@ BOOL LLTextEditor::tryToRevertToPristineState()
static LLFastTimer::DeclareTimer FTM_SYNTAX_HIGHLIGHTING("Syntax Highlighting");
void LLTextEditor::loadKeywords(const std::string& filename,
const std::vector<std::string>& funcs,
const std::vector<std::string>& tooltips,
const LLColor4& color)
void LLTextEditor::loadKeywords()
{
LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING);
if(mKeywords.loadFromFile())
{
segment_vec_t segment_list;
mKeywords.findSegments(&segment_list, getWText(), mDefaultColor.get(), *this);
mKeywords.processTokens();
mSegments.clear();
segment_set_t::iterator insert_it = mSegments.begin();
for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it)
{
insert_it = mSegments.insert(insert_it, *list_it);
}
segment_vec_t segment_list;
mKeywords.findSegments(&segment_list, getWText(), mDefaultColor.get(), *this);
mSegments.clear();
segment_set_t::iterator insert_it = mSegments.begin();
for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it)
{
insert_it = mSegments.insert(insert_it, *list_it);
}
}

View File

@ -187,10 +187,7 @@ public:
void getCurrentLineAndColumn( S32* line, S32* col, BOOL include_wordwrap );
LLKeywords mKeywords;
void loadKeywords(const std::string& filename,
const std::vector<std::string>& funcs,
const std::vector<std::string>& tooltips,
const LLColor4& func_color);
void loadKeywords();
LLKeywords::keyword_iterator_t keywordsBegin() { return mKeywords.begin(); }
LLKeywords::keyword_iterator_t keywordsEnd() { return mKeywords.end(); }