Added Easy::Application and Easy::Tag
This commit is contained in:
parent
06ab515f17
commit
7e2c2b0359
|
@ -20,7 +20,6 @@
|
|||
#include <string>
|
||||
#include <cstdint>
|
||||
#include <chrono>
|
||||
#include <jsoncpp/json/json.h>
|
||||
|
||||
// If we are compiling mastodon-cpp, use another include path
|
||||
#ifdef MASTODON_CPP
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#ifdef MASTODON_CPP
|
||||
#include "easy.hpp"
|
||||
#include "easy/account.hpp"
|
||||
#include "easy/application.hpp"
|
||||
#include "easy/attachment.hpp"
|
||||
#include "easy/card.hpp"
|
||||
//#include "easy/context.hpp"
|
||||
|
@ -32,9 +33,12 @@
|
|||
#include "easy/relationship.hpp"
|
||||
#include "easy/report.hpp"
|
||||
//#include "easy/results.hpp"
|
||||
#include "easy/status.hpp"
|
||||
#include "easy/tag.hpp"
|
||||
#else
|
||||
#include <mastodon-cpp/easy.hpp>
|
||||
#include <mastodon-cpp/easy/account.hpp>
|
||||
#include <mastodon-cpp/easy/application.hpp>
|
||||
#include <mastodon-cpp/easy/attachment.hpp>
|
||||
#include <mastodon-cpp/easy/card.hpp>
|
||||
//#include <mastodon-cpp/easy/context.hpp>
|
||||
|
@ -46,6 +50,8 @@
|
|||
#include <mastodon-cpp/easy/relationship.hpp>
|
||||
#include <mastodon-cpp/easy/report.hpp>
|
||||
//#include <mastodon-cpp/easy/results.hpp>
|
||||
#include <mastodon-cpp/easy/status.hpp>
|
||||
#include <mastodon-cpp/easy/tag.hpp>
|
||||
#endif
|
||||
|
||||
#endif // MASTODON_CPP_EASY_ALL_HPP
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/* This file is part of mastodon-cpp.
|
||||
* Copyright © 2018 tastytea <tastytea@tastytea.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "application.hpp"
|
||||
|
||||
using namespace Mastodon;
|
||||
using Application = Easy::Application;
|
||||
|
||||
Application::Application(const string &json)
|
||||
: Entity(json)
|
||||
{}
|
||||
|
||||
Application::Application()
|
||||
: Entity()
|
||||
{}
|
||||
|
||||
const string Application::name() const
|
||||
{
|
||||
get_string("name");
|
||||
}
|
||||
|
||||
const string Application::website() const
|
||||
{
|
||||
get_string("website");
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/* This file is part of mastodon-cpp.
|
||||
* Copyright © 2018 tastytea <tastytea@tastytea.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MASTODON_CPP_EASY_APPLICATION_HPP
|
||||
#define MASTODON_CPP_EASY_APPLICATION_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
// If we are compiling mastodon-cpp, use another include path
|
||||
#ifdef MASTODON_CPP
|
||||
#include "mastodon-cpp.hpp"
|
||||
#include "easy.hpp"
|
||||
#else
|
||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||
#include <mastodon-cpp/easy.hpp>
|
||||
#endif
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace Mastodon
|
||||
{
|
||||
/*!
|
||||
* @brief Class to hold applications.
|
||||
*/
|
||||
class Easy::Application : public Easy::Entity
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructs an Application object from a JSON string.
|
||||
*
|
||||
* @param json JSON string
|
||||
*/
|
||||
explicit Application(const string &json);
|
||||
|
||||
/*!
|
||||
* @brief Constructs an empty Application object.
|
||||
*/
|
||||
Application();
|
||||
|
||||
/*!
|
||||
* @brief Returns the name of the application
|
||||
*/
|
||||
const string name() const;
|
||||
|
||||
/*!
|
||||
* @brief Returns the website of the application
|
||||
*/
|
||||
const string website() const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // MASTODON_CPP_EASY_APPLICATION_HPP
|
|
@ -187,6 +187,7 @@ public:
|
|||
};
|
||||
|
||||
class Account;
|
||||
class Application;
|
||||
class Attachment;
|
||||
class Card;
|
||||
class Context;
|
||||
|
@ -198,6 +199,8 @@ public:
|
|||
class Relationship;
|
||||
class Report;
|
||||
class Results;
|
||||
class Status;
|
||||
class Tag;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#endif
|
||||
|
||||
using std::string;
|
||||
using std::uint64_t;
|
||||
|
||||
namespace Mastodon
|
||||
{
|
||||
|
@ -43,7 +42,7 @@ namespace Mastodon
|
|||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructs a Result object from a JSON string.
|
||||
* @brief Constructs a Results object from a JSON string.
|
||||
*
|
||||
* @param json JSON string
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/* This file is part of mastodon-cpp.
|
||||
* Copyright © 2018 tastytea <tastytea@tastytea.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "tag.hpp"
|
||||
|
||||
using namespace Mastodon;
|
||||
using Tag = Easy::Tag;
|
||||
|
||||
Tag::Tag(const string &json)
|
||||
: Entity(json)
|
||||
{}
|
||||
|
||||
Tag::Tag()
|
||||
: Entity()
|
||||
{}
|
||||
|
||||
const string Tag::name() const
|
||||
{
|
||||
get_string("name");
|
||||
}
|
||||
|
||||
const string Tag::url() const
|
||||
{
|
||||
get_string("url");
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/* This file is part of mastodon-cpp.
|
||||
* Copyright © 2018 tastytea <tastytea@tastytea.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MASTODON_CPP_EASY_TAG_HPP
|
||||
#define MASTODON_CPP_EASY_TAG_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
// If we are compiling mastodon-cpp, use another include path
|
||||
#ifdef MASTODON_CPP
|
||||
#include "mastodon-cpp.hpp"
|
||||
#include "easy.hpp"
|
||||
#else
|
||||
#include <mastodon-cpp/mastodon-cpp.hpp>
|
||||
#include <mastodon-cpp/easy.hpp>
|
||||
#endif
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace Mastodon
|
||||
{
|
||||
/*!
|
||||
* @brief Class to hold tags.
|
||||
*/
|
||||
class Easy::Tag : public Easy::Entity
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructs an Tag object from a JSON string.
|
||||
*
|
||||
* @param json JSON string
|
||||
*/
|
||||
explicit Tag(const string &json);
|
||||
|
||||
/*!
|
||||
* @brief Constructs an empty Tag object.
|
||||
*/
|
||||
Tag();
|
||||
|
||||
/*!
|
||||
* @brief Returns the name of the application
|
||||
*/
|
||||
const string name() const;
|
||||
|
||||
/*!
|
||||
* @brief Returns the URL of the application
|
||||
*/
|
||||
const string url() const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // MASTODON_CPP_EASY_TAG_HPP
|
Reference in New Issue