void ScriptWrapper::RemoveScript(IHTMLDocument2 *doc) { CComQIPtr<IHTMLDocument3> doc3(doc); if (!doc3) { return; } CComPtr<IHTMLElement> element; CComBSTR id(L"__webdriver_private_span"); HRESULT hr = doc3->getElementById(id, &element); if (FAILED(hr)) { LOGHR(WARN, hr) << "Cannot find the script tag. Bailing."; return; } CComQIPtr<IHTMLDOMNode> element_node(element); if (element_node) { CComPtr<IHTMLElement> body; hr = doc->get_body(&body); if (FAILED(hr)) { LOGHR(WARN, hr) << "Cannot locate body of document"; return; } CComQIPtr<IHTMLDOMNode> body_node(body); if (!body_node) { LOG(WARN) << "Cannot cast body to a standard html node"; return; } CComPtr<IHTMLDOMNode> removed; hr = body_node->removeChild(element_node, &removed); if (FAILED(hr)) { LOGHR(DEBUG, hr) << "Cannot remove child node. Shouldn't matter. Bailing"; } } }
inline NodeRef toRDF(const Context &ctx, NodeRef _this, const ::SkeletonTrackingService &value) { { ctx.model.add_statement(ctx.world, _this, Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("rdf:type")), Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("service:SkeletonTrackingService"))); } // Serialize member getCoordinateSystems { const auto & _that = value.getCoordinateSystems(); if (Arvida::RDF::isValidValue(_that)) { const std::string that_path = ctx.path + "/coordinateSystems/"; Arvida::RDF::Context that_ctx(ctx, that_path); Redland::Node that_node(Redland::Node::make_uri_node(ctx.world, that_path)); ctx.model.add_statement(ctx.world, _this, Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("service:trackerCoordinateSystems")), that_node); ctx.model.add_statement(ctx.world, that_node, Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("rdf:type")), Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("core:Container"))); for (auto it = std::begin(_that); it != std::end(_that); ++it) { const auto & _element = *it; const std::string element_path = ctx.path + "/coordinateSystems/" + (_element ? _element->getName() : ""); Arvida::RDF::Context element_ctx(ctx, element_path); Redland::Node element_node(Redland::Node::make_uri_node(ctx.world, element_path)); if (!Arvida::RDF::isNodeExists(ctx.model, element_node)) Arvida::RDF::toRDF(element_ctx, element_node, _element); ctx.model.add_statement(ctx.world, that_node, Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("core:member")), element_node); } } } // Serialize member getQuantities { const auto & _that = value.getQuantities(); if (Arvida::RDF::isValidValue(_that)) { const std::string that_path = ctx.path + "/quantities/"; Arvida::RDF::Context that_ctx(ctx, that_path); Redland::Node that_node(Redland::Node::make_uri_node(ctx.world, that_path)); ctx.model.add_statement(ctx.world, _this, Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("service:trackerQuantities")), that_node); ctx.model.add_statement(ctx.world, that_node, Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("rdf:type")), Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("core:Container"))); for (auto it = std::begin(_that); it != std::end(_that); ++it) { const auto & _element = *it; const std::string element_path = ctx.path + "/quantities/" + (_element ? _element->getName() : ""); Arvida::RDF::Context element_ctx(ctx, element_path); Redland::Node element_node(Redland::Node::make_uri_node(ctx.world, element_path)); if (!Arvida::RDF::isNodeExists(ctx.model, element_node)) Arvida::RDF::toRDF(element_ctx, element_node, _element); ctx.model.add_statement(ctx.world, that_node, Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("core:member")), element_node); } } } // Serialize member getSegments { const auto & _that = value.getSegments(); if (Arvida::RDF::isValidValue(_that)) { const std::string that_path = ctx.path + "/segments/"; Arvida::RDF::Context that_ctx(ctx, that_path); Redland::Node that_node(Redland::Node::make_uri_node(ctx.world, that_path)); ctx.model.add_statement(ctx.world, _this, Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("service:trackerSegments")), that_node); ctx.model.add_statement(ctx.world, that_node, Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("rdf:type")), Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("core:Container"))); for (auto it = std::begin(_that); it != std::end(_that); ++it) { const auto & _element = *it; const std::string element_path = ctx.path + "/segments/" + (_element ? _element->getName() : ""); Arvida::RDF::Context element_ctx(ctx, element_path); Redland::Node element_node(Redland::Node::make_uri_node(ctx.world, element_path)); if (!Arvida::RDF::isNodeExists(ctx.model, element_node)) Arvida::RDF::toRDF(element_ctx, element_node, _element); ctx.model.add_statement(ctx.world, that_node, Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("core:member")), element_node); } } } // Serialize member getSkeletons { const auto & _that = value.getSkeletons(); if (Arvida::RDF::isValidValue(_that)) { const std::string that_path = ctx.path + "/skeletons/"; Arvida::RDF::Context that_ctx(ctx, that_path); Redland::Node that_node(Redland::Node::make_uri_node(ctx.world, that_path)); ctx.model.add_statement(ctx.world, _this, Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("service:trackerSkeletons")), that_node); ctx.model.add_statement(ctx.world, that_node, Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("rdf:type")), Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("core:Container"))); for (auto it = std::begin(_that); it != std::end(_that); ++it) { const auto & _element = *it; const std::string element_path = ctx.path + "/skeletons/" + (_element ? _element->getName() : ""); Arvida::RDF::Context element_ctx(ctx, element_path); Redland::Node element_node(Redland::Node::make_uri_node(ctx.world, element_path)); if (!Arvida::RDF::isNodeExists(ctx.model, element_node)) Arvida::RDF::toRDF(element_ctx, element_node, _element); ctx.model.add_statement(ctx.world, that_node, Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("core:member")), element_node); } } } return _this; }
inline NodeRef toRDF(const Context &ctx, NodeRef _this, const ::Skeleton &value) { { ctx.model.add_statement(ctx.world, _this, Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("rdf:type")), Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("skel:Skeleton"))); } // Serialize member getBones { const auto & _that = value.getBones(); if (Arvida::RDF::isValidValue(_that)) { for (auto it = std::begin(_that); it != std::end(_that); ++it) { const auto & _element = *it; const std::string element_path = (::get_segments_path(ctx)) + "/" + (_element ? _element->getName() : ""); Arvida::RDF::Context element_ctx(ctx, element_path); Redland::Node element_node(Redland::Node::make_uri_node(ctx.world, element_path)); if (!Arvida::RDF::isNodeExists(ctx.model, element_node)) Arvida::RDF::toRDF(element_ctx, element_node, _element); ctx.model.add_statement(ctx.world, _this, Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("skel:skeletonBone")), element_node); } } } // Serialize member getJoints { const auto & _that = value.getJoints(); if (Arvida::RDF::isValidValue(_that)) { for (auto it = std::begin(_that); it != std::end(_that); ++it) { const auto & _element = *it; const std::string element_path = (::get_segments_path(ctx)) + "/" + (_element ? _element->getName() : ""); Arvida::RDF::Context element_ctx(ctx, element_path); Redland::Node element_node(Redland::Node::make_uri_node(ctx.world, element_path)); if (!Arvida::RDF::isNodeExists(ctx.model, element_node)) Arvida::RDF::toRDF(element_ctx, element_node, _element); ctx.model.add_statement(ctx.world, _this, Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("skel:skeletonJoint")), element_node); } } } // Serialize member getRoots { const auto & _that = value.getRoots(); if (Arvida::RDF::isValidValue(_that)) { for (auto it = std::begin(_that); it != std::end(_that); ++it) { const auto & _element = *it; const std::string element_path = (::get_segments_path(ctx)) + "/" + (_element ? _element->getName() : ""); Arvida::RDF::Context element_ctx(ctx, element_path); Redland::Node element_node(Redland::Node::make_uri_node(ctx.world, element_path)); if (!Arvida::RDF::isNodeExists(ctx.model, element_node)) Arvida::RDF::toRDF(element_ctx, element_node, _element); ctx.model.add_statement(ctx.world, _this, Redland::Node::make_uri_node(ctx.world, ctx.namespaces.expand("skel:skeletonRoot")), element_node); } } } return _this; }