KDECore
nsHebrewProber.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) 1998 <developer@mozilla.org> 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 nsHebrewProber_h__ 00027 #define nsHebrewProber_h__ 00028 00029 #include "nsSBCharSetProber.h" 00030 namespace kencodingprober { 00031 // This prober doesn't actually recognize a language or a charset. 00032 // It is a helper prober for the use of the Hebrew model probers 00033 class KDE_NO_EXPORT nsHebrewProber: public nsCharSetProber 00034 { 00035 public: 00036 nsHebrewProber(void) :mLogicalProb(0), mVisualProb(0) { Reset(); } 00037 00038 virtual ~nsHebrewProber(void) {} 00039 virtual nsProbingState HandleData(const char* aBuf, unsigned int aLen); 00040 virtual const char* GetCharSetName(); 00041 virtual void Reset(void); 00042 00043 virtual nsProbingState GetState(void); 00044 00045 virtual float GetConfidence(void) { return (float)0.0; } 00046 virtual void SetOpion() {}; 00047 00048 void SetModelProbers(nsCharSetProber *logicalPrb, nsCharSetProber *visualPrb) 00049 { mLogicalProb = logicalPrb; mVisualProb = visualPrb; } 00050 00051 #ifdef DEBUG_PROBE 00052 virtual void DumpStatus(); 00053 #endif 00054 00055 protected: 00056 static bool isFinal(char c); 00057 static bool isNonFinal(char c); 00058 00059 int mFinalCharLogicalScore, mFinalCharVisualScore; 00060 00061 // The two last characters seen in the previous buffer. 00062 char mPrev, mBeforePrev; 00063 00064 // These probers are owned by the group prober. 00065 nsCharSetProber *mLogicalProb, *mVisualProb; 00066 }; 00067 } 00068 00165 #endif /* nsHebrewProber_h__ */