mastodon-cpp  0.21.0
results.hpp
1 /* This file is part of mastodon-cpp.
2  * Copyright © 2018 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_RESULTS_HPP
18 #define MASTODON_CPP_EASY_RESULTS_HPP
19 
20 #include <string>
21 #include <vector>
22 
23 // If we are compiling mastodon-cpp, use another include path
24 #ifdef MASTODON_CPP
25  #include "mastodon-cpp.hpp"
26  #include "easy/easy.hpp"
27  #include "easy/entities/account.hpp"
28  #include "easy/entities/status.hpp"
29  #include "easy/entities/tag.hpp"
30 #else
31  #include <mastodon-cpp/mastodon-cpp.hpp>
32  #include <mastodon-cpp/easy/easy.hpp>
33  #include <mastodon-cpp/easy/entities/account.hpp>
34  #include <mastodon-cpp/easy/entities/status.hpp>
35  #include <mastodon-cpp/easy/entities/tag.hpp>
36 #endif
37 
38 using std::string;
39 
40 namespace Mastodon
41 {
47  class Easy::Results : public Easy::Entity
48  {
49  public:
57  explicit Results(const string &json);
58 
64  Results();
65 
66  virtual bool valid() const;
67 
73  const std::vector<Account> accounts() const;
74 
80  const std::vector<Status> statuses() const;
81 
87  const std::vector<string> hashtags_v1() const;
88 
94  const std::vector<Tag> hashtags_v2() const;
95 
101  [[deprecated("Will vanish in 1.0.0, use hashtags_v1() instead")]]
102  const std::vector<string> hashtags() const;
103  };
104 }
105 
106 #endif // MASTODON_CPP_EASY_RESULTS_HPP
virtual bool valid() const
Returns true if the Entity holds valid data.
Definition: results.cpp:31
const std::vector< string > hashtags() const
Alias for hashtags_v1.
Definition: results.cpp:96
const std::vector< Account > accounts() const
Returns an array of matched Accounts.
Definition: results.cpp:43
Results()
Constructs an empty Results object.
Definition: results.cpp:27
const std::vector< Tag > hashtags_v2() const
Returns an array of matched hashtags as Easy::Tag.
Definition: results.cpp:80
const std::vector< string > hashtags_v1() const
Returns an array of matched hashtags as string.
Definition: results.cpp:75
Definition: mastodon-cpp.hpp:52
Base class for all entities.
Definition: easy.hpp:319
const std::vector< Status > statuses() const
Returns an array of matched Statuses.
Definition: results.cpp:59
Class to hold results.
Definition: results.hpp:47