• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

KMIME Library

  • sources
  • kde-4.14
  • kdepimlibs
  • kmime
kmime_charfreq.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  kmime_charfreq.h
3 
4  KMime, the KDE Internet mail/usenet news message library.
5  Copyright (c) 2001-2002 Marc Mutz <mutz@kde.org>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
57 #ifndef __KMIME_CHARFREQ_H__
58 #define __KMIME_CHARFREQ_H__
59 
60 #include <QtCore/QByteArray>
61 #include "kmime_export.h"
62 #undef None
63 
64 namespace KMime {
65 
78 class KMIME_EXPORT CharFreq
79 {
80  public:
87  explicit CharFreq( const QByteArray &buf );
88 
96  CharFreq( const char *buf, size_t len );
97 
101  enum Type {
102  None = 0,
103  EightBitData,
104  Binary = EightBitData,
105  SevenBitData,
106  EightBitText,
107  SevenBitText
108  };
109 
113  Type type() const;
114 
118  bool isEightBitData() const;
119 
123  bool isEightBitText() const;
124 
128  bool isSevenBitData() const;
129 
133  bool isSevenBitText() const;
134 
139  bool hasTrailingWhitespace() const;
140 
144  bool hasLeadingFrom() const;
145 
150  float printableRatio() const;
151 
156  float controlCodesRatio() const;
157 
158  private:
159  //@cond PRIVATE
160  uint mNUL; // count of NUL chars
161  uint mCTL; // count of CTLs (incl. DEL, excl. CR, LF, HT)
162  uint mCR; // count of CR chars
163  uint mLF; // count of LF chars
164  uint mCRLF; // count of LFs, preceded by CRs
165  uint mPrintable; // count of printable US-ASCII chars (SPC..~)
166  uint mEightBit; // count of other latin1 chars (those with 8th bit set)
167  uint mTotal; // count of all chars
168  uint mLineMin; // minimum line length
169  uint mLineMax; // maximum line length
170  bool mTrailingWS; // does the buffer contain trailing whitespace?
171  bool mLeadingFrom; // does the buffer contain lines starting with "From "?
172  //@endcond
173 
180  void count( const char *buf, size_t len );
181 };
182 
183 } // namespace KMime
184 
185 #endif /* __KMIME_CHARFREQ_H__ */
KMime::CharFreq::EightBitData
8bit binary
Definition: kmime_charfreq.h:103
KMime::CharFreq::SevenBitData
7bit binary
Definition: kmime_charfreq.h:105
KMime::CharFreq::EightBitText
8bit text
Definition: kmime_charfreq.h:106
QByteArray
KMime::CharFreq::Type
Type
The different types of data.
Definition: kmime_charfreq.h:101
KMime::CharFreq
A class for performing basic data typing using frequency count heuristics.
Definition: kmime_charfreq.h:78
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KMIME Library

Skip menu "KMIME Library"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2

Search



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