mastodon-cpp  0.110.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
101 : _next()
102 , _prev()
103 {
104  std::regex renext("max_id=([[:digit:]]*)");
105  std::regex reprev("since_id=([[:digit:]]*)");
106  std::smatch match;
107 
108  if (std::regex_search(link_header, match, renext))
109  {
110  _next = match[1].str();
111  }
112  if (std::regex_search(link_header, match, reprev))
113  {
114  _prev = match[1].str();
115  }
116 }

Member Function Documentation

◆ max_id()

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

Returns max_id.

Since
before 0.11.0
124 {
125  return _next;
126 }

◆ next()

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

Returns max_id.

Since
before 0.11.0
119 {
120  return _next;
121 }

◆ prev()

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

Returns since_id.

Since
before 0.11.0
129 {
130  return _prev;
131 }

◆ since_id()

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

Returns since_id.

Since
before 0.11.0
134 {
135  return _prev;
136 }

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