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

KDECore

kencodingdetector.h

Go to the documentation of this file.
00001 /*
00002     This file is part of the KDE libraries
00003 
00004     Copyright (C) 1999 Lars Knoll (knoll@mpi-hd.mpg.de)
00005     Copyright (C) 2007 Nick Shaforostoff (shafff@ukr.net)
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 
00022 */
00023 #ifndef KENCODINGDETECTOR_H
00024 #define KENCODINGDETECTOR_H
00025 
00026 #include <kdecore_export.h>
00027 #include <QtCore/QString>
00028 
00029 class QTextCodec;
00030 class QTextDecoder;
00031 class KEncodingDetectorPrivate;
00032 
00058 class KDECORE_EXPORT KEncodingDetector
00059 {
00060 public:
00061     enum EncodingChoiceSource
00062     {
00063         DefaultEncoding,
00064         AutoDetectedEncoding,
00065         BOM,
00066         EncodingFromXMLHeader,
00067         EncodingFromMetaTag,
00068         EncodingFromHTTPHeader,
00069         UserChosenEncoding
00070     };
00071 
00072     enum AutoDetectScript
00073     {
00074         None,
00075         SemiautomaticDetection,
00076         Arabic,
00077         Baltic,
00078         CentralEuropean,
00079         ChineseSimplified,
00080         ChineseTraditional,
00081         Cyrillic,
00082         Greek,
00083         Hebrew,
00084         Japanese,
00085         Korean,
00086         NorthernSaami,
00087         SouthEasternEurope,
00088         Thai,
00089         Turkish,
00090         Unicode,
00091         WesternEuropean
00092     };
00093 
00097     KEncodingDetector();
00098 
00102     KEncodingDetector(QTextCodec* codec, EncodingChoiceSource source, AutoDetectScript script=None);
00103     ~KEncodingDetector();
00104 
00105     //const QTextCodec* codec() const;
00106 
00110     bool setEncoding(const char *encoding, EncodingChoiceSource type);
00111 
00116     const char* encoding() const;
00117 
00118     bool visuallyOrdered() const;
00119 
00120 //     void setAutoDetectLanguage( const QString& );
00121 //     const QString& autoDetectLanguage() const;
00122 
00123     void setAutoDetectLanguage( AutoDetectScript );
00124     AutoDetectScript autoDetectLanguage() const;
00125 
00126     EncodingChoiceSource encodingChoiceSource() const;
00127 
00135     QString decode(const char *data, int len);
00136     QString decode(const QByteArray &data);
00137 
00138     //* You don't need to call analyze() if you use this method.
00148     QString decodeWithBuffering(const char *data, int len);
00149 
00154     QString flush();
00155 
00159     static AutoDetectScript scriptForName(const QString& lang);
00160     static QString nameForScript(AutoDetectScript);
00161     static bool hasAutoDetectionForScript(AutoDetectScript);
00162 
00163 protected:
00168     bool processNull(char* data,int length);
00169 
00177     bool errorsIfUtf8 (const char* data, int length);
00178 
00183     bool analyze (const char *data, int len);
00184 
00188     QTextDecoder* decoder();
00189 
00190 private:
00191     KEncodingDetectorPrivate* const d;
00192 };
00193 
00194 #endif

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
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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