]> granicus.if.org Git - icinga2/blob - lib/base/scriptutils.hpp
Update copyright headers for 2016
[icinga2] / lib / base / scriptutils.hpp
1 /******************************************************************************
2  * Icinga 2                                                                   *
3  * Copyright (C) 2012-2016 Icinga Development Team (https://www.icinga.org/)  *
4  *                                                                            *
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.                     *
9  *                                                                            *
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.                               *
14  *                                                                            *
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  ******************************************************************************/
19
20 #ifndef SCRIPTUTILS_H
21 #define SCRIPTUTILS_H
22
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"
29
30 namespace icinga
31 {
32
33 /**
34  * @ingroup base
35  */
36 class I2_BASE_API ScriptUtils
37 {
38 public:
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);
55
56 private:
57         ScriptUtils(void);
58 };
59
60 }
61
62 #endif /* SCRIPTUTILS_H */