1 /******************************************************************************
3 * Copyright (C) 2012-2016 Icinga Development Team (https://www.icinga.org/) *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License *
7 * as published by the Free Software Foundation; either version 2 *
8 * of the License, or (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software Foundation *
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ******************************************************************************/
23 #include "base/i2-base.hpp"
24 #include "base/string.hpp"
25 #include "base/array.hpp"
26 #include "base/dictionary.hpp"
27 #include "base/type.hpp"
28 #include "base/configobject.hpp"
36 class I2_BASE_API ScriptUtils
39 static String CastString(const Value& value);
40 static double CastNumber(const Value& value);
41 static bool CastBool(const Value& value);
42 static bool Regex(const String& pattern, const String& text);
43 static double Len(const Value& value);
44 static Array::Ptr Union(const std::vector<Value>& arguments);
45 static Array::Ptr Intersection(const std::vector<Value>& arguments);
46 static void Log(const std::vector<Value>& arguments);
47 static Array::Ptr Range(const std::vector<Value>& arguments);
48 static Type::Ptr TypeOf(const Value& value);
49 static Array::Ptr Keys(const Dictionary::Ptr& dict);
50 static ConfigObject::Ptr GetObject(const Value& type, const String& name);
51 static Array::Ptr GetObjects(const Type::Ptr& type);
52 static void Assert(const Value& arg);
53 static String MsiGetComponentPathShim(const String& component);
54 static Array::Ptr TrackParents(const Object::Ptr& parent);
62 #endif /* SCRIPTUTILS_H */