YPC  0.2.0
paged_https_extractor.h
1 #pragma once
2 #include <boost/property_tree/json_parser.hpp>
3 #include <boost/property_tree/ptree.hpp>
4 #include <ff/util/ntobject.h>
5 #include <hpda/common/common.h>
6 #include <hpda/common/stream_policy.h>
7 #include <hpda/extractor/extractor_base.h>
8 
9 namespace hpda {
10 namespace extractor {
11 namespace internal {
12 class paged_https_extractor_impl : public extractor_base<std::string> {
13 public:
14  typedef std::function<std::string(const std::string &prefix, int next_index,
15  int page_limit)>
16  next_page_request_t;
17  typedef std::function<int(const boost::property_tree::ptree &tree)>
18  start_index_picker_t;
19  typedef std::function<int(const boost::property_tree::ptree &tree)>
20  end_index_picker_t;
21 
22  paged_https_extractor_impl(const std::string &domain, const std::string &path,
23  int page_limit, const next_page_request_t &func,
24  const start_index_picker_t &start_index_picker,
25  const end_index_picker_t &end_index_picker);
26 
27  virtual ~paged_https_extractor_impl();
28  virtual bool process();
29 
30  virtual std::string output_value();
31 
32 protected:
33  std::string request(const std::string &url);
34 
35 protected:
36  const std::string m_domain;
37  const std::string m_path;
38  int32_t m_index;
39  int32_t m_page_limit;
40  bool m_reach_end;
41  std::string m_response;
42  next_page_request_t m_next_page_request;
43  start_index_picker_t m_start_index_picker;
44  end_index_picker_t m_end_index_picker;
45 };
46 
47 } // namespace internal
48 
50 
51 } // namespace extractor
52 } // namespace hpda
hpda::extractor::internal::paged_https_extractor_impl
Definition: paged_https_extractor.h:12
hpda::extractor::internal::extractor_base
Definition: extractor_base.h:9