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

KMIME Library

  • KMime
  • CharFreq
Public Types | Public Member Functions | List of all members
KMime::CharFreq Class Reference

#include <kmime_charfreq.h>

Public Types

enum  Type {
  None = 0, EightBitData, Binary = EightBitData, SevenBitData,
  EightBitText, SevenBitText
}
 

Public Member Functions

 CharFreq (const QByteArray &buf)
 
 CharFreq (const char *buf, size_t len)
 
float controlCodesRatio () const
 
bool hasLeadingFrom () const
 
bool hasTrailingWhitespace () const
 
bool isEightBitData () const
 
bool isEightBitText () const
 
bool isSevenBitData () const
 
bool isSevenBitText () const
 
float printableRatio () const
 
Type type () const
 

Detailed Description

A class for performing basic data typing using frequency count heuristics.

This class performs character frequency counts on the provided data which are used in heuristics to determine a basic data type. The data types are:

  • Eight-Bit-Binary
  • Eight-Bit-Text
  • Seven-Bit-Binary
  • Seven-Bit-Text

Definition at line 78 of file kmime_charfreq.h.

Member Enumeration Documentation

enum KMime::CharFreq::Type

The different types of data.

Enumerator
None 

Unknown.

EightBitData 

8bit binary

Binary 

8bit binary

SevenBitData 

7bit binary

EightBitText 

8bit text

SevenBitText 

7bit text

Definition at line 101 of file kmime_charfreq.h.

Constructor & Destructor Documentation

CharFreq::CharFreq ( const QByteArray &  buf)
explicit

Constructs a Character Frequency instance for a buffer buf of QByteArray data.

Private class that helps to provide binary compatibility between releases.

Parameters
bufis a QByteArray containing the data.

Definition at line 49 of file kmime_charfreq.cpp.

CharFreq::CharFreq ( const char *  buf,
size_t  len 
)

Constructs a Character Frequency instance for a buffer buf of chars of length len.

Parameters
bufis a pointer to a character string containing the data.
lenis the length of buf, in characters.

Definition at line 67 of file kmime_charfreq.cpp.

Member Function Documentation

float CharFreq::controlCodesRatio ( ) const

Returns the percentage of control code characters (CTLs) in the data.

The result is undefined if the number of data characters is zero.

Definition at line 244 of file kmime_charfreq.cpp.

bool CharFreq::hasLeadingFrom ( ) const

Returns true if the data contains a line that starts with "From ".

Definition at line 190 of file kmime_charfreq.cpp.

bool CharFreq::hasTrailingWhitespace ( ) const

Returns true if the data contains trailing whitespace.

i.e., if any line ends with space (' ') or tab ('\t').

Definition at line 185 of file kmime_charfreq.cpp.

bool CharFreq::isEightBitData ( ) const

Returns true if the data Type is EightBitData; false otherwise.

Definition at line 165 of file kmime_charfreq.cpp.

bool CharFreq::isEightBitText ( ) const

Returns true if the data Type is EightBitText; false otherwise.

Definition at line 170 of file kmime_charfreq.cpp.

bool CharFreq::isSevenBitData ( ) const

Returns true if the data Type is SevenBitData; false otherwise.

Definition at line 175 of file kmime_charfreq.cpp.

bool CharFreq::isSevenBitText ( ) const

Returns true if the data Type is SevenBitText; false otherwise.

Definition at line 180 of file kmime_charfreq.cpp.

float CharFreq::printableRatio ( ) const

Returns the percentage of printable characters in the data.

The result is undefined if the number of data characters is zero.

Definition at line 235 of file kmime_charfreq.cpp.

CharFreq::Type CharFreq::type ( ) const

Returns the data Type as derived from the class heuristics.

Definition at line 195 of file kmime_charfreq.cpp.


The documentation for this class was generated from the following files:
  • kmime_charfreq.h
  • kmime_charfreq.cpp
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