]> granicus.if.org Git - icinga2/blob - lib/base/boolean-script.cpp
Merge pull request #7185 from Icinga/bugfix/gelfwriter-wrong-log-facility
[icinga2] / lib / base / boolean-script.cpp
1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2
3 #include "base/boolean.hpp"
4 #include "base/convert.hpp"
5 #include "base/function.hpp"
6 #include "base/functionwrapper.hpp"
7 #include "base/scriptframe.hpp"
8
9 using namespace icinga;
10
11 static String BooleanToString()
12 {
13         ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
14         bool self = vframe->Self;
15         return self ? "true" : "false";
16 }
17
18 Object::Ptr Boolean::GetPrototype()
19 {
20         static Dictionary::Ptr prototype = new Dictionary({
21                 { "to_string", new Function("Boolean#to_string", BooleanToString, {}, true) }
22         });
23
24         return prototype;
25 }
26