KDECore
UnicodeGroupProber.h
Go to the documentation of this file.00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 00002 /* -*- C++ -*- 00003 * Copyright (C) 2008 <wkai@gmail.com> 00004 * 00005 * 00006 * Permission is hereby granted, free of charge, to any person obtaining 00007 * a copy of this software and associated documentation files (the 00008 * "Software"), to deal in the Software without restriction, including 00009 * without limitation the rights to use, copy, modify, merge, publish, 00010 * distribute, sublicense, and/or sell copies of the Software, and to 00011 * permit persons to whom the Software is furnished to do so, subject to 00012 * the following conditions: 00013 * 00014 * The above copyright notice and this permission notice shall be included 00015 * in all copies or substantial portions of the Software. 00016 * 00017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00018 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00019 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00020 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 00021 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 00022 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00023 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00024 */ 00025 00026 #ifndef UNICODEGROUPPROBER_H 00027 #define UNICODEGROUPPROBER_H 00028 00029 #include "nsCharSetProber.h" 00030 #include "nsCodingStateMachine.h" 00031 00032 #define NUM_OF_UNICODE_CHARSETS 3 00033 namespace kencodingprober { 00034 class KDE_NO_EXPORT UnicodeGroupProber: public nsCharSetProber { 00035 public: 00036 UnicodeGroupProber(void); 00037 virtual ~UnicodeGroupProber(void); 00038 nsProbingState HandleData(const char* aBuf, unsigned int aLen); 00039 const char* GetCharSetName() {return mDetectedCharset;}; 00040 nsProbingState GetState(void) {return mState;}; 00041 void Reset(void); 00042 float GetConfidence(); 00043 void SetOpion() {}; 00044 #ifdef DEBUG_PROBE 00045 void DumpStatus(); 00046 #endif 00047 00048 protected: 00049 void GetDistribution(unsigned int aCharLen, const char* aStr); 00050 00051 nsCodingStateMachine* mCodingSM[NUM_OF_UNICODE_CHARSETS] ; 00052 unsigned int mActiveSM; 00053 nsProbingState mState; 00054 const char * mDetectedCharset; 00055 }; 00056 } 00057 #endif /* UNICODEGROUPPROBER_H */ 00058