2019-02-25 14:48:22 +01:00
|
|
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
2014-12-12 15:19:23 +01:00
|
|
|
|
|
|
|
#include "base/boolean.hpp"
|
|
|
|
#include "base/convert.hpp"
|
2015-01-21 08:47:45 +01:00
|
|
|
#include "base/function.hpp"
|
|
|
|
#include "base/functionwrapper.hpp"
|
2014-12-12 15:33:02 +01:00
|
|
|
#include "base/scriptframe.hpp"
|
2014-12-12 15:19:23 +01:00
|
|
|
|
|
|
|
using namespace icinga;
|
|
|
|
|
2018-01-04 04:25:35 +01:00
|
|
|
static String BooleanToString()
|
2014-12-12 15:19:23 +01:00
|
|
|
{
|
2014-12-12 15:33:02 +01:00
|
|
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
2014-12-12 15:19:23 +01:00
|
|
|
bool self = vframe->Self;
|
|
|
|
return self ? "true" : "false";
|
|
|
|
}
|
|
|
|
|
2018-01-04 04:25:35 +01:00
|
|
|
Object::Ptr Boolean::GetPrototype()
|
2014-12-12 15:19:23 +01:00
|
|
|
{
|
2018-01-11 11:17:38 +01:00
|
|
|
static Dictionary::Ptr prototype = new Dictionary({
|
|
|
|
{ "to_string", new Function("Boolean#to_string", BooleanToString, {}, true) }
|
|
|
|
});
|
2014-12-12 15:19:23 +01:00
|
|
|
|
|
|
|
return prototype;
|
|
|
|
}
|
|
|
|
|