KMIME Library
kmime_charfreq.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00057 #ifndef __KMIME_CHARFREQ_H__
00058 #define __KMIME_CHARFREQ_H__
00059
00060 #include <QtCore/QByteArray>
00061 #include "kmime_export.h"
00062 #undef None
00063
00064 namespace KMime {
00065
00078 class KMIME_EXPORT CharFreq
00079 {
00080 public:
00087 explicit CharFreq( const QByteArray &buf );
00088
00096 CharFreq( const char *buf, size_t len );
00097
00101 enum Type {
00102 None = 0,
00103 EightBitData,
00104 Binary = EightBitData,
00105 SevenBitData,
00106 EightBitText,
00107 SevenBitText
00108 };
00109
00113 Type type() const;
00114
00118 bool isEightBitData() const;
00119
00123 bool isEightBitText() const;
00124
00128 bool isSevenBitData() const;
00129
00133 bool isSevenBitText() const;
00134
00139 bool hasTrailingWhitespace() const;
00140
00144 bool hasLeadingFrom() const;
00145
00150 float printableRatio() const;
00151
00156 float controlCodesRatio() const;
00157
00158 private:
00159
00160 uint mNUL;
00161 uint mCTL;
00162 uint mCR;
00163 uint mLF;
00164 uint mCRLF;
00165 uint mPrintable;
00166 uint mEightBit;
00167 uint mTotal;
00168 uint mLineMin;
00169 uint mLineMax;
00170 bool mTrailingWS;
00171 bool mLeadingFrom;
00172
00173
00180 void count( const char *buf, size_t len );
00181 };
00182
00183 }
00184
00185 #endif