~efargaspro/+junk/codeblocks-16.01-release

« back to all changes in this revision

Viewing changes to src/include/mozilla_chardet/nsGB2312Prober.h

  • Committer: damienlmoore at gmail
  • Date: 2016-02-02 02:43:22 UTC
  • Revision ID: damienlmoore@gmail.com-20160202024322-yql5qmtbwdyamdwd
Code::BlocksĀ 16.01

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 
2
/* This Source Code Form is subject to the terms of the Mozilla Public
 
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
5
 
 
6
#ifndef nsGB2312Prober_h__
 
7
#define nsGB2312Prober_h__
 
8
 
 
9
#include "nsCharSetProber.h"
 
10
#include "nsCodingStateMachine.h"
 
11
#include "CharDistribution.h"
 
12
 
 
13
// We use gb18030 to replace gb2312, because 18030 is a superset. 
 
14
 
 
15
class nsGB18030Prober: public nsCharSetProber {
 
16
public:
 
17
  nsGB18030Prober(bool aIsPreferredLanguage)
 
18
    :mIsPreferredLanguage(aIsPreferredLanguage)
 
19
  {mCodingSM = new nsCodingStateMachine(&GB18030SMModel);
 
20
    Reset();}
 
21
  virtual ~nsGB18030Prober(void){delete mCodingSM;}
 
22
  nsProbingState HandleData(const char* aBuf, uint32_t aLen);
 
23
  const char* GetCharSetName() {return "gb18030";}
 
24
  nsProbingState GetState(void) {return mState;}
 
25
  void      Reset(void);
 
26
  float     GetConfidence(void);
 
27
 
 
28
protected:
 
29
  void      GetDistribution(uint32_t aCharLen, const char* aStr);
 
30
  
 
31
  nsCodingStateMachine* mCodingSM;
 
32
  nsProbingState mState;
 
33
 
 
34
  //GB2312ContextAnalysis mContextAnalyser;
 
35
  GB2312DistributionAnalysis mDistributionAnalyser;
 
36
  char mLastChar[2];
 
37
  bool mIsPreferredLanguage;
 
38
 
 
39
};
 
40
 
 
41
 
 
42
#endif /* nsGB2312Prober_h__ */
 
43