Scorum
comment.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 
6 namespace scorum {
7 namespace chain {
8 
9 struct comment_service_i : public base_service_i<comment_object>
10 {
13 
14  virtual const comment_object& get(const comment_id_type& comment_id) const = 0;
15  virtual const comment_object& get(const account_name_type& author, const std::string& permlink) const = 0;
16 
17  using comment_refs_type = std::vector<typename base_service_i::object_cref_type>;
18 
19  virtual comment_refs_type get_by_cashout_time(const fc::time_point_sec& until) const = 0;
20 
21  using checker_type = std::function<bool(const comment_object&)>;
22 
23  virtual comment_refs_type get_by_create_time(const fc::time_point_sec& until, const checker_type&) const = 0;
24 
25  virtual bool is_exists(const account_name_type& author, const std::string& permlink) const = 0;
26 
27  virtual comment_refs_type get_children(const account_name_type& parent_author,
28  const std::string& parent_permlink) const = 0;
29 
30  virtual void set_rewarded_flag(const comment_object& comment) = 0;
31 };
32 
33 class dbs_comment : public dbs_service_base<comment_service_i>
34 {
35  friend class dbservice_dbs_factory;
36 
37 protected:
38  explicit dbs_comment(database& db);
39 
40 public:
43 
44  const comment_object& get(const comment_id_type& comment_id) const override;
45  const comment_object& get(const account_name_type& author, const std::string& permlink) const override;
46 
47  comment_refs_type get_by_cashout_time(const fc::time_point_sec& until) const override;
48 
49  comment_refs_type get_by_create_time(const fc::time_point_sec& until, const checker_type&) const override;
50 
51  bool is_exists(const account_name_type& author, const std::string& permlink) const override;
52 
54  const std::string& parent_permlink) const override;
55 
56  void set_rewarded_flag(const comment_object& comment) override;
57 };
58 } // namespace chain
59 } // namespace scorum
tracks the blockchain state in an extensible manner
Definition: database.hpp:52
comment_refs_type get_by_create_time(const fc::time_point_sec &until, const checker_type &) const override
Definition: comment.cpp:47
comment_refs_type get_children(const account_name_type &parent_author, const std::string &parent_permlink) const override
Definition: comment.cpp:63
dbs_comment(database &db)
Definition: comment.cpp:14
void set_rewarded_flag(const comment_object &comment) override
Definition: comment.cpp:73
comment_refs_type get_by_cashout_time(const fc::time_point_sec &until) const override
Definition: comment.cpp:37
virtual const object_type & get() const override
fc::fixed_string_16 account_name_type
Definition: types.hpp:62
Definition: asset.cpp:15
std::vector< typename base_service_i::object_cref_type > comment_refs_type
Definition: comment.hpp:17
virtual comment_refs_type get_by_cashout_time(const fc::time_point_sec &until) const =0
virtual comment_refs_type get_by_create_time(const fc::time_point_sec &until, const checker_type &) const =0
virtual comment_refs_type get_children(const account_name_type &parent_author, const std::string &parent_permlink) const =0
std::function< bool(const comment_object &)> checker_type
Definition: comment.hpp:21
virtual const comment_object & get(const comment_id_type &comment_id) const =0
virtual void set_rewarded_flag(const comment_object &comment)=0
virtual bool is_exists(const account_name_type &author, const std::string &permlink) const =0
virtual const comment_object & get(const account_name_type &author, const std::string &permlink) const =0