KMime::CharFreq

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:

Definition at line 78 of file kmime_charfreq.h.

Member Enumeration Documentation

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 50 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 68 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:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Jul 11 2020 23:11:42 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.