| 1 | /* -*- C++ -*- |
| 2 | SPDX-FileCopyrightText: 1998 Netscape Communications Corporation <developer@mozilla.org> |
| 3 | |
| 4 | SPDX-License-Identifier: MIT |
| 5 | */ |
| 6 | |
| 7 | #ifndef nsLatin1Prober_h__ |
| 8 | #define nsLatin1Prober_h__ |
| 9 | |
| 10 | #include "nsCharSetProber.h" |
| 11 | |
| 12 | #define FREQ_CAT_NUM 4 |
| 13 | namespace kencodingprober |
| 14 | { |
| 15 | class KCODECS_NO_EXPORT nsLatin1Prober : public nsCharSetProber |
| 16 | { |
| 17 | public: |
| 18 | nsLatin1Prober(void) |
| 19 | { |
| 20 | Reset(); |
| 21 | } |
| 22 | ~nsLatin1Prober(void) override |
| 23 | { |
| 24 | } |
| 25 | nsProbingState HandleData(const char *aBuf, unsigned int aLen) override; |
| 26 | const char *GetCharSetName() override |
| 27 | { |
| 28 | return "windows-1252" ; |
| 29 | } |
| 30 | nsProbingState GetState(void) override |
| 31 | { |
| 32 | return mState; |
| 33 | } |
| 34 | void Reset(void) override; |
| 35 | float GetConfidence(void) override; |
| 36 | |
| 37 | #ifdef DEBUG_PROBE |
| 38 | void DumpStatus() override; |
| 39 | #endif |
| 40 | |
| 41 | protected: |
| 42 | nsProbingState mState; |
| 43 | char mLastCharClass; |
| 44 | unsigned int mFreqCounter[FREQ_CAT_NUM]; |
| 45 | }; |
| 46 | } |
| 47 | |
| 48 | #endif /* nsLatin1Prober_h__ */ |
| 49 | |