• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDECore

nsCharSetProber.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 nsCharSetProber_h__
00027 #define nsCharSetProber_h__
00028 
00029 #include "kencodingprober.h"
00030 
00031 #include "kdemacros.h"
00032 
00033 namespace kencodingprober {
00034 typedef enum {
00035   eDetecting = 0,   //We are still detecting, no sure answer yet, but caller can ask for confidence.
00036   eFoundIt = 1,     //That's a positive answer
00037   eNotMe = 2        //Negative answer
00038 } nsProbingState;
00039 
00040 #define SHORTCUT_THRESHOLD      (float)0.95
00041 
00042 class KDE_NO_EXPORT nsCharSetProber {
00043 public:
00044   virtual ~nsCharSetProber() {};
00045   virtual const char* GetCharSetName() = 0;
00046   virtual nsProbingState HandleData(const char* aBuf, unsigned int aLen) = 0;
00047   virtual nsProbingState GetState(void) = 0;
00048   virtual void      Reset(void)  = 0;
00049   virtual float     GetConfidence(void) = 0;
00050   virtual void      SetOpion() = 0;
00051 
00052 #ifdef DEBUG_PROBE
00053   virtual void  DumpStatus() {};
00054 #endif
00055 
00056   // Helper functions used in the Latin1 and Group probers.
00057   // both functions Allocate a new buffer for newBuf. This buffer should be 
00058   // freed by the caller using PR_FREEIF.
00059   // Both functions return false in case of memory allocation failure.
00060   static bool FilterWithoutEnglishLetters(const char* aBuf, unsigned int aLen, char** newBuf, unsigned int& newLen);
00061   static bool FilterWithEnglishLetters(const char* aBuf, unsigned int aLen, char** newBuf, unsigned int& newLen);
00062 
00063 };
00064 }
00065 #endif /* nsCharSetProber_h__ */

KDECore

Skip menu "KDECore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal