Program Listing for File item.h

Return to documentation for file (include/zim/item.h)

/*
 * Copyright (C) 2021 Veloman Yunkan
 * Copyright (C) 2020 Matthieu Gautier <mgautier@kymeria.fr>
 *
 * 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_ITEM_H
#define ZIM_ITEM_H

#include "zim.h"
#include "blob.h"
#include "entry.h"
#include <string>

namespace zim
{
  class LIBZIM_API Item : private Entry
  {
    public: // functions
      std::string getTitle() const { return Entry::getTitle(); }
      std::string getPath() const  { return Entry::getPath(); }
      std::string getMimetype() const;

      Blob getData(offset_type offset=0) const;

      Blob getData(offset_type offset, size_type size) const;

      size_type getSize() const;

      zim::ItemDataDirectAccessInfo getDirectAccessInformation() const;

      entry_index_type getIndex() const   { return Entry::getIndex(); }

#ifdef ZIM_PRIVATE
      cluster_index_type getClusterIndex() const;
      blob_index_type getBlobIndex() const;
#endif

    private: // functions
      explicit Item(const Entry& entry);
      friend class Entry;
  };

}

#endif // ZIM_ITEM_H