1 /******************************************************************************
\r
3 * Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org) *
\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
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
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
20 #ifndef TYPERULELIST_H
\r
21 #define TYPERULELIST_H
\r
23 #include "config/i2-config.hpp"
\r
24 #include "base/value.hpp"
\r
31 class TypeRuleUtilities;
\r
36 enum TypeValidationResult
\r
39 ValidationInvalidType,
\r
40 ValidationUnknownField
\r
44 * A list of configuration type rules.
\r
48 class I2_CONFIG_API TypeRuleList : public Object
\r
51 DECLARE_OBJECT(TypeRuleList);
\r
53 void SetValidator(const String& validator);
\r
54 String GetValidator(void) const;
\r
56 void AddRequire(const String& attr);
\r
57 void AddRequires(const TypeRuleList::Ptr& ruleList);
\r
58 std::vector<String> GetRequires(void) const;
\r
60 void AddRule(const TypeRule& rule);
\r
61 void AddRules(const TypeRuleList::Ptr& ruleList);
\r
63 TypeValidationResult ValidateAttribute(const String& name, const Value& value,
\r
64 TypeRuleList::Ptr *subRules, String *hint, const TypeRuleUtilities *utils) const;
\r
66 size_t GetLength(void) const;
\r
70 std::vector<String> m_Requires;
\r
71 std::vector<TypeRule> m_Rules;
\r
76 #endif /* TYPERULELIST_H */
\r