This file is indexed.

/usr/include/zim/fileiterator.h is in libzim-dev 1.1-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
/*
 * Copyright (C) 2006 Tommi Maekitalo
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * is provided AS IS, WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and
 * NON-INFRINGEMENT.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 *
 */

#ifndef ZIM_FILEITERATOR_H
#define ZIM_FILEITERATOR_H

#include <iterator>
#include <zim/article.h>

namespace zim
{
  class File::const_iterator : public std::iterator<std::bidirectional_iterator_tag, Article>
  {
    public:
      enum Mode {
        UrlIterator,
        ArticleIterator
      };

    private:
      File* file;
      size_type idx;
      mutable Article article;
      Mode mode;

      bool is_end() const  { return file == 0 || idx >= file->getCountArticles(); }

    public:
      explicit const_iterator(File* file_ = 0, size_type idx_ = 0, Mode mode_ = UrlIterator)
        : file(file_),
          idx(idx_),
          mode(mode_)
      { }

      size_type getIndex() const   { return idx; }
      const File& getFile() const  { return *file; }

      bool operator== (const const_iterator& it) const
        { return (is_end() && it.is_end())
              || (file == it.file && idx == it.idx); }
      bool operator!= (const const_iterator& it) const
        { return !operator==(it); }

      const_iterator& operator++()
      {
        ++idx;
        article = Article();
        return *this;
      }

      const_iterator operator++(int)
      {
        const_iterator it = *this;
        operator++();
        return it;
      }

      const_iterator& operator--()
      {
        --idx;
        article = Article();
        return *this;
      }

      const_iterator operator--(int)
      {
        const_iterator it = *this;
        operator--();
        return it;
      }

      const Article& operator*() const
      {
        if (!article.good())
          article = mode == UrlIterator ? file->getArticle(idx)
                                        : file->getArticleByTitle(idx);
        return article;
      }

      pointer operator->() const
      {
        operator*();
        return &article;
      }

  };

}

#endif // ZIM_FILEITERATOR_H