Added constructors for empty Entities

This commit is contained in:
tastytea 2018-03-30 20:16:31 +02:00
parent 18aabc454f
commit 69740568e0
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
9 changed files with 44 additions and 12 deletions

View File

@ -32,6 +32,10 @@ Account::Account(const string &json)
: Entity(json)
{}
Account::Account()
: Entity()
{}
const string Account::acct() const
{
return get_string("acct");
@ -105,7 +109,7 @@ const Account Account::moved() const
return Account(get("moved").toStyledString());
}
return Account("");
return Account();
}
const string Account::note() const

View File

@ -50,6 +50,11 @@ namespace Mastodon
*/
explicit Account(const string &json);
/*!
* @brief Constructs an empty Account object.
*/
Account();
/*!
* @brief Returns username
*

View File

@ -30,6 +30,10 @@ Attachment::Attachment(const string &json)
: Entity(json)
{}
Attachment::Attachment()
: Entity()
{}
const double Attachment::aspect() const
{
return get_double("meta.original.aspect");

View File

@ -50,6 +50,11 @@ namespace Mastodon
*/
explicit Attachment(const string &json);
/*!
* @brief Constructs an empty Attachment object.
*/
Attachment();
/*!
* @brief Aspect of original image
*/

View File

@ -27,9 +27,11 @@ using std::uint64_t;
Card::Card(const string &json)
: Entity(json)
{
//
}
{}
Card::Card()
: Entity()
{}
const string Card::author_name() const
{

View File

@ -48,6 +48,11 @@ namespace Mastodon
*/
explicit Card(const string &json);
/*!
* @brief Constructs an empty Card object.
*/
Card();
/*!
* @brief Returns the name of the author
*/

View File

@ -27,9 +27,11 @@ using std::uint64_t;
Emoji::Emoji(const string &json)
: Entity(json)
{
//
}
{}
Emoji::Emoji()
: Entity()
{}
const string Emoji::shortcode() const
{

View File

@ -14,8 +14,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MASTODON_CPP_EASY_CARD_HPP
#define MASTODON_CPP_EASY_CARD_HPP
#ifndef MASTODON_CPP_EASY_EMOJI_HPP
#define MASTODON_CPP_EASY_EMOJI_HPP
#include <string>
@ -39,12 +39,17 @@ namespace Mastodon
{
public:
/*!
* @brief Constructs a Emoji object from a JSON string.
* @brief Constructs an Emoji object from a JSON string.
*
* @param json JSON string
*/
explicit Emoji(const string &json);
/*!
* @brief Constructs an empty Emoji object.
*/
Emoji();
/*!
* @brief Returns the shortcode of the emoji
*/
@ -62,4 +67,4 @@ namespace Mastodon
};
}
#endif // MASTODON_CPP_EASY_CARD_HPP
#endif // MASTODON_CPP_EASY_EMOJI_HPP

View File

@ -44,7 +44,7 @@ const Easy::Account Instance::contact_account() const
}
ttdebug << "Could not get data: contact_account\n";
return Easy::Account("");
return Easy::Account();
}
const string Instance::description() const