]> git.xonotic.org Git - xonotic/netradiant.git/blob - contrib/bobtoolz/ScriptParser.h
reformat code! now the code is only ugly on the *inside*
[xonotic/netradiant.git] / contrib / bobtoolz / ScriptParser.h
1 /*
2    BobToolz plugin for GtkRadiant
3    Copyright (C) 2001 Gordon Biggans
4
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9
10    This library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with this library; if not, write to the Free Software
17    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19
20
21 #ifndef _SCRIPTPARSER_H_
22 #define _SCRIPTPARSER_H_
23
24 //#include "interfaces/IScriptParser.h"
25
26 const int SP_MAX_BREAKCHARS = 16;
27
28 class CScriptParser //: public IScriptParser
29 {
30 public:
31     CScriptParser(void);
32
33     ~CScriptParser(void);
34
35 private:
36     char m_breakChars[SP_MAX_BREAKCHARS];
37     char *m_pScript;
38     char *m_pScriptSection;
39     char *m_pLastScriptSection;
40     char *m_pToken;
41
42     void SkipWhitespace(bool *pbNewLines);
43
44     void ClearBuffer(void);
45
46     const char *MakeToken(const char *pToken);
47
48     bool IsBreakChar(char c);
49
50 public:
51     const char *GetToken(bool bAllowLinebreaks);
52
53     void SkipBracedSection(void);
54
55     void SkipRestOfLine(void);
56
57     void UndoGetToken(void);
58
59     void ResetParseSession(void);
60
61     char *GetBufferCopy(void);
62
63     int GetTokenOffset(void);
64
65     void LoadScript(const char *pScript);
66
67     void SetScript(char *pScript);
68
69     void AddBreakChar(char c);
70
71 private:
72 };
73
74 #endif