libkdenetwork Library API Documentation

kmime_charfreq.h

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 program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011     You should have received a copy of the GNU General Public License
00012     along with this program; if not, write to the Free Software Foundation,
00013     Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, US
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;       // count of NUL chars
00050   uint CTL;       // count of CTLs (incl. DEL, excl. CR, LF, HT)
00051   uint CR, LF;    // count of CRs and LFs
00052   uint CRLF;      // count of LFs, preceded by CRs
00053   uint printable; // count of printable US-ASCII chars (SPC..~)
00054   uint eightBit;  // count of other latin1 chars (those with 8th bit set)
00055   uint total;
00056   uint lineMin;
00057   uint lineMax;
00058   bool mTrailingWS;  // does the buffer contain trailing whitespace?
00059   bool mLeadingFrom; // does the buffer contain lines starting with "From "?
00060 
00061 private:
00062   void count( const char * buf, size_t len );
00063 };
00064 
00065 } // namespace KMime
00066 
00067 #endif /* __KMIME_CHARFREQ_H__ */
KDE Logo
This file is part of the documentation for libkdenetwork Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 25 11:16:57 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003