KCodecs

nsUniversalDetector.h
1/* -*- C++ -*-
2 SPDX-FileCopyrightText: 1998 Netscape Communications Corporation <developer@mozilla.org>
3 SPDX-FileCopyrightText: 2008 Wang Kai <zealot.kai@gmail.com>
4
5 SPDX-License-Identifier: MIT
6*/
7
8#ifndef nsUniversalDetector_h__
9#define nsUniversalDetector_h__
10
11#include "nsCharSetProber.h"
12
13#define NUM_OF_CHARSET_PROBERS 3
14
15namespace kencodingprober
16{
17typedef enum {
18 ePureAscii = 0,
19 eEscAscii = 1,
20 eHighbyte = 2,
21} nsInputState;
22
23class KCODECS_NO_EXPORT nsUniversalDetector : public nsCharSetProber
24{
25public:
26 nsUniversalDetector();
27 ~nsUniversalDetector() override;
28 nsProbingState HandleData(const char *aBuf, unsigned int aLen) override;
29 const char *GetCharSetName() override;
30 void Reset(void) override;
31 float GetConfidence(void) override;
32 nsProbingState GetState() override;
33 void SetOpion() override
34 {
35 }
36
37protected:
38 nsInputState mInputState;
39 bool mDone;
40 bool mInTag;
41 bool mStart;
42 bool mGotData;
43 char mLastChar;
44 const char *mDetectedCharset;
45 int mBestGuess;
46
47 nsCharSetProber *mCharSetProbers[NUM_OF_CHARSET_PROBERS];
48 nsCharSetProber *mEscCharSetProber;
49};
50}
51
52#endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:08 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.