Back to index

lightning-sunbird  0.9+nobinonly
Functions
nsMsgRDFUtils.cpp File Reference
#include "nsMsgRDFUtils.h"
#include "nsIServiceManager.h"
#include "prprf.h"
#include "nsCOMPtr.h"
#include "nsMemory.h"
#include "nsReadableUtils.h"

Go to the source code of this file.

Functions

nsresult createNode (const PRUnichar *str, nsIRDFNode **node, nsIRDFService *rdfService)
nsresult createIntNode (PRInt32 value, nsIRDFNode **node, nsIRDFService *rdfService)
nsresult createBlobNode (PRUint8 *value, PRUint32 &length, nsIRDFNode **node, nsIRDFService *rdfService)
nsresult GetTargetHasAssertion (nsIRDFDataSource *dataSource, nsIRDFResource *folderResource, nsIRDFResource *property, PRBool tv, nsIRDFNode *target, PRBool *hasAssertion)

Function Documentation

nsresult createBlobNode ( PRUint8 value,
PRUint32 length,
nsIRDFNode **  node,
nsIRDFService rdfService 
)

Definition at line 80 of file nsMsgRDFUtils.cpp.

{
  NS_ENSURE_ARG_POINTER(node);
  NS_ENSURE_ARG_POINTER(rdfService);
  
  *node = nsnull;
  nsCOMPtr<nsIRDFBlob> blob;
  nsresult rv = rdfService->GetBlobLiteral(value, length, getter_AddRefs(blob));
  NS_ENSURE_SUCCESS(rv,rv);
  NS_IF_ADDREF(*node = blob);
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult createIntNode ( PRInt32  value,
nsIRDFNode **  node,
nsIRDFService rdfService 
)

Definition at line 66 of file nsMsgRDFUtils.cpp.

{
  *node = nsnull;
  nsresult rv; 
  if (!rdfService) return NS_ERROR_NULL_POINTER;  
  nsCOMPtr<nsIRDFInt> num;
  rv = rdfService->GetIntLiteral(value, getter_AddRefs(num));
  if(NS_SUCCEEDED(rv)) {
    *node = num;
    NS_IF_ADDREF(*node);
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult createNode ( const PRUnichar str,
nsIRDFNode **  node,
nsIRDFService rdfService 
)

Definition at line 44 of file nsMsgRDFUtils.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIRDFLiteral> value;

  NS_ASSERTION(rdfService, "rdfService is null");
  if (!rdfService) return NS_OK;

  if (str) {
    rv = rdfService->GetLiteral(str, getter_AddRefs(value));
  } 
  else {
    rv = rdfService->GetLiteral(EmptyString().get(), getter_AddRefs(value));
  }

  if (NS_SUCCEEDED(rv)) {
    *node = value;
    NS_IF_ADDREF(*node);
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult GetTargetHasAssertion ( nsIRDFDataSource dataSource,
nsIRDFResource folderResource,
nsIRDFResource property,
PRBool  tv,
nsIRDFNode target,
PRBool hasAssertion 
)

Definition at line 93 of file nsMsgRDFUtils.cpp.

{
  NS_ENSURE_ARG_POINTER(hasAssertion);
  
  nsCOMPtr<nsIRDFNode> currentTarget;
  
  nsresult rv = dataSource->GetTarget(folderResource, property,tv, getter_AddRefs(currentTarget));
  if(NS_SUCCEEDED(rv))
  {
    nsCOMPtr<nsIRDFLiteral> value1(do_QueryInterface(target));
    nsCOMPtr<nsIRDFLiteral> value2(do_QueryInterface(currentTarget));
    if(value1 && value2)
      //If the two values are equal then it has this assertion
      *hasAssertion = (value1 == value2);
  }
  else
    rv = NS_NOINTERFACE;
  
  return rv;
  
}

Here is the call graph for this function:

Here is the caller graph for this function: