fixed header searching

This commit is contained in:
tastytea 2018-03-21 20:12:45 +01:00
parent 968339a0c0
commit 6cb9589cc0
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
14 changed files with 123 additions and 18 deletions

1
.gitignore vendored
View File

@ -1,5 +1,4 @@
/build/
/doc/
/update_gh-pages.sh
/src/mastodon-cpp
/src/examples/example99*

View File

@ -22,6 +22,9 @@ configure_file (
"${PROJECT_BINARY_DIR}/version.hpp"
)
# Announce that we are compiling mastodon-cpp (used in easy.hpp and examples)
add_definitions(-DMASTODON_CPP=1)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DDEBUG=1)
endif()

View File

@ -21,10 +21,16 @@
#include <cstdint>
#include <chrono>
#include <jsoncpp/json/json.h>
#include "mastodon-cpp/mastodon-cpp.hpp"
// If we are compiling mastodon-cpp, use another include path
#ifdef MASTODON_CPP
#include "mastodon-cpp.hpp"
#else
#include <mastodon-cpp/mastodon-cpp.hpp>
#endif
using std::string;
using std::uint16_t;
using std::uint64_t;
namespace Mastodon
{
@ -49,6 +55,17 @@ public:
Undefined
};
/*!
* @brief Describes the attachment type
*/
enum class attachment_type
{
image,
video,
gifv,
unknown
};
/*!
* @brief Constructs a new Easy object.
*
@ -71,7 +88,7 @@ public:
*
* @param json JSON string
*/
Account(const string &json);
explicit Account(const string &json);
/*!
* @brief Returns true if the account holds valid data
@ -109,12 +126,12 @@ public:
/*!
* @brief Returns number of followers
*/
const std::uint64_t followers_count() const;
const uint64_t followers_count() const;
/*!
* @brief Returns number of people this account follows
*/
const std::uint64_t following_count() const;
const uint64_t following_count() const;
/*!
* @brief Returns URL of header image
@ -129,13 +146,24 @@ public:
/*!
* @brief Returns account-ID
*/
const std::uint64_t id() const;
const uint64_t id() const;
/*!
* @brief Returns true if the account is locked
*/
const bool locked() const;
/*!
* @brief Returns true if the account has been moved
*/
const bool has_moved() const;
/*!
* @brief If the owner decided to switch accounts, new account is in
* this attribute
*/
const Account moved() const;
/*!
* @brief Returns note
*/
@ -159,7 +187,7 @@ public:
/*!
* @brief Returns number of statuses
*/
const std::uint64_t statuses_count() const;
const uint64_t statuses_count() const;
/*!
* @brief Returns URL of the profile
@ -175,6 +203,37 @@ public:
Json::Value _tree;
bool _valid;
};
/*!
* @brief Class to hold attachments
*/
class Attachment
{
public:
/*!
* @brief Constructs an attachment object from a JSON string.
*
* @param json JSON string
*/
explicit Attachment(const string &json);
/*!
* @brief Returns true if the attachment holds valid data
*/
const bool valid() const;
const uint64_t id() const;
const attachment_type type() const;
const string url() const;
const string remote_url() const;
const string preview_url() const;
const string text_url() const;
const string description() const;
private:
Json::Value _tree;
bool _valid;
};
};
}

View File

@ -7,7 +7,11 @@
#include <vector>
#include <string>
#include <cstdint>
#include "mastodon-cpp/mastodon-cpp.hpp"
#ifdef MASTODON_CPP
#include "mastodon-cpp.hpp"
#else
#include <mastodon-cpp/mastodon-cpp.hpp>
#endif
using Mastodon::API;

View File

@ -8,7 +8,11 @@
#include <cstdint>
#include <sstream>
#include <jsoncpp/json/json.h>
#include "mastodon-cpp/mastodon-cpp.hpp"
#ifdef MASTODON_CPP
#include "mastodon-cpp.hpp"
#else
#include <mastodon-cpp/mastodon-cpp.hpp>
#endif
using Mastodon::API;
using std::cout;

View File

@ -11,7 +11,11 @@
#include <fstream>
#include <sstream>
#include <jsoncpp/json/json.h>
#include "mastodon-cpp/mastodon-cpp.hpp"
#ifdef MASTODON_CPP
#include "mastodon-cpp.hpp"
#else
#include <mastodon-cpp/mastodon-cpp.hpp>
#endif
using Mastodon::API;
using std::cout;

View File

@ -6,7 +6,11 @@
#include <vector>
#include <string>
#include <cstdint>
#include "mastodon-cpp/mastodon-cpp.hpp"
#ifdef MASTODON_CPP
#include "mastodon-cpp.hpp"
#else
#include <mastodon-cpp/mastodon-cpp.hpp>
#endif
using Mastodon::API;

View File

@ -8,7 +8,11 @@
#include <cstdint>
#include <chrono>
#include <thread>
#include "mastodon-cpp/mastodon-cpp.hpp"
#ifdef MASTODON_CPP
#include "mastodon-cpp.hpp"
#else
#include <mastodon-cpp/mastodon-cpp.hpp>
#endif
using Mastodon::API;

View File

@ -8,7 +8,11 @@
#include <cstdint>
#include <chrono>
#include <thread>
#include "mastodon-cpp/mastodon-cpp.hpp"
#ifdef MASTODON_CPP
#include "mastodon-cpp.hpp"
#else
#include <mastodon-cpp/mastodon-cpp.hpp>
#endif
using Mastodon::API;

View File

@ -7,7 +7,11 @@
#include <string>
#include <cstdint>
#include <sstream>
#include "mastodon-cpp/mastodon-cpp.hpp"
#ifdef MASTODON_CPP
#include "mastodon-cpp.hpp"
#else
#include <mastodon-cpp/mastodon-cpp.hpp>
#endif
using Mastodon::API;

View File

@ -7,7 +7,11 @@
#include <vector>
#include <string>
#include <cstdint>
#include "mastodon-cpp/mastodon-cpp.hpp"
#ifdef MASTODON_CPP
#include "mastodon-cpp.hpp"
#else
#include <mastodon-cpp/mastodon-cpp.hpp>
#endif
using Mastodon::API;

View File

@ -9,7 +9,11 @@
#include <thread>
#include <chrono>
#include <memory>
#include "mastodon-cpp/mastodon-cpp.hpp"
#ifdef MASTODON_CPP
#include "mastodon-cpp.hpp"
#else
#include <mastodon-cpp/mastodon-cpp.hpp>
#endif
using Mastodon::API;

View File

@ -6,7 +6,11 @@
#include <iostream>
#include <string>
#include <cstdint>
#include "mastodon-cpp/mastodon-cpp.hpp"
#ifdef MASTODON_CPP
#include "mastodon-cpp.hpp"
#else
#include <mastodon-cpp/mastodon-cpp.hpp>
#endif
using Mastodon::API;

View File

@ -8,7 +8,11 @@
#include <cstdint>
#include <sstream>
#include <jsoncpp/json/json.h>
#include "mastodon-cpp/mastodon-cpp.hpp"
#ifdef MASTODON_CPP
#include "mastodon-cpp.hpp"
#else
#include <mastodon-cpp/mastodon-cpp.hpp>
#endif
using Mastodon::API;