]> granicus.if.org Git - icinga2/blob - lib/config/typerulelist.hpp
Rephrase 2 lines so they conform with the style
[icinga2] / lib / config / typerulelist.hpp
1 /******************************************************************************\r
2  * Icinga 2                                                                   *\r
3  * Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org)    *\r
4  *                                                                            *\r
5  * This program is free software; you can redistribute it and/or              *\r
6  * modify it under the terms of the GNU General Public License                *\r
7  * as published by the Free Software Foundation; either version 2             *\r
8  * of the License, or (at your option) any later version.                     *\r
9  *                                                                            *\r
10  * This program is distributed in the hope that it will be useful,            *\r
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of             *\r
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *\r
13  * GNU General Public License for more details.                               *\r
14  *                                                                            *\r
15  * You should have received a copy of the GNU General Public License          *\r
16  * along with this program; if not, write to the Free Software Foundation     *\r
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *\r
18  ******************************************************************************/\r
19 \r
20 #ifndef TYPERULELIST_H\r
21 #define TYPERULELIST_H\r
22 \r
23 #include "config/i2-config.hpp"\r
24 #include "base/value.hpp"\r
25 #include <vector>\r
26 \r
27 namespace icinga\r
28 {\r
29 \r
30 struct TypeRule;\r
31 class TypeRuleUtilities;\r
32 \r
33 /**\r
34  * @ingroup config\r
35  */\r
36 enum TypeValidationResult\r
37 {\r
38         ValidationOK,\r
39         ValidationInvalidType,\r
40         ValidationUnknownField\r
41 };\r
42 \r
43 /**\r
44  * A list of configuration type rules.\r
45  *\r
46  * @ingroup config\r
47  */\r
48 class I2_CONFIG_API TypeRuleList : public Object\r
49 {\r
50 public:\r
51         DECLARE_PTR_TYPEDEFS(TypeRuleList);\r
52 \r
53         void SetValidator(const String& validator);\r
54         String GetValidator(void) const;\r
55 \r
56         void AddRequire(const String& attr);\r
57         void AddRequires(const TypeRuleList::Ptr& ruleList);\r
58         std::vector<String> GetRequires(void) const;\r
59 \r
60         void AddRule(const TypeRule& rule);\r
61         void AddRules(const TypeRuleList::Ptr& ruleList);\r
62 \r
63         TypeValidationResult ValidateAttribute(const String& name, const Value& value,\r
64             TypeRuleList::Ptr *subRules, String *hint, const TypeRuleUtilities *utils) const;\r
65 \r
66         size_t GetLength(void) const;\r
67 \r
68 private:\r
69         String m_Validator;\r
70         std::vector<String> m_Requires;\r
71         std::vector<TypeRule> m_Rules;\r
72 };\r
73 \r
74 }\r
75 \r
76 #endif /* TYPERULELIST_H */\r