Added Easy::Emoji
This commit is contained in:
parent
6208104335
commit
328e06c2b5
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required (VERSION 3.7)
|
||||
project (mastodon-cpp
|
||||
VERSION 0.7.5
|
||||
VERSION 0.7.6
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
|
|
|
@ -22,11 +22,15 @@
|
|||
#include "easy/account.hpp"
|
||||
#include "easy/attachment.hpp"
|
||||
#include "easy/card.hpp"
|
||||
//#include "easy/context.hpp"
|
||||
#include "easy/emoji.hpp"
|
||||
#else
|
||||
#include <mastodon-cpp/easy.hpp>
|
||||
#include <mastodon-cpp/easy/account.hpp>
|
||||
#include <mastodon-cpp/easy/attachment.hpp>
|
||||
#include <mastodon-cpp/easy/card.hpp>
|
||||
//#include <mastodon-cpp/easy/context.hpp>
|
||||
#include <mastodon-cpp/easy/emoji.hpp>
|
||||
#endif
|
||||
|
||||
#endif // MASTODON_CPP_EASY_ALL_HPP
|
||||
|
|
|
@ -159,6 +159,8 @@ public:
|
|||
class Account;
|
||||
class Attachment;
|
||||
class Card;
|
||||
class Context;
|
||||
class Emoji;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/* 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 <string>
|
||||
#include <sstream>
|
||||
#include <jsoncpp/json/json.h>
|
||||
#include "emoji.hpp"
|
||||
#include "macros.hpp"
|
||||
|
||||
using namespace Mastodon;
|
||||
using Emoji = Easy::Emoji;
|
||||
using std::string;
|
||||
using std::uint64_t;
|
||||
|
||||
Emoji::Emoji(const string &json)
|
||||
: Entity(json)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
const string Emoji::shortcode() const
|
||||
{
|
||||
return get_string("shortcode");
|
||||
}
|
||||
|
||||
const string Emoji::static_url() const
|
||||
{
|
||||
return get_string("static_url");
|
||||
}
|
||||
|
||||
const string Emoji::url() const
|
||||
{
|
||||
return 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_CARD_HPP
|
||||
#define MASTODON_CPP_EASY_CARD_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 cards
|
||||
*/
|
||||
class Easy::Emoji : public Easy::Entity
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* @brief Constructs a Emoji object from a JSON string.
|
||||
*
|
||||
* @param json JSON string
|
||||
*/
|
||||
explicit Emoji(const string &json);
|
||||
|
||||
/*!
|
||||
* @brief Returns the shortcode of the emoji
|
||||
*/
|
||||
const string shortcode() const;
|
||||
|
||||
/*!
|
||||
* @brief Returns the URL to the emoji static image
|
||||
*/
|
||||
const string static_url() const;
|
||||
|
||||
/*!
|
||||
* @brief Returns the URL to the emoji image
|
||||
*/
|
||||
const string url() const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // MASTODON_CPP_EASY_CARD_HPP
|
Reference in New Issue