Added max_id() and since_id() to Easy::Link
This commit is contained in:
parent
94b2c2e7c9
commit
9f75b7d2b2
@ -1,6 +1,6 @@
|
||||
cmake_minimum_required (VERSION 3.7)
|
||||
project (mastodon-cpp
|
||||
VERSION 0.8.3
|
||||
VERSION 0.8.4
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
|
@ -77,6 +77,11 @@ const std::vector<Easy::stream_event>
|
||||
return vec;
|
||||
}
|
||||
|
||||
const Easy::Link Easy::get_link() const
|
||||
{
|
||||
return Link(get_header("Link"));
|
||||
}
|
||||
|
||||
Easy::Link::Link(const string &link_header)
|
||||
: _next(0)
|
||||
, _prev(0)
|
||||
@ -100,12 +105,17 @@ const uint_fast64_t Easy::Link::next() const
|
||||
return _next;
|
||||
}
|
||||
|
||||
const uint_fast64_t Easy::Link::max_id() const
|
||||
{
|
||||
return _next;
|
||||
}
|
||||
|
||||
const uint_fast64_t Easy::Link::prev() const
|
||||
{
|
||||
return _prev;
|
||||
}
|
||||
|
||||
const Easy::Link Easy::get_link() const
|
||||
const uint_fast64_t Easy::Link::since_id() const
|
||||
{
|
||||
return Link(get_header("Link"));
|
||||
return _prev;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <chrono>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <functional>
|
||||
#include <jsoncpp/json/json.h>
|
||||
|
||||
// If we are compiling mastodon-cpp, use another include path
|
||||
@ -102,12 +103,15 @@ public:
|
||||
Undefined
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Used for stream events.
|
||||
*/
|
||||
typedef std::pair<event_type, string> stream_event;
|
||||
|
||||
/*!
|
||||
* @brief Class to hold the `Link`-header.
|
||||
*
|
||||
* Extracts max_id and since_id from the `Link:`-header
|
||||
* Extracts max_id and since_id from the `Link`-header
|
||||
*/
|
||||
class Link
|
||||
{
|
||||
@ -119,11 +123,21 @@ public:
|
||||
*/
|
||||
const uint_fast64_t next() const;
|
||||
|
||||
/*!
|
||||
* @brief Returns max_id
|
||||
*/
|
||||
const uint_fast64_t max_id() const;
|
||||
|
||||
/*!
|
||||
* @brief Returns since_id
|
||||
*/
|
||||
const uint_fast64_t prev() const;
|
||||
|
||||
/*!
|
||||
* @brief Returns since_id
|
||||
*/
|
||||
const uint_fast64_t since_id() const;
|
||||
|
||||
private:
|
||||
uint_fast64_t _next;
|
||||
uint_fast64_t _prev;
|
||||
|
Reference in New Issue
Block a user