Program Listing for File libxml_dumper.h

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

/*
 * Copyright 2018 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_LIBXML_DUMPER_H
#define KIWIX_LIBXML_DUMPER_H

#include <string>
#include <vector>

#include <pugixml.hpp>

#include "library.h"

namespace kiwix
{

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

  std::string dumpLibXMLContent(const std::vector<std::string>& bookIds);


  std::string dumpLibXMLBookmark();

  void setBaseDir(const std::string& baseDir) { this->baseDir = baseDir; }

  void setLibrary(const Library* library) { this->library = library; }

 protected:
  const kiwix::Library* library;
  std::string baseDir;
 private:
  void handleBook(Book book, pugi::xml_node root_node);
  void handleBookmark(Bookmark bookmark, pugi::xml_node root_node);
};
}

#endif // KIWIX_OPDS_DUMPER_H