mastodon-cpp  0.104.0
tag.hpp
1 /* This file is part of mastodon-cpp.
2  * Copyright © 2018, 2019 tastytea <tastytea@tastytea.de>
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef MASTODON_CPP_EASY_TAG_HPP
18 #define MASTODON_CPP_EASY_TAG_HPP
19 
20 #include <string>
21 #include <cstdint>
22 
23 // If we are compiling mastodon-cpp, use another include path
24 #ifdef MASTODON_CPP
25  #include "mastodon-cpp.hpp"
26  #include "easy/entity.hpp"
27 #else
28  #include <mastodon-cpp/mastodon-cpp.hpp>
29  #include <mastodon-cpp/easy/entity.hpp>
30 #endif
31 
32 using std::string;
33 using std::uint64_t;
34 
35 namespace Mastodon
36 {
37 namespace Easy
38 {
44  class Tag : public Entity
45  {
46  public:
52  class History : public Easy::Entity
53  {
54  public:
55  using Entity::Entity;
56 
57  virtual bool valid() const override;
58 
64  uint64_t accounts();
65 
71  const Easy::time day();
72 
78  uint64_t uses();
79  };
80 
81  using Entity::Entity;
82 
83  virtual bool valid() const override;
84 
90  const string name() const;
91 
97  const string url() const;
98 
104  const std::vector<History> history() const;
105 };
106 }
107 }
108 
109 #endif // MASTODON_CPP_EASY_TAG_HPP
Class to hold tags.
Definition: tag.hpp:44
Entity()
Constructs an empty Entity object.
Definition: entity.cpp:42
const std::vector< History > history() const
Returns the history of the tag.
Definition: tag.cpp:47
Class to hold Tag history.
Definition: tag.hpp:52
uint64_t uses()
Returns the number of accounts using that hashtag.
Definition: tag.cpp:94
const Easy::time day()
Returns the day.
Definition: tag.cpp:80
uint64_t accounts()
Returns the number of accounts using that hashtag.
Definition: tag.cpp:75
const string name() const
Returns the name of the tag.
Definition: tag.cpp:37
Collection of things to interface with server software that implements the Mastodon API...
Definition: mastodon-cpp.hpp:52
Base class for all entities.
Definition: entity.hpp:41
virtual bool valid() const override
Returns true if the Entity holds valid data.
Definition: tag.cpp:26
virtual bool valid() const override
Returns true if the Entity holds valid data.
Definition: tag.cpp:63
Type for time. Converts to time_point and string.
Definition: types_easy.hpp:155
const string url() const
Returns the URL of the tag.
Definition: tag.cpp:42