2 Copyright (C) 2001-2006, William Joseph.
5 This file is part of GtkRadiant.
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.
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.
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
22 #if !defined( INCLUDED_ISCRIPLIB_H )
23 #define INCLUDED_ISCRIPLIB_H
26 /// \brief Token input/output stream module.
29 #include "generic/constant.h"
36 virtual ~Tokeniser() = default;
37 virtual void release() = 0;
38 virtual void nextLine() = 0;
39 virtual const char* getToken() = 0;
40 virtual void ungetToken() = 0;
41 virtual std::size_t getLine() const = 0;
42 virtual std::size_t getColumn() const = 0;
45 class TextInputStream;
50 virtual ~TokenWriter() = default;
51 virtual void release() = 0;
52 virtual void nextLine() = 0;
53 virtual void writeToken( const char* token ) = 0;
54 virtual void writeString( const char* string ) = 0;
55 virtual void writeInteger( int i ) = 0;
56 virtual void writeUnsigned( std::size_t i ) = 0;
57 virtual void writeFloat( double f ) = 0;
60 class TextOutputStream;
62 struct _QERScripLibTable
64 INTEGER_CONSTANT( Version, 1 );
65 STRING_CONSTANT( Name, "scriptlib" );
67 Tokeniser& ( *m_pfnNewScriptTokeniser )( TextInputStream & istream );
68 Tokeniser& ( *m_pfnNewSimpleTokeniser )( TextInputStream & istream );
69 TokenWriter& ( *m_pfnNewSimpleTokenWriter )( TextOutputStream & ostream );
72 #include "modulesystem.h"
74 template<typename Type>
76 typedef GlobalModule<_QERScripLibTable> GlobalScripLibModule;
78 template<typename Type>
79 class GlobalModuleRef;
80 typedef GlobalModuleRef<_QERScripLibTable> GlobalScripLibModuleRef;
82 inline _QERScripLibTable& GlobalScriptLibrary(){
83 return GlobalScripLibModule::getTable();