PageRenderTime 27ms CodeModel.GetById 18ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 1ms

/indra/llui/lltextparser.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 62 lines | 27 code | 9 blank | 26 comment | 0 complexity | aa8cfec4b9b936a09f3da5048191c2b5 MD5 | raw file
 1/** 
 2 * @file llTextParser.h
 3 * @brief GUI for user-defined highlights
 4 *
 5 * $LicenseInfo:firstyear=2002&license=viewerlgpl$
 6 * Second Life Viewer Source Code
 7 * Copyright (C) 2010, Linden Research, Inc.
 8 * 
 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation;
12 * version 2.1 of the License only.
13 * 
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 * 
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 * 
23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
24 * $/LicenseInfo$
25 *
26 */
27
28#ifndef LL_LLTEXTPARSER_H
29#define LL_LLTEXTPARSER_H
30
31#include "llsd.h"
32#include "llsingleton.h"
33
34class LLUUID;
35class LLVector3d;
36class LLColor4;
37
38class LLTextParser : public LLSingleton<LLTextParser>
39{
40public:
41	typedef enum e_condition_type { CONTAINS, MATCHES, STARTS_WITH, ENDS_WITH } EConditionType;
42	typedef enum e_highlight_type { PART, ALL } EHighlightType;
43	typedef enum e_highlight_position { WHOLE, START, MIDDLE, END } EHighlightPosition;
44	typedef enum e_dialog_action { ACTION_NONE, ACTION_CLOSE, ACTION_ADD, ACTION_COPY, ACTION_UPDATE } EDialogAction;
45
46	LLTextParser();
47
48	LLSD parsePartialLineHighlights(const std::string &text,const LLColor4 &color, EHighlightPosition part=WHOLE, S32 index=0);
49	bool parseFullLineHighlights(const std::string &text, LLColor4 *color);
50
51private:
52	S32  findPattern(const std::string &text, LLSD highlight);
53	std::string getFileName();
54	void loadKeywords();
55	bool saveToDisk(LLSD highlights);
56
57public:
58	LLSD	mHighlights;
59	bool	mLoaded;
60};
61
62#endif