stamd

Static Markdown Page Generator
git clone git://git.dimitrijedobrota.com/stamd.git
Log | Files | Refs | README | LICENSE

indexer.hpp (893B)


      1 #pragma once
      2 
      3 #include <memory>
      4 #include <string>
      5 #include <vector>
      6 
      7 #include "article.hpp"
      8 #include "options.hpp"
      9 
     10 namespace stamd {
     11 
     12 class Indexer
     13 {
     14 public:
     15   using article_s = std::shared_ptr<Article>;
     16 
     17   using article_list = std::vector<article_s>;
     18   using categories_t = Article::categories_t;
     19 
     20   explicit Indexer(options_t options)
     21       : m_options(std::move(options))
     22   {
     23   }
     24 
     25   void add(const article_s& article);
     26   void add(categories_t categories);
     27 
     28   void sort();
     29 
     30   void create_robots(std::ostream& ost) const;
     31   void create_sitemap(std::ostream& ost) const;
     32 
     33   void create_atom(std::ostream& ost, const std::string& name) const;
     34   void create_rss(std::ostream& ost, const std::string& name) const;
     35   void create_index(std::ostream& ost, const std::string& name);
     36 
     37 private:
     38   options_t m_options;
     39   categories_t m_categories;
     40 
     41   article_list m_articles;
     42 };
     43 
     44 }  // namespace stamd