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
00051 #ifndef __KMIME_CHARFREQ_H__
00052 #define __KMIME_CHARFREQ_H__
00053
00054 #include <QtCore/QByteArray>
00055 #include "kmime_export.h"
00056 #undef None
00057
00058 namespace KMime {
00059
00072 class KMIME_EXPORT CharFreq
00073 {
00074 public:
00081 explicit CharFreq( const QByteArray &buf );
00082
00090 CharFreq( const char *buf, size_t len );
00091
00095 enum Type {
00096 None = 0,
00097 EightBitData,
00098 Binary = EightBitData,
00099 SevenBitData,
00100 EightBitText,
00101 SevenBitText
00102 };
00103
00107 Type type() const;
00108
00112 bool isEightBitData() const;
00113
00117 bool isEightBitText() const;
00118
00122 bool isSevenBitData() const;
00123
00127 bool isSevenBitText() const;
00128
00133 bool hasTrailingWhitespace() const;
00134
00138 bool hasLeadingFrom() const;
00139
00144 float printableRatio() const;
00145
00150 float controlCodesRatio() const;
00151
00152 private:
00153
00154 uint mNUL;
00155 uint mCTL;
00156 uint mCR;
00157 uint mLF;
00158 uint mCRLF;
00159 uint mPrintable;
00160 uint mEightBit;
00161 uint mTotal;
00162 uint mLineMin;
00163 uint mLineMax;
00164 bool mTrailingWS;
00165 bool mLeadingFrom;
00166
00167
00174 void count( const char *buf, size_t len );
00175 };
00176
00177 }
00178
00179 #endif