KMIME Library
#include <kmime_charfreq.h>
Public Types | |
enum | Type { None = 0 , EightBitData , Binary = EightBitData , SevenBitData , EightBitText , SevenBitText } |
Public Member Functions | |
CharFreq (const char *buf, size_t len) | |
CharFreq (const QByteArray &buf) | |
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
◆ 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() [1/2]
|
explicit |
Constructs a Character Frequency instance for a buffer buf
of QByteArray data.
Private class that helps to provide binary compatibility between releases.
- Parameters
-
buf is a QByteArray containing the data.
Definition at line 49 of file kmime_charfreq.cpp.
◆ CharFreq() [2/2]
Constructs a Character Frequency instance for a buffer buf
of chars of length len
.
- Parameters
-
buf is a pointer to a character string containing the data. len is the length of buf
, in characters.
Definition at line 67 of file kmime_charfreq.cpp.
Member Function Documentation
◆ controlCodesRatio()
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.
◆ hasLeadingFrom()
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.
◆ hasTrailingWhitespace()
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.
◆ isEightBitData()
bool CharFreq::isEightBitData | ( | ) | const |
Returns true if the data Type is EightBitData; false otherwise.
Definition at line 165 of file kmime_charfreq.cpp.
◆ isEightBitText()
bool CharFreq::isEightBitText | ( | ) | const |
Returns true if the data Type is EightBitText; false otherwise.
Definition at line 170 of file kmime_charfreq.cpp.
◆ isSevenBitData()
bool CharFreq::isSevenBitData | ( | ) | const |
Returns true if the data Type is SevenBitData; false otherwise.
Definition at line 175 of file kmime_charfreq.cpp.
◆ isSevenBitText()
bool CharFreq::isSevenBitText | ( | ) | const |
Returns true if the data Type is SevenBitText; false otherwise.
Definition at line 180 of file kmime_charfreq.cpp.
◆ printableRatio()
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.
◆ type()
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:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Jan 24 2024 00:00:00 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.