File indexing completed on 2024-04-28 03:53:04
0001 /* -*- C++ -*- 0002 SPDX-FileCopyrightText: 2008 Wang Kai <wkai@gmail.com> 0003 0004 SPDX-License-Identifier: MIT 0005 */ 0006 0007 #ifndef UNICODEGROUPPROBER_H 0008 #define UNICODEGROUPPROBER_H 0009 0010 #include "nsCharSetProber.h" 0011 #include "nsCodingStateMachine.h" 0012 0013 #define NUM_OF_UNICODE_CHARSETS 3 0014 namespace kencodingprober 0015 { 0016 class KCODECS_NO_EXPORT UnicodeGroupProber : public nsCharSetProber 0017 { 0018 public: 0019 UnicodeGroupProber(void); 0020 ~UnicodeGroupProber(void) override; 0021 nsProbingState HandleData(const char *aBuf, unsigned int aLen) override; 0022 const char *GetCharSetName() override 0023 { 0024 return mDetectedCharset; 0025 } 0026 nsProbingState GetState(void) override 0027 { 0028 return mState; 0029 } 0030 void Reset(void) override; 0031 float GetConfidence() override; 0032 void SetOpion() override 0033 { 0034 } 0035 #ifdef DEBUG_PROBE 0036 void DumpStatus() override; 0037 #endif 0038 0039 protected: 0040 void GetDistribution(unsigned int aCharLen, const char *aStr); 0041 0042 nsCodingStateMachine *mCodingSM[NUM_OF_UNICODE_CHARSETS]; 0043 unsigned int mActiveSM; 0044 nsProbingState mState; 0045 const char *mDetectedCharset; 0046 }; 0047 } 0048 #endif /* UNICODEGROUPPROBER_H */