mastodon-cpp  0.30.0
context.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_CONTEXT_HPP
18 #define MASTODON_CPP_EASY_CONTEXT_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/status.hpp"
28 #else
29  #include <mastodon-cpp/mastodon-cpp.hpp>
30  #include <mastodon-cpp/easy/easy.hpp>
31  #include <mastodon-cpp/easy/entities/status.hpp>
32 #endif
33 
34 using std::string;
35 
36 namespace Mastodon
37 {
43  class Easy::Context : public Easy::Entity
44  {
45  public:
53  explicit Context(const string &json);
54 
60  Context();
61 
62  virtual bool valid() const;
63 
69  const std::vector<Status> ancestors() const;
70 
76  const std::vector<Status> descendants() const;
77  };
78 }
79 
80 #endif // MASTODON_CPP_EASY_CONTEXT_HPP
virtual bool valid() const
Returns true if the Entity holds valid data.
Definition: context.cpp:31
Context()
Constructs an empty Context object.
Definition: context.cpp:27
Class to hold contexts.
Definition: context.hpp:43
const std::vector< Status > descendants() const
Returns the descendants of the Status as vector of Statuses.
Definition: context.cpp:59
Definition: mastodon-cpp.hpp:52
Base class for all entities.
Definition: easy.hpp:319
const std::vector< Status > ancestors() const
Returns the ancestors of the Status as vector of Statuses.
Definition: context.cpp:42