Class license

Class Documentation

class license

A general license data class This class describes a data object that holds arbitrary key-value string parameters. Fundamentally, it’s a restricted std::unordered_map<std::string, std::string>

Public Functions

inline license(std::unordered_map<std::string, std::string> const &content)
inline license()
template<string_convertable S>
inline auto push_content(std::string const &key, S const &value) -> bool

Adds content to the license. This collection of key-value pairs will be used to generate a signature.

Template Parameters:

S – any value that is either a number, string or convertible to a string

Parameters:
  • key – a key tag

  • value – the corresponding value

Returns:

true if the key has not existed before and was inserted with a new value

Returns:

false if the key has existed already and been overwritten with a new value

template<string_convertable S>
inline auto push_content(std::pair<std::string, S> const &kv) -> bool
inline auto get_content() const -> content_map_t const&

get a const access to the underlying map object

Returns:

content_map_t const& the underlying map object

inline auto get(std::string const &key) -> std::optional<content_map_t::mapped_type>

read a single parameter from the map

Parameters:

key – the key to search for

Returns:

std::optional<content_map_t::mapped_type> either the value corresponding to key or std::nullopt if that key does not exist

inline auto stringify() const -> std::string

serialize the license to a single string that is reproducable if the contents of the license are equal

Returns:

std::string a single string version of the full license content