зеркало из https://github.com/mozilla/gecko-dev.git
Bug #15655 module for mime. (replaces nsMimeFactory.cpp)
remove NS_New** factory method. minor cleanup r=rhp
This commit is contained in:
Родитель
188cca5cbf
Коммит
aa21bf142b
|
@ -19,42 +19,12 @@
|
|||
#include "mimecom.h"
|
||||
#include "modmimee.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsMimeConverter.h"
|
||||
#include "comi18n.h"
|
||||
#include "prmem.h"
|
||||
#include "plstr.h"
|
||||
|
||||
/*
|
||||
* This function will be used by the factory to generate an
|
||||
* mime object class object....
|
||||
*/
|
||||
nsresult NS_NewMimeConverter(nsIMimeConverter ** aInstancePtrResult)
|
||||
{
|
||||
/* note this new macro for assertions...they can take
|
||||
a string describing the assertion */
|
||||
//nsresult result = NS_OK;
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "nsnull ptr");
|
||||
if (nsnull != aInstancePtrResult)
|
||||
{
|
||||
nsMimeConverter *obj = new nsMimeConverter();
|
||||
if (obj)
|
||||
return obj->QueryInterface(nsIMimeConverter::GetIID(), (void**) aInstancePtrResult);
|
||||
else
|
||||
return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the object */
|
||||
}
|
||||
else
|
||||
return NS_ERROR_NULL_POINTER; /* aInstancePtrResult was NULL....*/
|
||||
}
|
||||
|
||||
/*
|
||||
* The following macros actually implement addref, release and
|
||||
* query interface for our component.
|
||||
*/
|
||||
NS_IMPL_ADDREF(nsMimeConverter)
|
||||
NS_IMPL_RELEASE(nsMimeConverter)
|
||||
NS_IMPL_QUERY_INTERFACE(nsMimeConverter, nsIMimeConverter::GetIID()); /* we need to pass in the interface ID of this interface */
|
||||
NS_IMPL_ISUPPORTS(nsMimeConverter, NS_GET_IID(nsIMimeConverter));
|
||||
|
||||
/*
|
||||
* nsMimeConverter definitions....
|
||||
|
@ -66,7 +36,7 @@ NS_IMPL_QUERY_INTERFACE(nsMimeConverter, nsIMimeConverter::GetIID()); /* we need
|
|||
nsMimeConverter::nsMimeConverter()
|
||||
{
|
||||
/* the following macro is used to initialize the ref counting data */
|
||||
NS_INIT_REFCNT();
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsMimeConverter::~nsMimeConverter()
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#ifndef nsMimeConverter_h_
|
||||
#define nsMimeConverter_h_
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsIMimeConverter.h"
|
||||
|
||||
|
@ -77,7 +78,4 @@ public:
|
|||
|
||||
};
|
||||
|
||||
/* this function will be used by the factory to generate an class access object....*/
|
||||
extern nsresult NS_NewMimeConverter(nsIMimeConverter **aInstancePtrResult);
|
||||
|
||||
#endif /* nsMimeConverter_h_ */
|
||||
|
|
|
@ -17,30 +17,13 @@
|
|||
*/
|
||||
|
||||
#include "msgCore.h" // precompiled header...
|
||||
#include "mimehdrs.h"
|
||||
#include "nsIMimeHeaders.h"
|
||||
|
||||
class nsMimeHeaders : public nsIMimeHeaders
|
||||
{
|
||||
public:
|
||||
nsMimeHeaders();
|
||||
virtual ~nsMimeHeaders();
|
||||
|
||||
/* this macro defines QueryInterface, AddRef and Release for this class */
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_DECL_NSIMIMEHEADERS
|
||||
|
||||
private:
|
||||
MimeHeaders * mHeaders;
|
||||
};
|
||||
|
||||
#include "nsMimeHeaders.h"
|
||||
|
||||
nsMimeHeaders::nsMimeHeaders() :
|
||||
mHeaders(nsnull)
|
||||
{
|
||||
/* the following macro is used to initialize the ref counting data */
|
||||
NS_INIT_REFCNT();
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsMimeHeaders::~nsMimeHeaders()
|
||||
|
@ -71,25 +54,3 @@ nsresult nsMimeHeaders::ExtractHeader(const char *headerName, PRBool getAllOfThe
|
|||
*_retval = MimeHeaders_get(mHeaders, headerName, PR_FALSE, getAllOfThem);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will be used by the factory to generate an
|
||||
* mime headers class object....
|
||||
*/
|
||||
nsresult NS_NewMimeHeaders(const nsIID &aIID, void ** aInstancePtrResult)
|
||||
{
|
||||
/* note this new macro for assertions...they can take
|
||||
a string describing the assertion */
|
||||
//nsresult result = NS_OK;
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "nsnull ptr");
|
||||
if (nsnull != aInstancePtrResult)
|
||||
{
|
||||
nsMimeHeaders *obj = new nsMimeHeaders();
|
||||
if (obj)
|
||||
return obj->QueryInterface(aIID, (void**) aInstancePtrResult);
|
||||
else
|
||||
return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the object */
|
||||
}
|
||||
else
|
||||
return NS_ERROR_NULL_POINTER; /* aInstancePtrResult was NULL....*/
|
||||
}
|
||||
|
|
|
@ -18,39 +18,13 @@
|
|||
#include "stdio.h"
|
||||
#include "mimecom.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsMimeObjectClassAccess.h"
|
||||
|
||||
/*
|
||||
* This function will be used by the factory to generate an
|
||||
* mime object class object....
|
||||
*/
|
||||
nsresult NS_NewMimeObjectClassAccess(nsIMimeObjectClassAccess ** aInstancePtrResult)
|
||||
{
|
||||
/* note this new macro for assertions...they can take
|
||||
a string describing the assertion */
|
||||
//nsresult result = NS_OK;
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "nsnull ptr");
|
||||
if (nsnull != aInstancePtrResult)
|
||||
{
|
||||
nsMimeObjectClassAccess *obj = new nsMimeObjectClassAccess();
|
||||
if (obj)
|
||||
return obj->QueryInterface(nsIMimeObjectClassAccess::GetIID(), (void**) aInstancePtrResult);
|
||||
else
|
||||
return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the object */
|
||||
}
|
||||
else
|
||||
return NS_ERROR_NULL_POINTER; /* aInstancePtrResult was NULL....*/
|
||||
}
|
||||
|
||||
/*
|
||||
* The following macros actually implement addref, release and
|
||||
* query interface for our component.
|
||||
*/
|
||||
NS_IMPL_ADDREF(nsMimeObjectClassAccess)
|
||||
NS_IMPL_RELEASE(nsMimeObjectClassAccess)
|
||||
NS_IMPL_QUERY_INTERFACE(nsMimeObjectClassAccess, nsIMimeObjectClassAccess::GetIID()); /* we need to pass in the interface ID of this interface */
|
||||
NS_IMPL_ISUPPORTS(nsMimeObjectClassAccess, NS_GET_IID(nsIMimeObjectClassAccess));
|
||||
|
||||
/*
|
||||
* nsMimeObjectClassAccess definitions....
|
||||
|
|
|
@ -25,14 +25,10 @@
|
|||
#ifndef nsMimeObjectClassAccess_h_
|
||||
#define nsMimeObjectClassAccess_h_
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsIMimeObjectClassAccess.h"
|
||||
|
||||
// {403B0540-B7C3-11d2-B35E-525400E2D63A}
|
||||
#define NS_MIME_OBJECT_CLASS_ACCESS_CID \
|
||||
{ 0x403b0540, 0xb7c3, 0x11d2, \
|
||||
{ 0xb3, 0x5e, 0x52, 0x54, 0x0, 0xe2, 0xd6, 0x3a } }
|
||||
|
||||
class nsMimeObjectClassAccess : public nsIMimeObjectClassAccess {
|
||||
public:
|
||||
nsMimeObjectClassAccess();
|
||||
|
@ -60,7 +56,4 @@ public:
|
|||
NS_IMETHOD GetmimeMultipartSignedClass(void **ptr);
|
||||
};
|
||||
|
||||
/* this function will be used by the factory to generate an class access object....*/
|
||||
extern nsresult NS_NewMimeObjectClassAccess(nsIMimeObjectClassAccess **aInstancePtrResult);
|
||||
|
||||
#endif /* nsMimeObjectClassAccess_h_ */
|
||||
|
|
|
@ -31,32 +31,12 @@
|
|||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
/* this function will be used by the factory to generate an RFC-822 Parser....*/
|
||||
nsresult NS_NewMimeURLUtils(nsIMimeURLUtils ** aInstancePtrResult)
|
||||
{
|
||||
/* note this new macro for assertions...they can take a string describing the assertion */
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "nsnull ptr");
|
||||
if (nsnull != aInstancePtrResult)
|
||||
{
|
||||
nsMimeURLUtils* utils = new nsMimeURLUtils();
|
||||
if (utils)
|
||||
return utils->QueryInterface(nsIMimeURLUtils::GetIID(), (void **)aInstancePtrResult);
|
||||
else
|
||||
return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the object */
|
||||
}
|
||||
else
|
||||
return NS_ERROR_NULL_POINTER; /* aInstancePtrResult was NULL....*/
|
||||
}
|
||||
|
||||
/* the following macros actually implement addref, release and query interface for our component. */
|
||||
NS_IMPL_ADDREF(nsMimeURLUtils)
|
||||
NS_IMPL_RELEASE(nsMimeURLUtils)
|
||||
NS_IMPL_QUERY_INTERFACE(nsMimeURLUtils, nsIMimeURLUtils::GetIID()); /* we need to pass in the interface ID of this interface */
|
||||
NS_IMPL_ISUPPORTS(nsMimeURLUtils, NS_GET_IID(nsIMimeURLUtils));
|
||||
|
||||
nsMimeURLUtils::nsMimeURLUtils()
|
||||
{
|
||||
/* the following macro is used to initialize the ref counting data */
|
||||
NS_INIT_REFCNT();
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsMimeURLUtils::~nsMimeURLUtils()
|
||||
|
|
|
@ -51,8 +51,4 @@ public:
|
|||
NS_IMETHOD ParseURL(const char *url, PRInt32 parts_requested, char **returnVal);
|
||||
};
|
||||
|
||||
|
||||
/* this function will be used by the factory to generate an RFC-822 Parser....*/
|
||||
extern nsresult NS_NewMimeURLUtils(nsIMimeURLUtils ** aInstancePtrResult);
|
||||
|
||||
#endif /* _nsMimeURLUtils_h__ */
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
*/
|
||||
|
||||
#include "msgCore.h" // precompiled header...
|
||||
#include "xp_core.h" // for FALSE
|
||||
#include "nsISupports.h"
|
||||
#include "nsIMsgHeaderParser.h"
|
||||
#include "nsMsgHeaderParser.h"
|
||||
#include "comi18n.h"
|
||||
#include "prmem.h"
|
||||
|
@ -81,10 +78,7 @@ nsMsgHeaderParser::~nsMsgHeaderParser()
|
|||
delete m_USAsciiToUtf8CharsetConverter;
|
||||
}
|
||||
|
||||
/* the following macros actually implement addref, release and query interface for our component. */
|
||||
NS_IMPL_ADDREF(nsMsgHeaderParser)
|
||||
NS_IMPL_RELEASE(nsMsgHeaderParser)
|
||||
NS_IMPL_QUERY_INTERFACE(nsMsgHeaderParser, nsIMsgHeaderParser::GetIID()); /* we need to pass in the interface ID of this interface */
|
||||
NS_IMPL_ISUPPORTS(nsMsgHeaderParser, NS_GET_IID(nsIMsgHeaderParser));
|
||||
|
||||
MimeCharsetConverterClass *nsMsgHeaderParser::GetUSAsciiToUtf8CharsetConverter()
|
||||
{
|
||||
|
|
|
@ -121,10 +121,6 @@
|
|||
MimeCharsetConverterClass *GetUSAsciiToUtf8CharsetConverter();
|
||||
protected:
|
||||
MimeCharsetConverterClass *m_USAsciiToUtf8CharsetConverter;
|
||||
private:
|
||||
};
|
||||
|
||||
/* this function will be used by the factory to generate an RFC-822 Parser....*/
|
||||
extern nsresult NS_NewHeaderParser(nsIMsgHeaderParser ** aInstancePtrResult);
|
||||
|
||||
#endif /* nsMSGRFCPARSER_h__ */
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
#include "mimecom.h"
|
||||
#include "modmimee.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsStreamConverter.h"
|
||||
#include "comi18n.h"
|
||||
#include "prmem.h"
|
||||
|
@ -343,30 +341,8 @@ nsStreamConverter::~nsStreamConverter()
|
|||
InternalCleanup();
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will be used by the factory to generate an
|
||||
* mime object class object....
|
||||
*/
|
||||
nsresult
|
||||
NS_NewStreamConverter(const nsIID &aIID, void ** aInstancePtrResult)
|
||||
{
|
||||
/* note this new macro for assertions...they can take
|
||||
a string describing the assertion */
|
||||
//nsresult result = NS_OK;
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "nsnull ptr");
|
||||
if (nsnull != aInstancePtrResult)
|
||||
{
|
||||
nsStreamConverter *obj = new nsStreamConverter();
|
||||
if (obj)
|
||||
return obj->QueryInterface(aIID, (void**) aInstancePtrResult);
|
||||
else
|
||||
return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the object */
|
||||
}
|
||||
else
|
||||
return NS_ERROR_NULL_POINTER; /* aInstancePtrResult was NULL....*/
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS3(nsStreamConverter, nsIStreamListener, nsIStreamConverter, nsIMimeStreamConverter)
|
||||
NS_IMPL_ISUPPORTS4(nsStreamConverter, nsIStreamListener, nsIStreamObserver, nsIStreamConverter, nsIMimeStreamConverter)
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// nsStreamConverter definitions....
|
||||
|
|
|
@ -84,7 +84,4 @@ private:
|
|||
PRBool mForwardInline;
|
||||
};
|
||||
|
||||
// factory method
|
||||
extern nsresult NS_NewStreamConverter(const nsIID &aIID, void ** aInstancePtrResult);
|
||||
|
||||
#endif /* nsStreamConverter_h_ */
|
||||
|
|
Загрузка…
Ссылка в новой задаче