KMIME Library
kmime_charfreq.h
Go to the documentation of this file.
00001 /* -*- c++ -*- 00002 kmime_charfreq.h 00003 00004 KMime, the KDE Internet mail/usenet news message library. 00005 Copyright (c) 2001-2002 Marc Mutz <mutz@kde.org> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 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 //@cond PRIVATE 00160 uint mNUL; // count of NUL chars 00161 uint mCTL; // count of CTLs (incl. DEL, excl. CR, LF, HT) 00162 uint mCR; // count of CR chars 00163 uint mLF; // count of LF chars 00164 uint mCRLF; // count of LFs, preceded by CRs 00165 uint mPrintable; // count of printable US-ASCII chars (SPC..~) 00166 uint mEightBit; // count of other latin1 chars (those with 8th bit set) 00167 uint mTotal; // count of all chars 00168 uint mLineMin; // minimum line length 00169 uint mLineMax; // maximum line length 00170 bool mTrailingWS; // does the buffer contain trailing whitespace? 00171 bool mLeadingFrom; // does the buffer contain lines starting with "From "? 00172 //@endcond 00173 00180 void count( const char *buf, size_t len ); 00181 }; 00182 00183 } // namespace KMime 00184 00185 #endif /* __KMIME_CHARFREQ_H__ */
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon May 7 2012 23:55:58 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon May 7 2012 23:55:58 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.