<commit_before>#pragma once

#include "../basic_Error.hpp"

namespace cryptolens_io {

namespace v20190401 {

template<typename Env>
class OnValidMachineValidator_ {
public:
#ifndef CRYPTOLENS_20190701_ALLOW_IMPLICIT_CONSTRUCTORS
  explicit
#endif
  OnValidMachineValidator_(basic_Error & e) {}

  void
  validate(basic_Error & e, Env & env) {
    if (e) { return; }

    auto const& license_key_information = env.get_license_key_information();
    auto const& expected_machine_code = env.get_machine_code();
    bool floating = env.get_floating();

    bool valid = false;
    auto const& machines = license_key_information.get_activated_machines();
    if (machines) {
      std::string full_expected_machine_code;
      if (floating) { full_expected_machine_code += "floating:"; }
      full_expected_machine_code += expected_machine_code;<commit_msg>Fix OnValidMachine validator when number of machines is unlimited<commit_after>#pragma once

#include "../basic_Error.hpp"

namespace cryptolens_io {

namespace v20190401 {

template<typename Env>
class OnValidMachineValidator_ {
public:
#ifndef CRYPTOLENS_20190701_ALLOW_IMPLICIT_CONSTRUCTORS
  explicit
#endif
  OnValidMachineValidator_(basic_Error & e) {}

  void
  validate(basic_Error & e, Env & env) {
    if (e) { return; }

    auto const& license_key_information = env.get_license_key_information();
    auto const& expected_machine_code = env.get_machine_code();
    bool floating = env.get_floating();

    auto const& machines = license_key_information.get_activated_machines();
    auto const& maxnoofmachines = license_key_information.get_maxnoofmachines();
    bool valid = (maxnoofmachines && *maxnoofmachines == 0)
	      || !machines;
    if (machines && !valid) {
      std::string full_expected_machine_code;
      if (floating) { full_expected_machine_code += "floating:"; }
      full_expected_machine_code += expected_machine_code;
{'fraction_non_alphanumeric': 0.09276729559748427, 'fraction_numerical': 0.01729559748427673, 'mean_word_length': 4.965625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3105673', 'n_tokens_mistral': 639, 'n_tokens_neox': 595, 'n_words': 125}