00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
#ifndef __KMIME_CHARFREQ_H__
00016
#define __KMIME_CHARFREQ_H__
00017
00018
#include <qcstring.h>
00019
#undef None
00020
00021
namespace KMime {
00022
00023
class CharFreq {
00024
public:
00025 CharFreq(
const QByteArray & buf );
00026 CharFreq(
const char * buf, size_t len );
00027
00028
enum Type { None = 0, EightBitData, Binary = EightBitData,
00029 SevenBitData, EightBitText, SevenBitText };
00030
00031 Type type() const;
00032
bool isEightBitData() const;
00033
bool isEightBitText() const;
00034
bool isSevenBitData() const;
00035
bool isSevenBitText() const;
00038
bool hasTrailingWhitespace() const;
00040
bool hasLeadingFrom() const;
00043
float printableRatio() const;
00046
float controlCodesRatio() const;
00047
00048 protected:
00049 uint NUL;
00050 uint CTL;
00051 uint CR, LF;
00052 uint CRLF;
00053 uint printable;
00054 uint eightBit;
00055 uint total;
00056 uint lineMin;
00057 uint lineMax;
00058
bool mTrailingWS;
00059
bool mLeadingFrom;
00060
00061 private:
00062
void count( const
char * buf, size_t len );
00063 };
00064
00065 }
00066
00067 #endif