forked from sony/nmos-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathis05_versions.h
27 lines (22 loc) · 850 Bytes
/
is05_versions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef NMOS_IS05_VERSIONS_H
#define NMOS_IS05_VERSIONS_H
#include <set>
#include <boost/range/adaptor/transformed.hpp>
#include "nmos/api_version.h"
#include "nmos/settings.h"
namespace nmos
{
namespace is05_versions
{
const api_version v1_0{ 1, 0 };
const api_version v1_1{ 1, 1 };
const std::set<api_version> all{ nmos::is05_versions::v1_0, nmos::is05_versions::v1_1 };
inline std::set<api_version> from_settings(const nmos::settings& settings)
{
return settings.has_field(nmos::fields::is05_versions)
? boost::copy_range<std::set<api_version>>(nmos::fields::is05_versions(settings) | boost::adaptors::transformed([](const web::json::value& v) { return nmos::parse_api_version(v.as_string()); }))
: nmos::is05_versions::all;
}
}
}
#endif