/** * @file version.hpp * @brief X.Y.Z version parsing and comparison * * @copyright Copyright (c) 2026 SILO GROUP LLC * @author Chris Punches * * Part of the Dark Horse Linux Package Manager (DPM) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ #pragma once namespace dpmcore { /** * @brief Parses a strict X.Y.Z version string * * @param s The version string * @param out Receives the three parsed components * @return true on success; false on any malformation */ bool parse_version(const char* s, long out[3]); /** * @brief Compares two valid X.Y.Z version strings * * @param a First version * @param b Second version * @return -1 if a < b, 0 if equal, 1 if a > b */ int compare_versions(const char* a, const char* b); } // namespace dpmcore