explicit Interval()

in include/poac/core/semver.hpp [418:460]


        explicit Interval(const std::string& n, const std::string& i) : name(n), interval(i) {
            std::smatch match;
            if (std::regex_match(interval, match, std::regex(CLOSED_UNBOUNDED_INTERVAL))) {
                comp_op = match[2].str();
                version_str = match[3].str() + "." + match[4].str() + "." + match[5].str();

                // Check
                if (comp_op.empty()) { // equal
                    mode = 0;
                }
                else {
                    mode = 1;
                }
            }
            else if (std::regex_match(interval, match, std::regex(BOUNDED_INTERVAL))) {
                first_comp_op = match[2].str();
                second_comp_op = match[9].str();

                first_version = match[3].str() + "." + match[4].str() + "." + match[5].str();
                first_version += match[6].matched ? ("-" + match[6].str()) : "";
                first_version += match[7].matched ? ("+" + match[7].str()) : "";

                second_version = match[10].str() + "." + match[11].str() + "." + match[12].str();
                second_version += match[13].matched ? ("-" + match[13].str()) : "";
                second_version += match[14].matched ? ("+" + match[14].str()) : "";

                // Checks
                is_wasteful_comparison_operation();
                is_bounded_interval();
                mode = 2;
            }
            else {
                throw exception::error(
                        "`" + name + ": " + interval +
                        "` is invalid expression.\n"
                        "Comparison operators:\n"
                        "  >, >=, <, <=\n"
                        "Logical operator:\n"
                        "  and\n"
                        "The following example is the meaning for equals:\n"
                        "  example: \"1.2.0\"");
            }
        }