Moved types to types.hpp and reformatted mastodon-cpp.hpp.

Also renamed easy/types.hpp to easy/types_easy.hpp.
This commit is contained in:
tastytea 2019-04-02 11:16:52 +02:00
parent 38e8809b92
commit b49e8600ac
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
8 changed files with 693 additions and 652 deletions

View File

@ -28,13 +28,13 @@
#ifdef MASTODON_CPP
#include "mastodon-cpp.hpp"
#include "easy/return_types_easy.hpp"
#include "easy/types.hpp"
#include "easy/types_easy.hpp"
#include "easy/entities/notification.hpp"
#include "easy/entities/status.hpp"
#else
#include <mastodon-cpp/mastodon-cpp.hpp>
#include <mastodon-cpp/easy/return_types_easy.hpp>
#include <mastodon-cpp/easy/types.hpp>
#include <mastodon-cpp/easy/types_easy.hpp>
#include <mastodon-cpp/easy/entities/notification.hpp>
#include <mastodon-cpp/easy/entities/status.hpp>
#endif

View File

@ -14,17 +14,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ENTITY_HPP
#define ENTITY_HPP
#ifndef MASTODON_CPP_EASY_ENTITY_HPP
#define MASTODON_CPP_EASY_ENTITY_HPP
#include <string>
#include <jsoncpp/json/json.h>
// If we are compiling mastodon-cpp, use another include path
#ifdef MASTODON_CPP
#include "easy/types.hpp"
#include "easy/types_easy.hpp"
#else
#include <mastodon-cpp/easy/types.hpp>
#include <mastodon-cpp/easy/types_easy.hpp>
#endif
using std::string;
@ -240,4 +240,4 @@ namespace Easy
}
}
#endif // ENTITY_HPP
#endif // MASTODON_CPP_EASY_ENTITY_HPP

View File

@ -30,7 +30,7 @@ const return_entity<Status> API::send_toot(const Status &status)
const return_entity<Status> API::send_post(const Status &status)
{
API::parametermap parameters;
parametermap parameters;
if (!status.content().empty())
{
@ -86,7 +86,7 @@ const return_entity<Status> API::send_post(const Status &status)
std::vector<string> media_ids;
for (const Attachment &att : status.media_attachments())
{
API::parametermap param_att;
parametermap param_att;
if (!att.file().empty())
{
param_att.insert({ "file", { att.file() }});
@ -132,7 +132,7 @@ const return_entity<Status> API::send_post(const Status &status)
const return_entity_vector<Notification> API::get_notifications(
const uint16_t limit, const string since_id, const string max_id)
{
API::parametermap parameters;
parametermap parameters;
parameters.insert({ "limit", { std::to_string(limit) } });
if (!since_id.empty())

View File

@ -14,7 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "types.hpp"
#include "types_easy.hpp"
using namespace Mastodon;

View File

@ -14,8 +14,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MASTODON_CPP_TYPES_HPP
#define MASTODON_CPP_TYPES_HPP
#ifndef MASTODON_CPP_EASY_TYPES_EASY_HPP
#define MASTODON_CPP_EASY_TYPES_EASY_HPP
#include <string>
#include <utility>
@ -152,4 +152,4 @@ namespace Easy
};
}
}
#endif // MASTODON_CPP_TYPES_HPP
#endif // MASTODON_CPP_EASY_TYPES_EASY_HPP

View File

@ -159,7 +159,7 @@ return_call API::register_app1(const string &client_name,
string &client_secret,
string &url)
{
API::parametermap parameters =
parametermap parameters =
{
{ "client_name", { client_name } },
{ "redirect_uris", { redirect_uri } },
@ -207,7 +207,7 @@ return_call API::register_app2(const string &client_id,
const string &code,
string &access_token)
{
API::parametermap parameters =
parametermap parameters =
{
{ "client_id", { client_id } },
{ "client_secret", { client_secret } },

File diff suppressed because it is too large Load Diff

45
src/types.hpp Normal file
View File

@ -0,0 +1,45 @@
/* This file is part of mastodon-cpp.
* Copyright © 2019 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_TYPES_HPP
#define MASTODON_CPP_TYPES_HPP
#include <string>
#include <map>
#include <vector>
using std::string;
namespace Mastodon
{
/*!
* @brief Used for passing parameters.
*
* Example:
* @code
* parametermap p =
* {
* {"field1", { "value1", "value2" } },
* {"field2", { "value" } }
* }
* @endcode
*
* @since before 0.11.0
*/
typedef std::map<string, std::vector<string>> parametermap;
}
#endif // MASTODON_CPP_TYPES_HPP