Beispiel #1
0
void ATPClientApp::listAssets() {
    auto request = DependencyManager::get<AssetClient>()->createGetAllMappingsRequest();
    QObject::connect(request, &GetAllMappingsRequest::finished, this, [=](GetAllMappingsRequest* request) mutable {
        auto result = request->getError();
        if (result == GetAllMappingsRequest::NotFound) {
            qDebug() << "not found: " << request->getErrorString();
        } else if (result == GetAllMappingsRequest::NoError) {
            auto mappings = request->getMappings();
            for (auto& kv : mappings ) {
                qDebug() << kv.first << kv.second.hash;
            }
        } else {
            qDebug() << "error -- " << request->getError() << " -- " << request->getErrorString();
        }
        request->deleteLater();
        finish(0);
    });
    request->start();
}
std::wstring
CDA_LanguageDictionary::getValue(const std::wstring& keyName)
  throw(std::exception&)
{
  // Return a value from the dictionary
  uint32_t i;
  RETURN_INTO_OBJREF(entries, iface::dom::NodeList,
                     getMappings());

  for (i=0; i < entries->length(); i++)
  {
    RETURN_INTO_OBJREF(currentNode, iface::dom::Node, entries->item(i));
    DECLARE_QUERY_INTERFACE_OBJREF(currentEl, currentNode, dom::Element);
    if (currentEl == NULL)
      continue;

    // If keyname matches then return node
    RETURN_INTO_WSTRING(mapKeyName, currentEl->getAttribute(L"keyname"));
    if (mapKeyName == keyName)
      return getTextContents(currentNode);
  }

  return L"";
}