mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 14:44:32 +02:00
Rename macro RequireNotNull to REQUIRE_NOT_NULL
This commit is contained in:
parent
71c420d501
commit
9de36c0999
@ -30,7 +30,7 @@ static double ArrayLen(void)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
return self->GetLength();
|
return self->GetLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ static void ArraySet(int index, const Value& value)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
self->Set(index, value);
|
self->Set(index, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ static Value ArrayGet(int index)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
return self->Get(index);
|
return self->Get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ static void ArrayAdd(const Value& value)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
self->Add(value);
|
self->Add(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ static void ArrayRemove(int index)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
self->Remove(index);
|
self->Remove(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ static bool ArrayContains(const Value& value)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
return self->Contains(value);
|
return self->Contains(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ static void ArrayClear(void)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
self->Clear();
|
self->Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ static Array::Ptr ArraySort(const std::vector<Value>& args)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
|
|
||||||
Array::Ptr arr = self->ShallowClone();
|
Array::Ptr arr = self->ShallowClone();
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ static Array::Ptr ArrayShallowClone(void)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
return self->ShallowClone();
|
return self->ShallowClone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ static Value ArrayJoin(const Value& separator)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
|
|
||||||
Value result;
|
Value result;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
@ -149,7 +149,7 @@ static Array::Ptr ArrayReverse(void)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
return self->Reverse();
|
return self->Reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ static Array::Ptr ArrayMap(const Function::Ptr& function)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
|
|
||||||
if (vframe->Sandboxed && !function->IsSideEffectFree())
|
if (vframe->Sandboxed && !function->IsSideEffectFree())
|
||||||
BOOST_THROW_EXCEPTION(ScriptError("Map function must be side-effect free."));
|
BOOST_THROW_EXCEPTION(ScriptError("Map function must be side-effect free."));
|
||||||
@ -178,7 +178,7 @@ static Value ArrayReduce(const Function::Ptr& function)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
|
|
||||||
if (vframe->Sandboxed && !function->IsSideEffectFree())
|
if (vframe->Sandboxed && !function->IsSideEffectFree())
|
||||||
BOOST_THROW_EXCEPTION(ScriptError("Reduce function must be side-effect free."));
|
BOOST_THROW_EXCEPTION(ScriptError("Reduce function must be side-effect free."));
|
||||||
@ -203,7 +203,7 @@ static Array::Ptr ArrayFilter(const Function::Ptr& function)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
|
|
||||||
if (vframe->Sandboxed && !function->IsSideEffectFree())
|
if (vframe->Sandboxed && !function->IsSideEffectFree())
|
||||||
BOOST_THROW_EXCEPTION(ScriptError("Filter function must be side-effect free."));
|
BOOST_THROW_EXCEPTION(ScriptError("Filter function must be side-effect free."));
|
||||||
@ -225,7 +225,7 @@ static bool ArrayAny(const Function::Ptr& function)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
|
|
||||||
if (vframe->Sandboxed && !function->IsSideEffectFree())
|
if (vframe->Sandboxed && !function->IsSideEffectFree())
|
||||||
BOOST_THROW_EXCEPTION(ScriptError("Filter function must be side-effect free."));
|
BOOST_THROW_EXCEPTION(ScriptError("Filter function must be side-effect free."));
|
||||||
@ -245,7 +245,7 @@ static bool ArrayAll(const Function::Ptr& function)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
|
|
||||||
if (vframe->Sandboxed && !function->IsSideEffectFree())
|
if (vframe->Sandboxed && !function->IsSideEffectFree())
|
||||||
BOOST_THROW_EXCEPTION(ScriptError("Filter function must be side-effect free."));
|
BOOST_THROW_EXCEPTION(ScriptError("Filter function must be side-effect free."));
|
||||||
@ -264,7 +264,7 @@ static Array::Ptr ArrayUnique(void)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
|
|
||||||
std::set<Value> result;
|
std::set<Value> result;
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ static void ConfigObjectModifyAttribute(const String& attr, const Value& value)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
ConfigObject::Ptr self = vframe->Self;
|
ConfigObject::Ptr self = vframe->Self;
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
return self->ModifyAttribute(attr, value);
|
return self->ModifyAttribute(attr, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ static void ConfigObjectRestoreAttribute(const String& attr)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
ConfigObject::Ptr self = vframe->Self;
|
ConfigObject::Ptr self = vframe->Self;
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
return self->RestoreAttribute(attr);
|
return self->RestoreAttribute(attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ static String DateTimeFormat(const String& format)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
DateTime::Ptr self = static_cast<DateTime::Ptr>(vframe->Self);
|
DateTime::Ptr self = static_cast<DateTime::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
|
|
||||||
return self->Format(format);
|
return self->Format(format);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ static double DictionaryLen(void)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
return self->GetLength();
|
return self->GetLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ static void DictionarySet(const String& key, const Value& value)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
self->Set(key, value);
|
self->Set(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ static Value DictionaryGet(const String& key)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
return self->Get(key);
|
return self->Get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ static void DictionaryRemove(const String& key)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
self->Remove(key);
|
self->Remove(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ static bool DictionaryContains(const String& key)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
return self->Contains(key);
|
return self->Contains(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ static Dictionary::Ptr DictionaryShallowClone(void)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
return self->ShallowClone();
|
return self->ShallowClone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ static Array::Ptr DictionaryKeys(void)
|
|||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
||||||
Array::Ptr keys = new Array();
|
Array::Ptr keys = new Array();
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
|
|
||||||
ObjectLock olock(self);
|
ObjectLock olock(self);
|
||||||
for (const Dictionary::Pair& kv : self) {
|
for (const Dictionary::Pair& kv : self) {
|
||||||
@ -92,7 +92,7 @@ static Array::Ptr DictionaryValues(void)
|
|||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
|
||||||
Array::Ptr keys = new Array();
|
Array::Ptr keys = new Array();
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
|
|
||||||
ObjectLock olock(self);
|
ObjectLock olock(self);
|
||||||
for (const Dictionary::Pair& kv : self) {
|
for (const Dictionary::Pair& kv : self) {
|
||||||
|
@ -32,7 +32,7 @@ static Value FunctionCall(const std::vector<Value>& args)
|
|||||||
|
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Function::Ptr self = static_cast<Function::Ptr>(vframe->Self);
|
Function::Ptr self = static_cast<Function::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
|
|
||||||
std::vector<Value> uargs(args.begin() + 1, args.end());
|
std::vector<Value> uargs(args.begin() + 1, args.end());
|
||||||
return self->Invoke(args[0], uargs);
|
return self->Invoke(args[0], uargs);
|
||||||
@ -42,7 +42,7 @@ static Value FunctionCallV(const Value& thisArg, const Array::Ptr& args)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Function::Ptr self = static_cast<Function::Ptr>(vframe->Self);
|
Function::Ptr self = static_cast<Function::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
|
|
||||||
std::vector<Value> uargs;
|
std::vector<Value> uargs;
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ static String ObjectToString(void)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Object::Ptr self = static_cast<Object::Ptr>(vframe->Self);
|
Object::Ptr self = static_cast<Object::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
return self->ToString();
|
return self->ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ static void ObjectNotifyAttribute(const String& attribute)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Object::Ptr self = static_cast<Object::Ptr>(vframe->Self);
|
Object::Ptr self = static_cast<Object::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
self->NotifyField(self->GetReflectionType()->GetFieldId(attribute));
|
self->NotifyField(self->GetReflectionType()->GetFieldId(attribute));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ static Object::Ptr ObjectClone(void)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Object::Ptr self = static_cast<Object::Ptr>(vframe->Self);
|
Object::Ptr self = static_cast<Object::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
return self->Clone();
|
return self->Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ extern I2_BASE_API Value Empty;
|
|||||||
DECLARE_PTR_TYPEDEFS(klass); \
|
DECLARE_PTR_TYPEDEFS(klass); \
|
||||||
IMPL_TYPE_LOOKUP();
|
IMPL_TYPE_LOOKUP();
|
||||||
|
|
||||||
#define RequireNotNull(ptr) RequireNotNullInternal(ptr, #ptr)
|
#define REQUIRE_NOT_NULL(ptr) RequireNotNullInternal(ptr, #ptr)
|
||||||
|
|
||||||
I2_BASE_API void RequireNotNullInternal(const intrusive_ptr<Object>& object, const char *description);
|
I2_BASE_API void RequireNotNullInternal(const intrusive_ptr<Object>& object, const char *description);
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ static void TypeRegisterAttributeHandler(const String& fieldName, const Function
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Type::Ptr self = static_cast<Type::Ptr>(vframe->Self);
|
Type::Ptr self = static_cast<Type::Ptr>(vframe->Self);
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
|
|
||||||
int fid = self->GetFieldId(fieldName);
|
int fid = self->GetFieldId(fieldName);
|
||||||
self->RegisterAttributeHandler(fid, boost::bind(&InvokeAttributeHandlerHelper, callback, _1, _2));
|
self->RegisterAttributeHandler(fid, boost::bind(&InvokeAttributeHandlerHelper, callback, _1, _2));
|
||||||
|
@ -30,7 +30,7 @@ static void CheckableProcessCheckResult(const CheckResult::Ptr& cr)
|
|||||||
{
|
{
|
||||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||||
Checkable::Ptr self = vframe->Self;
|
Checkable::Ptr self = vframe->Self;
|
||||||
RequireNotNull(self);
|
REQUIRE_NOT_NULL(self);
|
||||||
self->ProcessCheckResult(cr);
|
self->ProcessCheckResult(cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ Value MacroProcessor::ResolveMacros(const Value& str, const ResolverList& resolv
|
|||||||
bool useResolvedMacros, int recursionLevel)
|
bool useResolvedMacros, int recursionLevel)
|
||||||
{
|
{
|
||||||
if (useResolvedMacros)
|
if (useResolvedMacros)
|
||||||
RequireNotNull(resolvedMacros);
|
REQUIRE_NOT_NULL(resolvedMacros);
|
||||||
|
|
||||||
Value result;
|
Value result;
|
||||||
|
|
||||||
@ -458,7 +458,7 @@ Value MacroProcessor::ResolveArguments(const Value& command, const Dictionary::P
|
|||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros, int recursionLevel)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros, int recursionLevel)
|
||||||
{
|
{
|
||||||
if (useResolvedMacros)
|
if (useResolvedMacros)
|
||||||
RequireNotNull(resolvedMacros);
|
REQUIRE_NOT_NULL(resolvedMacros);
|
||||||
|
|
||||||
Value resolvedCommand;
|
Value resolvedCommand;
|
||||||
if (!arguments || command.IsObjectType<Array>() || command.IsObjectType<Function>())
|
if (!arguments || command.IsObjectType<Array>() || command.IsObjectType<Function>())
|
||||||
|
@ -38,8 +38,8 @@ REGISTER_SCRIPTFUNCTION_NS(Internal, ClusterCheck, &ClusterCheckTask::ScriptFunc
|
|||||||
void ClusterCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
void ClusterCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
{
|
{
|
||||||
RequireNotNull(checkable);
|
REQUIRE_NOT_NULL(checkable);
|
||||||
RequireNotNull(cr);
|
REQUIRE_NOT_NULL(cr);
|
||||||
|
|
||||||
if (resolvedMacros && !useResolvedMacros)
|
if (resolvedMacros && !useResolvedMacros)
|
||||||
return;
|
return;
|
||||||
|
@ -34,8 +34,8 @@ REGISTER_SCRIPTFUNCTION_NS(Internal, ClusterZoneCheck, &ClusterZoneCheckTask::Sc
|
|||||||
void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
{
|
{
|
||||||
RequireNotNull(checkable);
|
REQUIRE_NOT_NULL(checkable);
|
||||||
RequireNotNull(cr);
|
REQUIRE_NOT_NULL(cr);
|
||||||
|
|
||||||
ApiListener::Ptr listener = ApiListener::GetInstance();
|
ApiListener::Ptr listener = ApiListener::GetInstance();
|
||||||
|
|
||||||
|
@ -31,11 +31,11 @@ using namespace icinga;
|
|||||||
|
|
||||||
REGISTER_SCRIPTFUNCTION_NS(Internal, ExceptionCheck, &ExceptionCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros");
|
REGISTER_SCRIPTFUNCTION_NS(Internal, ExceptionCheck, &ExceptionCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros");
|
||||||
|
|
||||||
void ExceptionCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr,
|
void ExceptionCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
{
|
{
|
||||||
RequireNotNull(service);
|
REQUIRE_NOT_NULL(checkable);
|
||||||
RequireNotNull(cr);
|
REQUIRE_NOT_NULL(cr);
|
||||||
|
|
||||||
if (resolvedMacros && !useResolvedMacros)
|
if (resolvedMacros && !useResolvedMacros)
|
||||||
return;
|
return;
|
||||||
|
@ -32,11 +32,11 @@ using namespace icinga;
|
|||||||
|
|
||||||
REGISTER_SCRIPTFUNCTION_NS(Internal, IcingaCheck, &IcingaCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros");
|
REGISTER_SCRIPTFUNCTION_NS(Internal, IcingaCheck, &IcingaCheckTask::ScriptFunc, "checkable:cr:resolvedMacros:useResolvedMacros");
|
||||||
|
|
||||||
void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult::Ptr& cr,
|
void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
{
|
{
|
||||||
RequireNotNull(service);
|
REQUIRE_NOT_NULL(checkable);
|
||||||
RequireNotNull(cr);
|
REQUIRE_NOT_NULL(cr);
|
||||||
|
|
||||||
if (resolvedMacros && !useResolvedMacros)
|
if (resolvedMacros && !useResolvedMacros)
|
||||||
return;
|
return;
|
||||||
@ -115,5 +115,5 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResul
|
|||||||
} else
|
} else
|
||||||
cr->SetState(ServiceOK);
|
cr->SetState(ServiceOK);
|
||||||
|
|
||||||
service->ProcessCheckResult(cr);
|
checkable->ProcessCheckResult(cr);
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,8 @@ REGISTER_SCRIPTFUNCTION_NS(Internal, NullCheck, &NullCheckTask::ScriptFunc, "che
|
|||||||
void NullCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
void NullCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
{
|
{
|
||||||
RequireNotNull(checkable);
|
REQUIRE_NOT_NULL(checkable);
|
||||||
RequireNotNull(cr);
|
REQUIRE_NOT_NULL(cr);
|
||||||
|
|
||||||
if (resolvedMacros && !useResolvedMacros)
|
if (resolvedMacros && !useResolvedMacros)
|
||||||
return;
|
return;
|
||||||
|
@ -27,5 +27,5 @@ REGISTER_SCRIPTFUNCTION_NS(Internal, NullEvent, &NullEventTask::ScriptFunc, "che
|
|||||||
|
|
||||||
void NullEventTask::ScriptFunc(const Checkable::Ptr& checkable, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
void NullEventTask::ScriptFunc(const Checkable::Ptr& checkable, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
{
|
{
|
||||||
RequireNotNull(checkable);
|
REQUIRE_NOT_NULL(checkable);
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,8 @@ REGISTER_SCRIPTFUNCTION_NS(Internal, PluginCheck, &PluginCheckTask::ScriptFunc,
|
|||||||
void PluginCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
void PluginCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
{
|
{
|
||||||
RequireNotNull(checkable);
|
REQUIRE_NOT_NULL(checkable);
|
||||||
RequireNotNull(cr);
|
REQUIRE_NOT_NULL(cr);
|
||||||
|
|
||||||
CheckCommand::Ptr commandObj = checkable->GetCheckCommand();
|
CheckCommand::Ptr commandObj = checkable->GetCheckCommand();
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ REGISTER_SCRIPTFUNCTION_NS(Internal, PluginEvent, &PluginEventTask::ScriptFunc,
|
|||||||
void PluginEventTask::ScriptFunc(const Checkable::Ptr& checkable,
|
void PluginEventTask::ScriptFunc(const Checkable::Ptr& checkable,
|
||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
{
|
{
|
||||||
RequireNotNull(checkable);
|
REQUIRE_NOT_NULL(checkable);
|
||||||
|
|
||||||
EventCommand::Ptr commandObj = checkable->GetEventCommand();
|
EventCommand::Ptr commandObj = checkable->GetEventCommand();
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@ void PluginNotificationTask::ScriptFunc(const Notification::Ptr& notification,
|
|||||||
const String& author, const String& comment, const Dictionary::Ptr& resolvedMacros,
|
const String& author, const String& comment, const Dictionary::Ptr& resolvedMacros,
|
||||||
bool useResolvedMacros)
|
bool useResolvedMacros)
|
||||||
{
|
{
|
||||||
RequireNotNull(notification);
|
REQUIRE_NOT_NULL(notification);
|
||||||
RequireNotNull(user);
|
REQUIRE_NOT_NULL(user);
|
||||||
|
|
||||||
NotificationCommand::Ptr commandObj = notification->GetCommand();
|
NotificationCommand::Ptr commandObj = notification->GetCommand();
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ REGISTER_SCRIPTFUNCTION_NS(Internal, RandomCheck, &RandomCheckTask::ScriptFunc,
|
|||||||
void RandomCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
void RandomCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
|
||||||
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
|
||||||
{
|
{
|
||||||
RequireNotNull(checkable);
|
REQUIRE_NOT_NULL(checkable);
|
||||||
RequireNotNull(cr);
|
REQUIRE_NOT_NULL(cr);
|
||||||
|
|
||||||
if (resolvedMacros && !useResolvedMacros)
|
if (resolvedMacros && !useResolvedMacros)
|
||||||
return;
|
return;
|
||||||
|
@ -27,7 +27,7 @@ REGISTER_SCRIPTFUNCTION_NS(Internal, EvenMinutesTimePeriod, &TimePeriodTask::Eve
|
|||||||
|
|
||||||
Array::Ptr TimePeriodTask::EmptyTimePeriodUpdate(const TimePeriod::Ptr& tp, double, double)
|
Array::Ptr TimePeriodTask::EmptyTimePeriodUpdate(const TimePeriod::Ptr& tp, double, double)
|
||||||
{
|
{
|
||||||
RequireNotNull(tp);
|
REQUIRE_NOT_NULL(tp);
|
||||||
|
|
||||||
Array::Ptr segments = new Array();
|
Array::Ptr segments = new Array();
|
||||||
return segments;
|
return segments;
|
||||||
@ -36,7 +36,7 @@ Array::Ptr TimePeriodTask::EmptyTimePeriodUpdate(const TimePeriod::Ptr& tp, doub
|
|||||||
Array::Ptr TimePeriodTask::EvenMinutesTimePeriodUpdate(const TimePeriod::Ptr& tp, double begin, double end)
|
Array::Ptr TimePeriodTask::EvenMinutesTimePeriodUpdate(const TimePeriod::Ptr& tp, double begin, double end)
|
||||||
{
|
{
|
||||||
Array::Ptr segments = new Array();
|
Array::Ptr segments = new Array();
|
||||||
RequireNotNull(tp);
|
REQUIRE_NOT_NULL(tp);
|
||||||
|
|
||||||
for (long t = begin / 60 - 1; t * 60 < end; t++) {
|
for (long t = begin / 60 - 1; t * 60 < end; t++) {
|
||||||
if ((t % 2) == 0) {
|
if ((t % 2) == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user