mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-24 22:24:44 +02:00
parent
1ddab493e1
commit
cb5e6c1c6d
@ -80,7 +80,7 @@ bool ScriptUtils::Regex(const String& pattern, const String& text)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ScriptUtils::Len(const Value& value)
|
double ScriptUtils::Len(const Value& value)
|
||||||
{
|
{
|
||||||
if (value.IsObjectType<Dictionary>()) {
|
if (value.IsObjectType<Dictionary>()) {
|
||||||
Dictionary::Ptr dict = value;
|
Dictionary::Ptr dict = value;
|
||||||
@ -88,8 +88,10 @@ int ScriptUtils::Len(const Value& value)
|
|||||||
} else if (value.IsObjectType<Array>()) {
|
} else if (value.IsObjectType<Array>()) {
|
||||||
Array::Ptr array = value;
|
Array::Ptr array = value;
|
||||||
return array->GetLength();
|
return array->GetLength();
|
||||||
} else {
|
} else if (value.IsString()) {
|
||||||
return Convert::ToString(value).GetLength();
|
return Convert::ToString(value).GetLength();
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
static double CastNumber(const Value& value);
|
static double CastNumber(const Value& value);
|
||||||
static bool CastBool(const Value& value);
|
static bool CastBool(const Value& value);
|
||||||
static bool Regex(const String& pattern, const String& text);
|
static bool Regex(const String& pattern, const String& text);
|
||||||
static int Len(const Value& value);
|
static double Len(const Value& value);
|
||||||
static Array::Ptr Union(const std::vector<Value>& arguments);
|
static Array::Ptr Union(const std::vector<Value>& arguments);
|
||||||
static Array::Ptr Intersection(const std::vector<Value>& arguments);
|
static Array::Ptr Intersection(const std::vector<Value>& arguments);
|
||||||
static void Log(const std::vector<Value>& arguments);
|
static void Log(const std::vector<Value>& arguments);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user