• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • kdecore
  • localization
  • probers
nsCharSetProber.h
Go to the documentation of this file.
1/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* -*- C++ -*-
3* Copyright (C) 1998 <developer@mozilla.org>
4*
5*
6* Permission is hereby granted, free of charge, to any person obtaining
7* a copy of this software and associated documentation files (the
8* "Software"), to deal in the Software without restriction, including
9* without limitation the rights to use, copy, modify, merge, publish,
10* distribute, sublicense, and/or sell copies of the Software, and to
11* permit persons to whom the Software is furnished to do so, subject to
12* the following conditions:
13*
14* The above copyright notice and this permission notice shall be included
15* in all copies or substantial portions of the Software.
16*
17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24*/
25
26#ifndef nsCharSetProber_h__
27#define nsCharSetProber_h__
28
29#include "kencodingprober.h"
30
31#include "kdemacros.h"
32
33namespace kencodingprober {
34typedef enum {
35 eDetecting = 0, //We are still detecting, no sure answer yet, but caller can ask for confidence.
36 eFoundIt = 1, //That's a positive answer
37 eNotMe = 2 //Negative answer
38} nsProbingState;
39
40#define SHORTCUT_THRESHOLD (float)0.95
41
42class KDE_NO_EXPORT nsCharSetProber {
43public:
44 virtual ~nsCharSetProber() {};
45 virtual const char* GetCharSetName() = 0;
46 virtual nsProbingState HandleData(const char* aBuf, unsigned int aLen) = 0;
47 virtual nsProbingState GetState(void) = 0;
48 virtual void Reset(void) = 0;
49 virtual float GetConfidence(void) = 0;
50 virtual void SetOpion() = 0;
51
52#ifdef DEBUG_PROBE
53 virtual void DumpStatus() {};
54#endif
55
56 // Helper functions used in the Latin1 and Group probers.
57 // both functions Allocate a new buffer for newBuf. This buffer should be
58 // freed by the caller using PR_FREEIF.
59 // Both functions return false in case of memory allocation failure.
60 static bool FilterWithoutEnglishLetters(const char* aBuf, unsigned int aLen, char** newBuf, unsigned int& newLen);
61 static bool FilterWithEnglishLetters(const char* aBuf, unsigned int aLen, char** newBuf, unsigned int& newLen);
62
63};
64}
65#endif /* nsCharSetProber_h__ */
kencodingprober::nsCharSetProber
Definition: nsCharSetProber.h:42
kencodingprober::nsCharSetProber::Reset
virtual void Reset(void)=0
kencodingprober::nsCharSetProber::SetOpion
virtual void SetOpion()=0
kencodingprober::nsCharSetProber::~nsCharSetProber
virtual ~nsCharSetProber()
Definition: nsCharSetProber.h:44
kencodingprober::nsCharSetProber::HandleData
virtual nsProbingState HandleData(const char *aBuf, unsigned int aLen)=0
kencodingprober::nsCharSetProber::GetConfidence
virtual float GetConfidence(void)=0
kencodingprober::nsCharSetProber::GetCharSetName
virtual const char * GetCharSetName()=0
kencodingprober::nsCharSetProber::GetState
virtual nsProbingState GetState(void)=0
kencodingprober.h
kencodingprober
Definition: CharDistribution.cpp:37
kencodingprober::nsProbingState
nsProbingState
Definition: nsCharSetProber.h:34
kencodingprober::eNotMe
@ eNotMe
Definition: nsCharSetProber.h:37
kencodingprober::eFoundIt
@ eFoundIt
Definition: nsCharSetProber.h:36
kencodingprober::eDetecting
@ eDetecting
Definition: nsCharSetProber.h:35
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal