Bug 1490212 - Remove the *XPCOMStringDetector classes. r=hsivonen

This commit is contained in:
Jorg K 2018-09-12 10:11:00 +03:00
Родитель 4999563d5f
Коммит 2ed840c40b
4 изменённых файлов: 0 добавлений и 118 удалений

Просмотреть файл

@ -89,42 +89,3 @@ void nsXPCOMDetector::Report(const char* aCharset)
#endif
mObserver->Notify(aCharset, eBestAnswer);
}
//---------------------------------------------------------------------
nsXPCOMStringDetector:: nsXPCOMStringDetector()
: nsUniversalDetector()
{
}
//---------------------------------------------------------------------
nsXPCOMStringDetector::~nsXPCOMStringDetector()
{
}
//---------------------------------------------------------------------
NS_IMPL_ISUPPORTS(nsXPCOMStringDetector, nsIStringCharsetDetector)
//---------------------------------------------------------------------
void nsXPCOMStringDetector::Report(const char *aCharset)
{
mResult = aCharset;
#ifdef DEBUG_chardet
printf("New Charset Prober report charset %s . \r\n", aCharset);
#endif
}
//---------------------------------------------------------------------
NS_IMETHODIMP nsXPCOMStringDetector::DoIt(const char* aBuf,
uint32_t aLen, const char** oCharset,
nsDetectionConfident &oConf)
{
mResult = nullptr;
this->Reset();
nsresult rv = this->HandleData(aBuf, aLen);
if (NS_FAILED(rv))
return rv;
this->DataEnd();
if (mResult)
{
*oCharset=mResult;
oConf = eBestAnswer;
}
return NS_OK;
}

Просмотреть файл

@ -39,25 +39,6 @@ class nsXPCOMDetector :
nsCOMPtr<nsICharsetDetectionObserver> mObserver;
};
//=====================================================================
class nsXPCOMStringDetector :
public nsUniversalDetector,
public nsIStringCharsetDetector
{
NS_DECL_ISUPPORTS
public:
nsXPCOMStringDetector();
NS_IMETHOD DoIt(const char* aBuf, uint32_t aLen,
const char** oCharset, nsDetectionConfident &oConf) override;
protected:
virtual ~nsXPCOMStringDetector();
virtual void Report(const char* aCharset) override;
private:
nsCOMPtr<nsICharsetDetectionObserver> mObserver;
const char* mResult;
};
//=====================================================================
class nsJAPSMDetector final : public nsXPCOMDetector

Просмотреть файл

@ -16,7 +16,6 @@
//----------------------------------------------------------------------
// Interface nsISupports [implementation]
NS_IMPL_ISUPPORTS(nsCyrXPCOMDetector, nsICharsetDetector)
NS_IMPL_ISUPPORTS(nsCyrXPCOMStringDetector, nsIStringCharsetDetector)
void nsCyrillicDetector::HandleData(const char* aBuf, uint32_t aLen)
{
@ -124,38 +123,3 @@ void nsCyrXPCOMDetector::Report(const char* aCharset)
NS_ASSERTION(mObserver != nullptr , "have not init yet");
mObserver->Notify(aCharset, eBestAnswer);
}
//---------------------------------------------------------------------
nsCyrXPCOMStringDetector:: nsCyrXPCOMStringDetector(uint8_t aItems,
const uint8_t ** aCyrillicClass,
const char **aCharsets)
: nsCyrillicDetector(aItems, aCyrillicClass, aCharsets)
, mResult(nullptr)
{
}
//---------------------------------------------------------------------
nsCyrXPCOMStringDetector::~nsCyrXPCOMStringDetector()
{
}
//---------------------------------------------------------------------
void nsCyrXPCOMStringDetector::Report(const char *aCharset)
{
mResult = aCharset;
}
//---------------------------------------------------------------------
NS_IMETHODIMP nsCyrXPCOMStringDetector::DoIt(const char* aBuf, uint32_t aLen,
const char** oCharset, nsDetectionConfident &oConf)
{
mResult = nullptr;
mDone = false;
this->HandleData(aBuf, aLen);
this->DataEnd();
*oCharset=mResult;
oConf = eBestAnswer;
return NS_OK;
}

Просмотреть файл

@ -8,14 +8,10 @@
#include "nsCyrillicClass.h"
#include "nsIStringCharsetDetector.h"
// {2002F781-3960-11d3-B3C3-00805F8A6670}
#define NS_RU_PROBDETECTOR_CID \
{ 0x2002f781, 0x3960, 0x11d3, { 0xb3, 0xc3, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } }
// {2002F782-3960-11d3-B3C3-00805F8A6670}
#define NS_UK_PROBDETECTOR_CID \
{ 0x2002f782, 0x3960, 0x11d3, { 0xb3, 0xc3, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } }
@ -103,26 +99,6 @@ class nsCyrXPCOMDetector :
nsCOMPtr<nsICharsetDetectionObserver> mObserver;
};
class nsCyrXPCOMStringDetector :
public nsCyrillicDetector,
public nsIStringCharsetDetector
{
public:
// nsISupports interface
NS_DECL_ISUPPORTS
nsCyrXPCOMStringDetector(uint8_t aItems,
const uint8_t ** aCyrillicClass,
const char **aCharsets);
NS_IMETHOD DoIt(const char* aBuf, uint32_t aLen,
const char** oCharset, nsDetectionConfident &oConf) override;
protected:
virtual ~nsCyrXPCOMStringDetector();
virtual void Report(const char* aCharset) override;
private:
nsCOMPtr<nsICharsetDetectionObserver> mObserver;
const char* mResult;
};
class nsRUProbDetector final : public nsCyrXPCOMDetector
{
public: