37 lines
992 B
C++
37 lines
992 B
C++
|
#ifndef PORYGONLANG_SCRIPTOPTIONS_HPP
|
||
|
#define PORYGONLANG_SCRIPTOPTIONS_HPP
|
||
|
|
||
|
#include <string>
|
||
|
|
||
|
namespace Porygon{
|
||
|
class ScriptOptions{
|
||
|
static Porygon::ScriptOptions DefaultScriptOptions;
|
||
|
static void (*_print)(const char16_t* s);
|
||
|
static std::streambuf* _printBuffer;
|
||
|
static std::ostream* _printStream;
|
||
|
public:
|
||
|
static Porygon::ScriptOptions* GetDefaultScriptOptions(){
|
||
|
return &DefaultScriptOptions;
|
||
|
}
|
||
|
|
||
|
inline void Print(const char16_t* s) const{
|
||
|
ScriptOptions::_print(s);
|
||
|
}
|
||
|
|
||
|
void SetPrintFunc(void (*print)(const char16_t *)){
|
||
|
ScriptOptions::_print = print;
|
||
|
}
|
||
|
|
||
|
std::ostream& GetPrintStream(){
|
||
|
return *ScriptOptions::_printStream;
|
||
|
}
|
||
|
|
||
|
void SetPrintStream(std::ostream* stream){
|
||
|
delete ScriptOptions::_printStream;
|
||
|
ScriptOptions::_printStream = stream;
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
#endif //PORYGONLANG_SCRIPTOPTIONS_HPP
|