KJS::Value KstBindPluginModuleCollection::extract(KJS::ExecState *exec, unsigned item) const {
  uint j = 0;

  const QMap<QString,Plugin::Data>& pluginList = PluginCollection::self()->pluginList();

  for (QMap<QString,Plugin::Data>::ConstIterator it = pluginList.begin(); it != pluginList.end(); ++it) {
    if (j++ == item) {
      return KJS::Object(new KstBindPluginModule(exec, it.data()));
    }
  }

  const KstPluginInfoList pluginInfo = KstDataObject::pluginInfoList();

  for (KstPluginInfoList::ConstIterator it = pluginInfo.begin(); it != pluginInfo.end(); ++it) {
    if (j++ == item) {
      KstDataObjectPtr ptr = KstDataObject::plugin(it.key());
      if (ptr) {
        KstBasicPluginPtr bp = kst_cast<KstBasicPlugin>(ptr);
        if (bp) {
          return KJS::Object(new KstBindPluginModule(exec, bp));
        }
      }
    }
  }

  return KJS::Undefined();
}
Example #2
0
KJS::Value KstBindPluginModuleCollection::extract(KJS::ExecState *exec, const KJS::Identifier& item) const {
  QString plugin = item.qstring();

  const QMap<QString,Plugin::Data>& pluginList = PluginCollection::self()->pluginList();

  for (QMap<QString,Plugin::Data>::ConstIterator it = pluginList.begin(); it != pluginList.end(); ++it) {
    if (it.data()._name == plugin || it.data()._readableName == plugin) {
      return KJS::Object(new KstBindPluginModule(exec, it.data()));
    }
  }

  const KstPluginInfoList pluginInfo = KstDataObject::pluginInfoList();

  for (KstPluginInfoList::ConstIterator it = pluginInfo.begin(); it != pluginInfo.end(); ++it) {
    if (it.key() == plugin) {
      KstDataObjectPtr ptr = KstDataObject::plugin(it.key());
      if (ptr) {
        KstBasicPluginPtr bp = kst_cast<KstBasicPlugin>(ptr);
        if (bp) {
          return KJS::Object(new KstBindPluginModule(exec, bp));
        }
      }
    }
  }

  return KJS::Undefined();
}
Example #3
0
KstPluginInfoList DataObject::pluginInfoList() {
  if (pluginInfo.isEmpty()) {
    scanPlugins();
  }

  KstPluginInfoList list;
  QMap<QString, DataObjectPtr>::ConstIterator it = pluginInfo.begin();
  for (; it != pluginInfo.end(); ++it) {
    list.insert(it.key(), it.value()->kind());
  }
  return list;
}
QStringList KstBindPluginModuleCollection::collection(KJS::ExecState *exec) const {
  Q_UNUSED(exec)

  QStringList rc;

  const QMap<QString,Plugin::Data>& pluginList = PluginCollection::self()->pluginList();

  for (QMap<QString,Plugin::Data>::ConstIterator it = pluginList.begin(); it != pluginList.end(); ++it) {
    rc << it.data()._name;
  }

  const KstPluginInfoList pluginInfo = KstDataObject::pluginInfoList();

  for (KstPluginInfoList::ConstIterator it = pluginInfo.begin(); it != pluginInfo.end(); ++it) {
    rc << it.key();
  }

  return rc;
}