/usr/include/zim/article.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 | /*
* 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_ARTICLE_H
#define ZIM_ARTICLE_H
#include <string>
#include <zim/zim.h>
#include <zim/dirent.h>
#include <zim/file.h>
#include <limits>
#include <iosfwd>
namespace zim
{
class Article
{
private:
File file;
size_type idx;
public:
Article()
: idx(std::numeric_limits<size_type>::max())
{ }
Article(const File& file_, size_type idx_)
: file(file_),
idx(idx_)
{ }
Dirent getDirent() const { return const_cast<File&>(file).getDirent(idx); }
std::string getParameter() const { return getDirent().getParameter(); }
std::string getTitle() const { return getDirent().getTitle(); }
std::string getUrl() const { return getDirent().getUrl(); }
std::string getLongUrl() const { return getDirent().getLongUrl(); }
uint16_t getLibraryMimeType() const { return getDirent().getMimeType(); }
const std::string&
getMimeType() const { return file.getMimeType(getLibraryMimeType()); }
bool isRedirect() const { return getDirent().isRedirect(); }
bool isLinktarget() const { return getDirent().isLinktarget(); }
bool isDeleted() const { return getDirent().isDeleted(); }
char getNamespace() const { return getDirent().getNamespace(); }
size_type getRedirectIndex() const { return getDirent().getRedirectIndex(); }
Article getRedirectArticle() const { return Article(file, getRedirectIndex()); }
size_type getArticleSize() const;
bool operator< (const Article& a) const
{ return getNamespace() < a.getNamespace()
|| (getNamespace() == a.getNamespace()
&& getTitle() < a.getTitle()); }
Cluster getCluster() const
{ return file.getCluster(getDirent().getClusterNumber()); }
Blob getData() const
{
Dirent dirent = getDirent();
return isRedirect()
|| isLinktarget()
|| isDeleted() ? Blob()
: const_cast<File&>(file).getBlob(dirent.getClusterNumber(), dirent.getBlobNumber());
}
std::string getPage(bool layout = true, unsigned maxRecurse = 10);
void getPage(std::ostream&, bool layout = true, unsigned maxRecurse = 10);
const File& getFile() const { return file; }
File& getFile() { return file; }
size_type getIndex() const { return idx; }
bool good() const { return idx != std::numeric_limits<size_type>::max(); }
};
}
#endif // ZIM_ARTICLE_H
|