LLTextParser now a singleton.

This commit is contained in:
Shyotl
2011-07-31 19:09:47 -05:00
parent 3c244e6df0
commit 5e9cec2cc5
3 changed files with 33 additions and 45 deletions

View File

@@ -35,34 +35,34 @@
#define LL_LLTEXTPARSER_H
#include "llsd.h"
#include "llsingleton.h"
class LLUUID;
class LLVector3d;
class LLColor4;
class LLTextParser
class LLTextParser : public LLSingleton<LLTextParser>
{
public:
enum ConditionType { CONTAINS, MATCHES, STARTS_WITH, ENDS_WITH };
enum HighlightType { PART, ALL };
enum HighlightPosition { WHOLE, START, MIDDLE, END };
enum DialogAction { ACTION_NONE, ACTION_CLOSE, ACTION_ADD, ACTION_COPY, ACTION_UPDATE };
typedef enum e_condition_type { CONTAINS, MATCHES, STARTS_WITH, ENDS_WITH } EConditionType;
typedef enum e_highlight_type { PART, ALL } EHighlightType;
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,S32 part=WHOLE, S32 index=0);
LLSD parsePartialLineHighlights(const std::string &text,const LLColor4 &color, EHighlightPosition part=WHOLE, S32 index=0);
bool parseFullLineHighlights(const std::string &text, LLColor4 *color);
std::string getFileName();
LLSD loadFromDisk();
bool saveToDisk(LLSD highlights);
public:
LLSD mHighlights;
S32 findPattern(const std::string &text, LLSD highlight);
private:
static LLTextParser* sInstance;
std::string getFileName();
void loadKeywords();
bool saveToDisk(LLSD highlights);
public:
LLSD mHighlights;
bool mLoaded;
};
#endif