Beispiel #1
0
  IIterable::Pointer
  Expressions::GetAsIIterable(Object::Pointer var, Expression::Pointer expression)
  {
    IIterable::Pointer iterable(var.Cast<IIterable>());
    if (!iterable.IsNull())
    {
      return iterable;
    }
    else
    {
      IAdapterManager::Pointer manager= Platform::GetServiceRegistry().GetServiceById<IAdapterManager>("org.blueberry.service.adaptermanager");
      Object::Pointer result;
      Poco::Any any(manager->GetAdapter(var, IIterable::GetStaticClassName()));
      if (!any.empty() && any.type() == typeid(Object::Pointer))
      {
        result = Poco::AnyCast<Object::Pointer>(any);
      }

      if (result)
      {
        iterable = result.Cast<IIterable>();
        return iterable;
      }

      if (manager->QueryAdapter(var->GetClassName(), IIterable::GetStaticClassName()) == IAdapterManager::NOT_LOADED)
        return IIterable::Pointer();

      throw CoreException("The variable is not iterable", expression->ToString());
    }
  }
Beispiel #2
0
 void
 Expressions::CheckCollection(Object::ConstPointer var, Expression::Pointer expression)
 {
   if (var.Cast<const ObjectVector<Object::Pointer> >())
     return;
   throw CoreException("Expression variable is not of type ObjectVector", expression->ToString());
 }