mastodon-cpp  0.110.0
Public Member Functions | List of all members
Mastodon::parameters Struct Reference

Vector of Mastodon::param, used for passing parameters in calls. More...

#include <types.hpp>

Inheritance diagram for Mastodon::parameters:

Public Member Functions

const std::vector< param >::const_iterator find (const string &key) const
 Get iterator to element with key. More...
 

Detailed Description

Vector of Mastodon::param, used for passing parameters in calls.

The only difference to a std::vector<param> is the added member find.

Example:

{
{ "media_ids", { "1234", "4321" } },
{ "status", { "Hello world!" } }
};
Since
0.100.0

Member Function Documentation

◆ find()

const std::vector< param >::const_iterator parameters::find ( const string &  key) const

Get iterator to element with key.

Searches parameters for an element with a key equivalent to key and returns an iterator to it if found, otherwise it returns an iterator to parameters::end().

Parameters
keyString to search for.
Returns
Iterator to element with key or parameters::end().
Since
0.100.0
29 {
30  return std::find_if(this->begin(), this->end(),
31  [&key](const param &p)
32  {
33  if (p.key == key)
34  return true;
35  else
36  return false;
37  });
38 }
A single parameter.
Definition: types.hpp:37

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