Exemplo n.º 1
0
 ctkVersionRange::ctkVersionRange()
 {
   low = ctkVersion(ctkVersion::emptyVersion());
   high = ctkVersion();
   lowIncluded = true;
   highIncluded = false;
 }
Exemplo n.º 2
0
  ctkVersionRange::ctkVersionRange(const QString& vr)
  {
    bool op = vr.startsWith("(");
    bool ob = vr.startsWith("[");

    if (op || ob) {
      bool cp = vr.endsWith(")");
      bool cb = vr.endsWith("]");
      int comma = vr.indexOf(',');

      if (comma > 0 && (cp || cb))
      {
        low = ctkVersion(vr.mid(1, comma-1).trimmed());
        high = ctkVersion(vr.mid(comma+1, vr.length()-comma-2).trimmed());
        lowIncluded = ob;
        highIncluded = cb;
      }
      else
      {
        throw std::invalid_argument("Illegal version range: " + vr.toStdString());
      }
    }
    else
    {
      low = ctkVersion(vr);
      high = ctkVersion();
      lowIncluded = true;
      highIncluded = false;
    }
  }
Exemplo n.º 3
0
 ctkPluginFrameworkPrivate::ctkPluginFrameworkPrivate(ctkPluginFramework& qq, ctkPluginFrameworkContext* fw)
   : ctkPluginPrivate(qq, fw, 0, PluginConstants::SYSTEM_PLUGIN_LOCATION,
                   PluginConstants::SYSTEM_PLUGIN_SYMBOLICNAME,
                   // TODO: read version from the manifest resource
                   ctkVersion(0, 9, 0))
 {
   systemHeaders.insert(PluginConstants::PLUGIN_SYMBOLICNAME, symbolicName);
   systemHeaders.insert(PluginConstants::PLUGIN_NAME, location);
   systemHeaders.insert(PluginConstants::PLUGIN_VERSION, version.toString());
 }
Exemplo n.º 4
0
//----------------------------------------------------------------------------
void ctkPluginPrivate::checkManifestHeaders()
{
  symbolicName = archive->getAttribute(ctkPluginConstants::PLUGIN_SYMBOLICNAME);

  if (symbolicName.isEmpty())
  {
    throw ctkInvalidArgumentException(QString("ctkPlugin has no symbolic name, location=") +
                                      location);
  }

  QString mpv = archive->getAttribute(ctkPluginConstants::PLUGIN_VERSION);
  if (!mpv.isEmpty())
  {
    try
    {
      version = ctkVersion(mpv);
    }
    catch (const std::exception& e)
    {
      throw ctkInvalidArgumentException(QString("ctkPlugin does not specify a valid ") +
                                        ctkPluginConstants::PLUGIN_VERSION + " header. Got exception: " + e.what());
    }
  }

  QSharedPointer<ctkPlugin> snp = fwCtx->plugins->getPlugin(symbolicName, version);
  // TBD! Should we allow update to same version?
  if (!snp.isNull() && snp->d_func() != this)
  {
    throw ctkInvalidArgumentException(QString("Plugin with same symbolic name and version is already installed (")
                                      + symbolicName + ", " + version.toString() + ")");
  }

  QString ap = archive->getAttribute(ctkPluginConstants::PLUGIN_ACTIVATIONPOLICY);
  if (ctkPluginConstants::ACTIVATION_EAGER == ap)
  {
    eagerActivation = true;
  }

}