2013-02-02 14:28:11 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* Icinga 2 *
|
2014-03-19 01:02:29 +01:00
|
|
|
* Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org) *
|
2013-02-02 14:28:11 +01:00
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License *
|
|
|
|
* as published by the Free Software Foundation; either version 2 *
|
|
|
|
* of the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, write to the Free Software Foundation *
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#ifndef TYPERULE_H
|
|
|
|
#define TYPERULE_H
|
|
|
|
|
2014-05-25 16:23:35 +02:00
|
|
|
#include "config/i2-config.hpp"
|
|
|
|
#include "config/typerulelist.hpp"
|
2014-09-09 14:49:21 +02:00
|
|
|
#include "base/debuginfo.hpp"
|
2013-03-17 20:19:29 +01:00
|
|
|
|
2013-02-02 14:28:11 +01:00
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The allowed type for a type rule.
|
|
|
|
*
|
|
|
|
* @ingroup config
|
|
|
|
*/
|
|
|
|
enum TypeSpecifier
|
|
|
|
{
|
|
|
|
TypeAny,
|
|
|
|
TypeScalar,
|
|
|
|
TypeNumber,
|
|
|
|
TypeString,
|
2013-03-14 12:17:46 +01:00
|
|
|
TypeDictionary,
|
2013-05-03 10:48:28 +02:00
|
|
|
TypeArray,
|
|
|
|
TypeName
|
2013-02-02 14:28:11 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A configuration type rule.
|
|
|
|
*
|
|
|
|
* @ingroup config
|
|
|
|
*/
|
|
|
|
struct I2_CONFIG_API TypeRule
|
|
|
|
{
|
|
|
|
public:
|
2013-05-03 10:48:28 +02:00
|
|
|
TypeRule(TypeSpecifier type, const String& nameType,
|
|
|
|
const String& namePattern, const TypeRuleList::Ptr& subRules,
|
|
|
|
const DebugInfo& debuginfo);
|
2013-02-02 14:28:11 +01:00
|
|
|
|
|
|
|
TypeRuleList::Ptr GetSubRules(void) const;
|
2013-03-14 12:17:46 +01:00
|
|
|
|
2013-02-05 13:06:42 +01:00
|
|
|
bool MatchName(const String& name) const;
|
2013-05-03 10:48:28 +02:00
|
|
|
bool MatchValue(const Value& value, String *hint) const;
|
2013-02-02 14:28:11 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
TypeSpecifier m_Type;
|
2013-05-03 10:48:28 +02:00
|
|
|
String m_NameType;
|
2013-02-02 14:28:11 +01:00
|
|
|
String m_NamePattern;
|
|
|
|
TypeRuleList::Ptr m_SubRules;
|
|
|
|
DebugInfo m_DebugInfo;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* TYPERULE_H */
|