PageRenderTime 31ms CodeModel.GetById 19ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/xbmc/visualizations/Vortex/angelscript/angelscript/source/as_variablescope.h

http://github.com/xbmc/xbmc
C++ Header | 80 lines | 31 code | 15 blank | 34 comment | 0 complexity | 0a4e56b25d377aee39dc9dbdd6253989 MD5 | raw file
 1/*
 2   AngelCode Scripting Library
 3   Copyright (c) 2003-2007 Andreas Jonsson
 4
 5   This software is provided 'as-is', without any express or implied 
 6   warranty. In no event will the authors be held liable for any 
 7   damages arising from the use of this software.
 8
 9   Permission is granted to anyone to use this software for any 
10   purpose, including commercial applications, and to alter it and 
11   redistribute it freely, subject to the following restrictions:
12
13   1. The origin of this software must not be misrepresented; you 
14      must not claim that you wrote the original software. If you use
15      this software in a product, an acknowledgment in the product 
16      documentation would be appreciated but is not required.
17
18   2. Altered source versions must be plainly marked as such, and 
19      must not be misrepresented as being the original software.
20
21   3. This notice may not be removed or altered from any source 
22      distribution.
23
24   The original version of this library can be located at:
25   http://www.angelcode.com/angelscript/
26
27   Andreas Jonsson
28   andreas@angelcode.com
29*/
30
31
32//
33// as_variablescope.h
34//
35// A manager class for variable declarations
36//
37
38
39#ifndef AS_VARIABLESCOPE_H
40#define AS_VARIABLESCOPE_H
41
42#include "as_array.h"
43#include "as_string.h"
44#include "as_datatype.h"
45
46BEGIN_AS_NAMESPACE
47
48struct sVariable
49{
50	asCString name;
51	asCDataType type;
52	int stackOffset;
53	bool isInitialized;
54	bool isPureConstant;
55	asQWORD constantValue;
56};
57
58class asCVariableScope
59{
60public:
61	asCVariableScope(asCVariableScope *parent);
62	~asCVariableScope();
63
64	void Reset();
65
66	int DeclareVariable(const char *name, const asCDataType &type, int stackOffset);
67	sVariable *GetVariable(const char *name);
68	sVariable *GetVariableByOffset(int offset);
69
70	asCVariableScope *parent;
71
72	bool isBreakScope;
73	bool isContinueScope;
74
75	asCArray<sVariable *> variables;
76};
77
78END_AS_NAMESPACE
79
80#endif