mastodon-cpp  0.104.0
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 string next () const
 Returns max_id. More...
 
const string max_id () const
 Returns max_id. More...
 
const string prev () const
 Returns since_id. More...
 
const string 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
88 : _next()
89 , _prev()
90 {
91  std::regex renext("max_id=([[:digit:]]*)");
92  std::regex reprev("since_id=([[:digit:]]*)");
93  std::smatch match;
94 
95  if (std::regex_search(link_header, match, renext))
96  {
97  _next = match[1].str();
98  }
99  if (std::regex_search(link_header, match, reprev))
100  {
101  _prev = match[1].str();
102  }
103 }

Member Function Documentation

◆ max_id()

const string Easy::Link::max_id ( ) const

Returns max_id.

Since
before 0.11.0
111 {
112  return _next;
113 }

◆ next()

const string Easy::Link::next ( ) const

Returns max_id.

Since
before 0.11.0
106 {
107  return _next;
108 }

◆ prev()

const string Easy::Link::prev ( ) const

Returns since_id.

Since
before 0.11.0
116 {
117  return _prev;
118 }

◆ since_id()

const string Easy::Link::since_id ( ) const

Returns since_id.

Since
before 0.11.0
121 {
122  return _prev;
123 }

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