mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 02:31:59 +00:00
Updated to use nsRDFResource (is this file obsolete though)?
This commit is contained in:
parent
ccb2fbf4fb
commit
350b2cd9a8
@ -24,20 +24,13 @@
|
||||
#include "plstr.h"
|
||||
|
||||
nsMsgRDFFolder::nsMsgRDFFolder(const char* uri)
|
||||
: nsRDFResource(uri), mFolder(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mURI = PL_strdup(uri);
|
||||
mFolder = nsnull;
|
||||
|
||||
}
|
||||
|
||||
nsMsgRDFFolder::~nsMsgRDFFolder()
|
||||
{
|
||||
PR_FREEIF(mURI);
|
||||
|
||||
if(mFolder)
|
||||
NS_RELEASE(mFolder);
|
||||
|
||||
NS_IF_RELEASE(mFolder);
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsMsgRDFFolder)
|
||||
@ -50,65 +43,12 @@ nsMsgRDFFolder::QueryInterface(REFNSIID iid, void** result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = nsnull;
|
||||
if(iid.Equals(nsIRDFResource::IID()) ||
|
||||
iid.Equals(nsIRDFNode::IID()) ||
|
||||
iid.Equals(nsIMsgRDFFolder::IID()) ||
|
||||
iid.Equals(::nsISupports::IID())) {
|
||||
if (iid.Equals(nsIMsgRDFFolder::IID())) {
|
||||
*result = NS_STATIC_CAST(nsIMsgRDFFolder*, this);
|
||||
}
|
||||
|
||||
if(*result != nsnull)
|
||||
{
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgRDFFolder::EqualsNode(nsIRDFNode* node, PRBool* result) const
|
||||
{
|
||||
nsresult rv;
|
||||
nsIRDFResource* resource;
|
||||
if (NS_SUCCEEDED(node->QueryInterface(nsIRDFResource::IID(), (void**) &resource)))
|
||||
{
|
||||
rv = EqualsResource(resource, result);
|
||||
NS_RELEASE(resource);
|
||||
}
|
||||
else {
|
||||
*result = PR_FALSE;
|
||||
rv = NS_OK;\
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgRDFFolder::GetValue(const char* *uri) const
|
||||
{
|
||||
if (!uri)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*uri = mURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgRDFFolder::EqualsResource(const nsIRDFResource* resource, PRBool* result) const
|
||||
{
|
||||
if (!resource || !result) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
const char *uri;
|
||||
if(NS_SUCCEEDED(resource->GetValue(&uri)))
|
||||
{
|
||||
return EqualsString(uri, result);
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgRDFFolder::EqualsString(const char* uri, PRBool* result) const
|
||||
{
|
||||
if (!uri || !result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*result = (PL_strcmp(uri, mURI) == 0);
|
||||
return NS_OK;
|
||||
return nsRDFResource::QueryInterface(iid, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgRDFFolder::GetFolder(nsIMsgFolder * *aFolder)
|
||||
|
@ -18,29 +18,19 @@
|
||||
|
||||
#include "nsIMsgRDFFolder.h"
|
||||
|
||||
class nsMsgRDFFolder : public nsIMsgRDFFolder
|
||||
class nsMsgRDFFolder : public nsRDFResource, public nsIMsgRDFFolder
|
||||
{
|
||||
private:
|
||||
char * mURI;
|
||||
nsIMsgFolder *mFolder;
|
||||
public:
|
||||
nsMsgRDFFolder(const char* uri);
|
||||
virtual ~nsMsgRDFFolder();
|
||||
|
||||
/* this macro defines QueryInterface, AddRef and Release for this class */
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
//nsIRDFNode
|
||||
NS_IMETHOD EqualsNode(nsIRDFNode* node, PRBool* result) const;
|
||||
|
||||
//nsIRDFResource
|
||||
NS_IMETHOD GetValue(const char* *uri) const;
|
||||
NS_IMETHOD EqualsResource(const nsIRDFResource* resource, PRBool* result) const;
|
||||
NS_IMETHOD EqualsString(const char* uri, PRBool* result) const;
|
||||
|
||||
//nsIMsgRDFFolder
|
||||
// nsIMsgRDFFolder methods:
|
||||
NS_IMETHOD GetFolder(nsIMsgFolder * *aFolder);
|
||||
NS_IMETHOD SetFolder(nsIMsgFolder * aFolder);
|
||||
|
||||
// nsMsgRDFFolder methods:
|
||||
nsMsgRDFFolder(const char* uri);
|
||||
virtual ~nsMsgRDFFolder();
|
||||
|
||||
protected:
|
||||
nsIMsgFolder *mFolder;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user