mastodon-cpp  0.18.4
Public Member Functions | List of all members
Mastodon::Easy::Link Class Reference

Class to hold the Link-header. More...

#include <easy.hpp>

Public Member Functions

 Link (const string &link_header)
 
const uint_fast64_t next () const
 Returns max_id. More...
 
const uint_fast64_t max_id () const
 Returns max_id. More...
 
const uint_fast64_t prev () const
 Returns since_id. More...
 
const uint_fast64_t since_id () const
 Returns since_id. More...
 

Detailed Description

Class to hold the Link-header.

Extracts max_id and since_id from the Link-header

Since
before 0.11.0

Constructor & Destructor Documentation

◆ Link()

Easy::Link::Link ( const string &  link_header)
explicit
Parameters
link_headerThe content of the Link header
Since
before 0.11.0
119 : _next(0)
120 , _prev(0)
121 {
122  std::regex renext("max_id=([[:digit:]]*)");
123  std::regex reprev("since_id=([[:digit:]]*)");
124  std::smatch match;
125 
126  if (std::regex_search(link_header, match, renext))
127  {
128  _next = std::stoull(match[1].str());
129  }
130  if (std::regex_search(link_header, match, reprev))
131  {
132  _prev = std::stoull(match[1].str());
133  }
134 }

Member Function Documentation

◆ max_id()

const uint_fast64_t Easy::Link::max_id ( ) const

Returns max_id.

Since
before 0.11.0
142 {
143  return _next;
144 }

◆ next()

const uint_fast64_t Easy::Link::next ( ) const

Returns max_id.

Since
before 0.11.0
137 {
138  return _next;
139 }

◆ prev()

const uint_fast64_t Easy::Link::prev ( ) const

Returns since_id.

Since
before 0.11.0
147 {
148  return _prev;
149 }

◆ since_id()

const uint_fast64_t Easy::Link::since_id ( ) const

Returns since_id.

Since
before 0.11.0
152 {
153  return _prev;
154 }

The documentation for this class was generated from the following files: