Code policy

master
Cinder 2014-05-07 19:58:56 -06:00
parent e8422e5bed
commit 8501d6494b
8 changed files with 27 additions and 49 deletions

View File

@ -251,7 +251,7 @@ LLColor4 LLKeywords::getColorGroup(const std::string& key_in)
return LLUIColorTable::instance().getColor(color_group);
}
void LLKeywords::initialise(LLSD SyntaxXML)
void LLKeywords::initialize(LLSD SyntaxXML)
{
mSyntax = SyntaxXML;
mLoaded = true;

View File

@ -115,7 +115,7 @@ public:
bool isLoaded() const { return mLoaded; }
void findSegments(std::vector<LLTextSegmentPtr> *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor );
void initialise(LLSD SyntaxXML);
void initialize(LLSD SyntaxXML);
void processTokens();
// Add the token as described

View File

@ -21,7 +21,7 @@
<key>for</key>
<map>
<key>tooltip</key>
<string>for loop\nfor (&lt;initialiser&gt;; &lt;condition&gt;; &lt;post-iteration-statement&gt;)\n{ ...\n}</string>
<string>for loop\nfor (&lt;initializer&gt;; &lt;condition&gt;; &lt;post-iteration-statement&gt;)\n{ ...\n}</string>
</map>
<key>if</key>
<map>

View File

@ -412,7 +412,7 @@ BOOL LLScriptEdCore::postBuild()
LLSyntaxIdLSL::getInstance()->addFileFetchedCallback(boost::bind(&LLScriptEdCore::processKeywords, this));
// Intialise keyword highlighting for the current simulator's version of LSL
LLSyntaxIdLSL::getInstance()->initialise();
LLSyntaxIdLSL::getInstance()->initialize();
if (LLSyntaxIdLSL::getInstance()->isDifferentVersion())
{
@ -440,7 +440,7 @@ void LLScriptEdCore::updateKeywords()
void LLScriptEdCore::processLoaded()
{
LLSyntaxIdLSL::getInstance()->initialise();
LLSyntaxIdLSL::getInstance()->initialize();
if (LLSyntaxIdLSL::getInstance()->isLoaded())
{
processKeywords();

View File

@ -77,7 +77,7 @@ protected:
public:
~LLScriptEdCore();
void initialiseKeywords();
void initializeKeywords();
void initMenu();
void processKeywords();
void processLoaded();

View File

@ -46,7 +46,7 @@ LLScriptEditor::LLScriptEditor(const Params& p)
void LLScriptEditor::initKeywords()
{
mKeywords.initialise(LLSyntaxIdLSL::getInstance()->getKeywordsXML());
mKeywords.initialize(LLSyntaxIdLSL::getInstance()->getKeywordsXML());
}
static LLFastTimer::DeclareTimer FTM_SYNTAX_HIGHLIGHTING("Syntax Highlighting");

View File

@ -70,7 +70,7 @@ void fetchKeywordsFileResponder::result(const LLSD& content_ref)
<< "Supported verson of syntax file." << LL_ENDL;
LLSyntaxIdLSL::setKeywordsXml(content_ref);
LLSyntaxIdLSL::sInitialised = true;
LLSyntaxIdLSL::sInitialized = true;
LLSyntaxIdLSL::sLoaded = true;
LLSyntaxIdLSL::sLoadFailed = false;
@ -117,12 +117,12 @@ const std::string LLSyntaxIdLSL::CAPABILITY_NAME = "LSLSyntax";
const std::string LLSyntaxIdLSL::FILENAME_DEFAULT = "keywords_lsl_default.xml";
const std::string LLSyntaxIdLSL::SIMULATOR_FEATURE = "LSLSyntaxId";
bool LLSyntaxIdLSL::sInitialised;
bool LLSyntaxIdLSL::sInitialized;
LLSD LLSyntaxIdLSL::sKeywordsXml;
bool LLSyntaxIdLSL::sLoaded;
bool LLSyntaxIdLSL::sLoadFailed;
bool LLSyntaxIdLSL::sVersionChanged;
LLSyntaxIdLSL::file_fetched_signal_t LLSyntaxIdLSL::sFileFetchedSignal;
LLSyntaxIdLSL::file_fetched_signal_t LLSyntaxIdLSL::sFileFetchedSignal;
/**
* @brief LLSyntaxIdLSL constructor
@ -207,7 +207,7 @@ bool LLSyntaxIdLSL::checkSyntaxIdChanged()
}
else
{
if ( mSyntaxIdCurrent.isNull() && isInitialised())
if ( mSyntaxIdCurrent.isNull() && isInitialized())
{
LL_INFOS("SyntaxLSL")
<< "It does not have LSLSyntaxId capability, remaining with default keywords file!"
@ -255,9 +255,9 @@ void LLSyntaxIdLSL::fetchKeywordsFile()
//-----------------------------------------------------------------------------
// initialise
// initialize
//-----------------------------------------------------------------------------
void LLSyntaxIdLSL::initialise()
void LLSyntaxIdLSL::initialize()
{
mFileNameNew = mFileNameCurrent;
mSyntaxIdNew = mSyntaxIdCurrent;
@ -309,7 +309,7 @@ void LLSyntaxIdLSL::initialise()
loadDefaultKeywordsIntoLLSD();
}
}
else if (!isInitialised())
else if (!isInitialized())
{
loadDefaultKeywordsIntoLLSD();
}
@ -355,8 +355,7 @@ bool LLSyntaxIdLSL::isSupportedVersion(const LLSD& content)
//-----------------------------------------------------------------------------
void LLSyntaxIdLSL::loadDefaultKeywordsIntoLLSD()
{
LL_INFOS("SyntaxLSL")
<< "LSLSyntaxId is null so we will use the default file!" << LL_ENDL;
LL_INFOS("SyntaxLSL") << "LSLSyntaxId is null so we will use the default file!" << LL_ENDL;
mSyntaxIdNew = LLUUID();
buildFullFileSpec();
loadKeywordsIntoLLSD();
@ -373,9 +372,7 @@ void LLSyntaxIdLSL::loadDefaultKeywordsIntoLLSD()
*/
void LLSyntaxIdLSL::loadKeywordsIntoLLSD()
{
LL_INFOS("SyntaxLSL")
<< "Trying to open cached or default keyword file ;-)"
<< LL_ENDL;
LL_INFOS("SyntaxLSL") << "Trying to open cached or default keyword file" << LL_ENDL;
// Is this the right thing to do, or should we leave the old content
// even if it isn't entirely accurate anymore?
@ -389,9 +386,7 @@ void LLSyntaxIdLSL::loadKeywordsIntoLLSD()
sLoaded = (bool)LLSDSerialize::fromXML(content, file);
if (!sLoaded)
{
LL_WARNS("SyntaxLSL")
<< "Unable to deserialise file: "
<< mFullFileSpec << LL_ENDL;
LL_WARNS("SyntaxLSL") << "Unable to deserialise file: " << mFullFileSpec << LL_ENDL;
}
else
{
@ -399,15 +394,13 @@ void LLSyntaxIdLSL::loadKeywordsIntoLLSD()
{
sKeywordsXml = content;
sLoaded = true;
sInitialised = true;
LL_INFOS("SyntaxLSL")
<< "Deserialised file: " << mFullFileSpec << LL_ENDL;
sInitialized = true;
LL_INFOS("SyntaxLSL") << "Deserialised file: " << mFullFileSpec << LL_ENDL;
}
else
{
sLoaded = false;
LL_WARNS("SyntaxLSL")
<< "Unknown or unsupported version of syntax file." << LL_ENDL;
LL_WARNS("SyntaxLSL") << "Unknown or unsupported version of syntax file." << LL_ENDL;
}
}
}
@ -422,8 +415,3 @@ boost::signals2::connection LLSyntaxIdLSL::addFileFetchedCallback(const file_fet
{
return sFileFetchedSignal.connect(cb);
}
void LLSyntaxIdLSL::removeFileFetchedCallback(boost::signals2::connection callback)
{
sFileFetchedSignal.disconnect(callback);
}

View File

@ -36,23 +36,18 @@
#include "llsingleton.h"
#include "llviewerregion.h"
/**
* @file llsyntaxid.h
* @brief Tracks the file needed to decorate the current sim's version of LSL.
*/
class LLSyntaxIdLSL: public LLSingleton<LLSyntaxIdLSL>
class LLSyntaxIdLSL : public LLSingleton<LLSyntaxIdLSL>
{
friend class fetchKeywordsFileResponder;
public:
typedef boost::signals2::signal<void()> file_fetched_signal_t;
static const std::string CAPABILITY_NAME;
static const std::string FILENAME_DEFAULT;
static const std::string SIMULATOR_FEATURE;
static const std::string CAPABILITY_NAME;
static const std::string FILENAME_DEFAULT;
static const std::string SIMULATOR_FEATURE;
protected:
static bool sInitialised;
static bool sInitialized;
static LLSD sKeywordsXml;
static bool sLoaded;
static bool sLoadFailed;
@ -85,16 +80,15 @@ public:
LLSD getKeywordsXML() const { return sKeywordsXml; }
LLUUID getSyntaxId() const { return mSyntaxIdCurrent; }
bool isDifferentVersion() const { return sVersionChanged; }
bool isInitialised() const { return sInitialised; }
bool isInitialized() const { return sInitialized; }
void initialise();
void initialize();
bool isLoaded() { return sLoaded; }
static bool isSupportedVersion(const LLSD& content);
static void setKeywordsXml(const LLSD& content) { sKeywordsXml = content; }
boost::signals2::connection addFileFetchedCallback(const file_fetched_signal_t::slot_type& cb);
void removeFileFetchedCallback(boost::signals2::connection callback);
protected:
@ -110,10 +104,6 @@ protected:
};
/**
* @file llsyntaxid.h
* @brief Handles responses for the LSLSyntax capability's get call. Is a friend of LLSyntaxIdLSL
*/
class fetchKeywordsFileResponder : public LLHTTPClient::Responder
{
public: