[icinga-checkins] icinga.org: icinga2/feature/ido-groups: Implement the __ptr function

git at icinga.org git at icinga.org
Mon Jul 25 14:49:35 CEST 2016


Module: icinga2
Branch: feature/ido-groups
Commit: caf2812f0d8d5d699ead6b412e0f0c2ab1f2f326
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=caf2812f0d8d5d699ead6b412e0f0c2ab1f2f326

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Fri Jul 22 09:43:59 2016 +0200

Implement the __ptr function

fixes #12205

---

 lib/base/scriptutils.cpp |    5 +++++
 lib/base/scriptutils.hpp |    1 +
 2 files changed, 6 insertions(+)

diff --git a/lib/base/scriptutils.cpp b/lib/base/scriptutils.cpp
index 74c6251..94a0f01 100644
--- a/lib/base/scriptutils.cpp
+++ b/lib/base/scriptutils.cpp
@@ -65,6 +65,7 @@ REGISTER_SAFE_SCRIPTFUNCTION(escape_shell_arg, &Utility::EscapeShellArg);
 #ifdef _WIN32
 REGISTER_SAFE_SCRIPTFUNCTION(escape_create_process_arg, &Utility::EscapeCreateProcessArg);
 #endif /* _WIN32 */
+REGISTER_SCRIPTFUNCTION(__ptr, &ScriptUtils::Ptr);
 
 String ScriptUtils::CastString(const Value& value)
 {
@@ -317,3 +318,7 @@ Array::Ptr ScriptUtils::TrackParents(const Object::Ptr& child)
 	return Array::FromVector(DependencyGraph::GetParents(child));
 }
 
+double ScriptUtils::Ptr(const Object::Ptr& object)
+{
+	return reinterpret_cast<intptr_t>(object.get());
+}
diff --git a/lib/base/scriptutils.hpp b/lib/base/scriptutils.hpp
index 6eaf53a..a79bb4d 100644
--- a/lib/base/scriptutils.hpp
+++ b/lib/base/scriptutils.hpp
@@ -52,6 +52,7 @@ public:
 	static void Assert(const Value& arg);
 	static String MsiGetComponentPathShim(const String& component);
 	static Array::Ptr TrackParents(const Object::Ptr& parent);
+	static double Ptr(const Object::Ptr& object);
 
 private:
 	ScriptUtils(void);



More information about the icinga-checkins mailing list