本文整理汇总了C++中nsIRDFService::GetAnonymousResource方法的典型用法代码示例。如果您正苦于以下问题:C++ nsIRDFService::GetAnonymousResource方法的具体用法?C++ nsIRDFService::GetAnonymousResource怎么用?C++ nsIRDFService::GetAnonymousResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsIRDFService
的用法示例。
在下文中一共展示了nsIRDFService::GetAnonymousResource方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: relURI
nsresult
RDFContentSinkImpl::GetResourceAttribute(const PRUnichar** aAttributes,
nsIRDFResource** aResource)
{
nsCOMPtr<nsIAtom> localName;
nsAutoString nodeID;
for (; *aAttributes; aAttributes += 2) {
const nsDependentSubstring& nameSpaceURI =
SplitExpatName(aAttributes[0], getter_AddRefs(localName));
// We'll accept `resource' or `rdf:resource', under the spirit
// that we should be liberal towards the input that we
// receive.
if (!nameSpaceURI.IsEmpty() &&
!nameSpaceURI.EqualsLiteral(RDF_NAMESPACE_URI)) {
continue;
}
// XXX you can't specify both, but we'll just pick up the
// first thing that was specified and ignore the other.
if (localName == kResourceAtom) {
// XXX Take the URI and make it fully qualified by
// sticking it into the document's URL. This may not be
// appropriate...
nsAutoString relURI(aAttributes[1]);
if (rdf_RequiresAbsoluteURI(relURI)) {
nsresult rv;
nsCAutoString uri;
rv = mDocumentURL->Resolve(NS_ConvertUTF16toUTF8(aAttributes[1]), uri);
if (NS_FAILED(rv)) return rv;
return gRDFService->GetResource(uri, aResource);
}
return gRDFService->GetResource(NS_ConvertUTF16toUTF8(aAttributes[1]),
aResource);
}
else if (localName == kNodeIdAtom) {
nodeID.Assign(aAttributes[1]);
}
}
// If nodeID is present, check if we already know about it. If we've seen
// the nodeID before, use the same resource, otherwise generate a new one.
if (!nodeID.IsEmpty()) {
mNodeIDMap.Get(nodeID,aResource);
if (!*aResource) {
nsresult rv;
rv = gRDFService->GetAnonymousResource(aResource);
if (NS_FAILED(rv)) {
return rv;
}
mNodeIDMap.Put(nodeID,*aResource);
}
return NS_OK;
}
return NS_ERROR_FAILURE;
}