Program Listing for File opds_dumper.h

Return to documentation for file (include/opds_dumper.h)

/*
 * Copyright 2017 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 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 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 Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */

#ifndef KIWIX_OPDS_DUMPER_H
#define KIWIX_OPDS_DUMPER_H

#include <time.h>
#include <sstream>
#include <string>

#include <pugixml.hpp>

#include "library.h"

using namespace std;

namespace kiwix
{

class OPDSDumper
{
 public:
  OPDSDumper() = default;
  OPDSDumper(Library* library);
  ~OPDSDumper();

  std::string dumpOPDSFeed(const std::vector<std::string>& bookIds, const std::string& query) const;

  std::string dumpOPDSFeedV2(const std::vector<std::string>& bookIds, const std::string& query, bool partial) const;

  std::string dumpOPDSCompleteEntry(const std::string& bookId) const;

  std::string categoriesOPDSFeed() const;

  std::string languagesOPDSFeed() const;

  void setLibraryId(const std::string& id) { this->libraryId = id;}

  void setRootLocation(const std::string& rootLocation) { this->rootLocation = rootLocation; }

  void setOpenSearchInfo(int totalResult, int startIndex, int count);

 protected:
  kiwix::Library* library;
  std::string libraryId;
  std::string rootLocation;
  int m_totalResults;
  int m_startIndex;
  int m_count;
};
}

#endif // KIWIX_OPDS_DUMPER_H