.. _program_listing_file_include_search_renderer.h: Program Listing for File search_renderer.h ========================================== |exhale_lsh| :ref:`Return to documentation for file ` (``include/search_renderer.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* * Copyright 2011 Emmanuel Engelhart * * 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_SEARCH_RENDERER_H #define KIWIX_SEARCH_RENDERER_H #include #include #include "library.h" namespace kiwix { class NameMapper; class SearchRenderer { public: SearchRenderer(zim::SearchResultSet srs, unsigned int start, unsigned int estimatedResultCount); ~SearchRenderer(); void setSearchPattern(const std::string& pattern); void setSearchBookQuery(const std::string& bookQuery); void setProtocolPrefix(const std::string& prefix); void setSearchProtocolPrefix(const std::string& prefix); void setPageLength(unsigned int pageLength){ this->pageLength = pageLength; } void setUserLang(const std::string& lang){ this->userlang = lang; } std::string getHtml(const NameMapper& mapper, const Library* library); std::string getXml(const NameMapper& mapper, const Library* library); protected: // function std::string renderTemplate(const std::string& tmpl_str, const NameMapper& mapper, const Library *library); protected: std::string beautifyInteger(const unsigned int number); zim::SearchResultSet m_srs; std::string searchBookQuery; std::string searchPattern; std::string protocolPrefix; std::string searchProtocolPrefix; unsigned int pageLength; unsigned int estimatedResultCount; unsigned int resultStart; std::string userlang = "en"; }; } #endif