aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage/llmessagetemplateparser.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:02 -0500
committerJacek Antonelli2008-08-15 23:45:02 -0500
commitd644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd (patch)
tree7ed0c2c27d717801238a2e6b5749cd5bf88c3059 /linden/indra/llmessage/llmessagetemplateparser.h
parentSecond Life viewer sources 1.17.3.0 (diff)
downloadmeta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.zip
meta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.tar.gz
meta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.tar.bz2
meta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.tar.xz
Second Life viewer sources 1.18.0.6
Diffstat (limited to 'linden/indra/llmessage/llmessagetemplateparser.h')
-rw-r--r--linden/indra/llmessage/llmessagetemplateparser.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/linden/indra/llmessage/llmessagetemplateparser.h b/linden/indra/llmessage/llmessagetemplateparser.h
new file mode 100644
index 0000000..f56dfec
--- /dev/null
+++ b/linden/indra/llmessage/llmessagetemplateparser.h
@@ -0,0 +1,82 @@
1/**
2 * @file llmessagetemplateparser.h
3 * @brief Classes to parse message template.
4 *
5 * Copyright (c) 2000-2007, Linden Research, Inc.
6 *
7 * Second Life Viewer Source Code
8 * The source code in this file ("Source Code") is provided by Linden Lab
9 * to you under the terms of the GNU General Public License, version 2.0
10 * ("GPL"), unless you have obtained a separate licensing agreement
11 * ("Other License"), formally executed by you and Linden Lab. Terms of
12 * the GPL can be found in doc/GPL-license.txt in this distribution, or
13 * online at http://secondlife.com/developers/opensource/gplv2
14 *
15 * There are special exceptions to the terms and conditions of the GPL as
16 * it is applied to this Source Code. View the full text of the exception
17 * in the file doc/FLOSS-exception.txt in this software distribution, or
18 * online at http://secondlife.com/developers/opensource/flossexception
19 *
20 * By copying, modifying or distributing this software, you acknowledge
21 * that you have read and understood your obligations described above,
22 * and agree to abide by those obligations.
23 *
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE.
27 */
28
29#ifndef LL_MESSAGETEMPLATEPARSER_H
30#define LL_MESSAGETEMPLATEPARSER_H
31
32#include <string>
33#include "llmessagetemplate.h"
34
35class LLTemplateTokenizer
36{
37public:
38 LLTemplateTokenizer(const std::string & contents);
39
40 U32 line() const;
41 bool atEOF() const;
42 std::string next();
43
44 bool want(const std::string & token);
45 bool wantEOF();
46private:
47 void inc();
48 void dec();
49 std::string get() const;
50 void error(std::string message = "generic") const;
51
52 struct positioned_token
53 {
54 std::string str;
55 U32 line;
56 };
57
58 bool mStarted;
59 std::list<positioned_token> mTokens;
60 std::list<positioned_token>::const_iterator mCurrent;
61};
62
63class LLTemplateParser
64{
65public:
66 typedef std::list<LLMessageTemplate *>::const_iterator message_iterator;
67
68 static LLMessageTemplate * parseMessage(LLTemplateTokenizer & tokens);
69 static LLMessageBlock * parseBlock(LLTemplateTokenizer & tokens);
70 static LLMessageVariable * parseVariable(LLTemplateTokenizer & tokens);
71
72 LLTemplateParser(LLTemplateTokenizer & tokens);
73 message_iterator getMessagesBegin() const;
74 message_iterator getMessagesEnd() const;
75 F32 getVersion() const;
76
77private:
78 F32 mVersion;
79 std::list<LLMessageTemplate *> mMessages;
80};
81
82#endif