libkmime
kmime_charfreq.h00001
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 #include <kdepimmacros.h>
00020 #undef None
00021
00022 namespace KMime {
00023
00024 class KDE_EXPORT CharFreq {
00025 public:
00026 CharFreq( const QByteArray & buf );
00027 CharFreq( const char * buf, size_t len );
00028
00029 enum Type { None = 0, EightBitData, Binary = EightBitData,
00030 SevenBitData, EightBitText, SevenBitText };
00031
00032 Type type() const;
00033 bool isEightBitData() const;
00034 bool isEightBitText() const;
00035 bool isSevenBitData() const;
00036 bool isSevenBitText() const;
00039 bool hasTrailingWhitespace() const;
00041 bool hasLeadingFrom() const;
00044 float printableRatio() const;
00047 float controlCodesRatio() const;
00048
00049 protected:
00050 uint NUL;
00051 uint CTL;
00052 uint CR, LF;
00053 uint CRLF;
00054 uint printable;
00055 uint eightBit;
00056 uint total;
00057 uint lineMin;
00058 uint lineMax;
00059 bool mTrailingWS;
00060 bool mLeadingFrom;
00061
00062 private:
00063 void count( const char * buf, size_t len );
00064 };
00065
00066 }
00067
00068 #endif
|