]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - include/iscriplib.h
my own uncrustify run
[xonotic/netradiant.git] / include / iscriplib.h
1 /*
2    Copyright (C) 2001-2006, William Joseph.
3    All Rights Reserved.
4
5    This file is part of GtkRadiant.
6
7    GtkRadiant is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    GtkRadiant is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with GtkRadiant; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21
22 #if !defined( INCLUDED_ISCRIPLIB_H )
23 #define INCLUDED_ISCRIPLIB_H
24
25 /// \file iscriplib.h
26 /// \brief Token input/output stream module.
27
28 #include <cstddef>
29 #include "generic/constant.h"
30
31 #define MAXTOKEN    1024
32
33 class Tokeniser
34 {
35 public:
36 virtual void release() = 0;
37 virtual void nextLine() = 0;
38 virtual const char* getToken() = 0;
39 virtual void ungetToken() = 0;
40 virtual std::size_t getLine() const = 0;
41 virtual std::size_t getColumn() const = 0;
42 };
43
44 class TextInputStream;
45
46 class TokenWriter
47 {
48 public:
49 virtual void release() = 0;
50 virtual void nextLine() = 0;
51 virtual void writeToken( const char* token ) = 0;
52 virtual void writeString( const char* string ) = 0;
53 virtual void writeInteger( int i ) = 0;
54 virtual void writeUnsigned( std::size_t i ) = 0;
55 virtual void writeFloat( double f ) = 0;
56 };
57
58 class TextOutputStream;
59
60 struct _QERScripLibTable
61 {
62         INTEGER_CONSTANT( Version, 1 );
63         STRING_CONSTANT( Name, "scriptlib" );
64
65         Tokeniser& ( *m_pfnNewScriptTokeniser )( TextInputStream & istream );
66         Tokeniser& ( *m_pfnNewSimpleTokeniser )( TextInputStream & istream );
67         TokenWriter& ( *m_pfnNewSimpleTokenWriter )( TextOutputStream & ostream );
68 };
69
70 #include "modulesystem.h"
71
72 template<typename Type>
73 class GlobalModule;
74 typedef GlobalModule<_QERScripLibTable> GlobalScripLibModule;
75
76 template<typename Type>
77 class GlobalModuleRef;
78 typedef GlobalModuleRef<_QERScripLibTable> GlobalScripLibModuleRef;
79
80 inline _QERScripLibTable& GlobalScriptLibrary(){
81         return GlobalScripLibModule::getTable();
82 }
83
84 #endif