diff --git a/src/easy/account.hpp b/src/easy/account.hpp index 9b617d8..14a8059 100644 --- a/src/easy/account.hpp +++ b/src/easy/account.hpp @@ -20,7 +20,6 @@ #include #include #include -#include // If we are compiling mastodon-cpp, use another include path #ifdef MASTODON_CPP diff --git a/src/easy/all.hpp b/src/easy/all.hpp index 36e566f..3d5ce14 100644 --- a/src/easy/all.hpp +++ b/src/easy/all.hpp @@ -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 #include + #include #include #include //#include @@ -46,6 +50,8 @@ #include #include //#include + #include + #include #endif #endif // MASTODON_CPP_EASY_ALL_HPP diff --git a/src/easy/application.cpp b/src/easy/application.cpp new file mode 100644 index 0000000..00b919c --- /dev/null +++ b/src/easy/application.cpp @@ -0,0 +1,38 @@ +/* This file is part of mastodon-cpp. + * Copyright © 2018 tastytea + * + * 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 . + */ + +#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"); +} diff --git a/src/easy/application.hpp b/src/easy/application.hpp new file mode 100644 index 0000000..6350a6c --- /dev/null +++ b/src/easy/application.hpp @@ -0,0 +1,65 @@ +/* This file is part of mastodon-cpp. + * Copyright © 2018 tastytea + * + * 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 . + */ + +#ifndef MASTODON_CPP_EASY_APPLICATION_HPP +#define MASTODON_CPP_EASY_APPLICATION_HPP + +#include + +// If we are compiling mastodon-cpp, use another include path +#ifdef MASTODON_CPP + #include "mastodon-cpp.hpp" + #include "easy.hpp" +#else + #include + #include +#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 diff --git a/src/easy/easy.hpp b/src/easy/easy.hpp index e0caa88..0cc0f9f 100644 --- a/src/easy/easy.hpp +++ b/src/easy/easy.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; }; } diff --git a/src/easy/results.hpp b/src/easy/results.hpp index b865a3e..7c2b6a0 100644 --- a/src/easy/results.hpp +++ b/src/easy/results.hpp @@ -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 */ diff --git a/src/easy/tag.cpp b/src/easy/tag.cpp new file mode 100644 index 0000000..2e44d13 --- /dev/null +++ b/src/easy/tag.cpp @@ -0,0 +1,38 @@ +/* This file is part of mastodon-cpp. + * Copyright © 2018 tastytea + * + * 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 . + */ + +#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"); +} diff --git a/src/easy/tag.hpp b/src/easy/tag.hpp new file mode 100644 index 0000000..39447e5 --- /dev/null +++ b/src/easy/tag.hpp @@ -0,0 +1,65 @@ +/* This file is part of mastodon-cpp. + * Copyright © 2018 tastytea + * + * 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 . + */ + +#ifndef MASTODON_CPP_EASY_TAG_HPP +#define MASTODON_CPP_EASY_TAG_HPP + +#include + +// If we are compiling mastodon-cpp, use another include path +#ifdef MASTODON_CPP + #include "mastodon-cpp.hpp" + #include "easy.hpp" +#else + #include + #include +#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