Nebula
Loading...
Searching...
No Matches
scriptserver.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
16#include "core/refcounted.h"
17#include "core/singleton.h"
18#include "io/uri.h"
19#include "util/variant.h"
20#include "util/delegate.h"
21
22//------------------------------------------------------------------------------
23namespace Scripting
24{
25
27
29{
32public:
36 virtual ~ScriptServer();
38 virtual bool Open();
40 virtual void Close();
42 bool IsOpen() const;
44 void SetDebug(const bool b);
46 virtual void AddModulePath(const IO::URI & folder) { n_assert(false); }
48 virtual bool Eval(const Util::String& str) { return false; }
50 virtual bool EvalFile(const IO::URI& file) { return false; }
51
52 static void RegisterModuleInit(const ScriptModuleInit& init);
53protected:
55 bool isOpen;
56 bool debug;
57};
58
59//------------------------------------------------------------------------------
62inline
63bool
65{
66 return this->isOpen;
67}
68
69//------------------------------------------------------------------------------
72inline void
74{
75 this->debug = b;
76}
77
78//------------------------------------------------------------------------------
81inline
82void
84{
85 initFuncs.Append(init);
86}
87
88} // namespace Scripting
89//------------------------------------------------------------------------------
The common base class of Nebula.
Definition refcounted.h:38
An URI object can split a Uniform Resource Identifier string into its components or build a string fr...
Definition uri.h:67
Server class of the scripting subsystem.
Definition scriptserver.h:29
static Util::Array< ScriptModuleInit > initFuncs
Definition scriptserver.h:54
virtual bool Eval(const Util::String &str)
evaluate a script statement in a string
Definition scriptserver.h:48
bool isOpen
Definition scriptserver.h:55
bool IsOpen() const
return true if open
Definition scriptserver.h:64
virtual ~ScriptServer()
destructor
Definition scriptserver.cc:32
__DeclareSingleton(ScriptServer)
ScriptServer()
constructor
Definition scriptserver.cc:22
bool debug
Definition scriptserver.h:56
virtual bool Open()
open the script server
Definition scriptserver.cc:42
static void RegisterModuleInit(const ScriptModuleInit &init)
Definition scriptserver.h:83
__DeclareClass(ScriptServer)
virtual void Close()
close the script server
Definition scriptserver.cc:53
virtual bool EvalFile(const IO::URI &file)
evaluate script in file
Definition scriptserver.h:50
void SetDebug(const bool b)
set debugging with the HTTP interface
Definition scriptserver.h:73
virtual void AddModulePath(const IO::URI &folder)
add module search path
Definition scriptserver.h:46
Nebula's dynamic array class.
Definition array.h:60
Nebula delegate class, allows to store a function, method or lambda call into a C++ object for later ...
Definition delegate.h:39
#define n_assert(exp)
Definition debug.h:50
Prototype for deargui scripting init.
Definition deargui.cpp:2701
Nebula's universal string class.
Definition string.h:50