"SfR Fresh" - the SfR Freeware/Shareware Archive

Member "pan-0.133/pan/data-impl/article-filter.h" of archive pan-0.133.tar.gz:


As a special service "SfR Fresh" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
    1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
    2 /*
    3  * Pan - A Newsreader for Gtk+
    4  * Copyright (C) 2002-2006  Charles Kerr <charles@rebelbase.com>
    5  *
    6  * This program is free software; you can redistribute it and/or modify
    7  * it under the terms of the GNU General Public License as published by
    8  * the Free Software Foundation; version 2 of the License.
    9  *
   10  * This program is distributed in the hope that it will be useful,
   11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   13  * GNU General Public License for more details.
   14  *
   15  * You should have received a copy of the GNU General Public License
   16  * along with this program; if not, write to the Free Software
   17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   18  */
   19 
   20 #ifndef __ArticleFilter_h__
   21 #define __ArticleFilter_h__
   22 
   23 #include <pan/general/quark.h>
   24 #include <pan/usenet-utils/filter-info.h>
   25 #include <pan/usenet-utils/scorefile.h>
   26 #include <pan/data/article.h>
   27 #include <pan/data/data.h>
   28 
   29 namespace pan
   30 {
   31   /**
   32    * This private class should only be used by data-impl classes.
   33    *
   34    * It's used for implementing article filters as described by
   35    * FilterInfo in the 'backend interfaces' module.
   36    *
   37    * @ingroup data_impl
   38    */
   39   class ArticleFilter
   40   {
   41     private:
   42 
   43       const Quark subject;
   44       const Quark from;
   45       const Quark xref;
   46       const Quark references;
   47       const Quark newsgroups;
   48       const Quark message_Id;
   49       const Quark message_ID;
   50 
   51       const StringView get_header (const Article& a, const Quark& header_name) const;
   52 
   53     public:
   54 
   55       ArticleFilter():
   56         subject("Subject"),
   57         from("From"),
   58         xref("Xref"),
   59         references("References"),
   60         newsgroups("Newsgroups"),
   61         message_Id("Message-Id"),
   62         message_ID("Message-ID")
   63       {
   64       }
   65 
   66       typedef std::vector<const Article*> articles_t;
   67 
   68       void test_articles (const Data& data,
   69                           const FilterInfo& criteria,
   70                           const Quark& group,
   71                           const articles_t& in,
   72                           articles_t& setme_pass,
   73                           articles_t& setme_fail) const;
   74 
   75       bool test_article (const Data& data,
   76                          const FilterInfo& criteria,
   77                          const Quark& group,
   78                          const Article& article) const;
   79 
   80       typedef std::vector<const Scorefile::Section*> sections_t;
   81 
   82       int score_article (const Data& data,
   83                          const sections_t& score,
   84                          const Quark& group,
   85                          const Article& article) const;
   86 
   87       void get_article_scores (const Data          & data,
   88                                const sections_t    & score,
   89                                const Quark         & group,
   90                                const Article       & article,
   91                                Scorefile::items_t  & setme) const;
   92   };
   93 }
   94 
   95 #endif