.. _program_listing_file_src_comparisons.cpp: Program Listing for File comparisons.cpp ======================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/comparisons.cpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* This file is part of brille. Copyright © 2020 Greg Tucker brille 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. brille 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 brille. If not, see . */ #include #include "comparisons.hpp" template<> std::string brille::to_string(const cmp& c){ using namespace brille; std::string repr; switch(c) { case cmp::lt: repr = "<"; break; case cmp::gt: repr = ">"; break; case cmp::le: repr = "<="; break; case cmp::ge: repr = ">="; break; case cmp::eq: repr = "=="; break; case cmp::nle: repr = "!<="; break; case cmp::nge: repr = "!>="; break; case cmp::neq: repr = "!="; break; case cmp::le_ge: repr = "<=|>="; break; default: repr = "unknown comparator"; } return repr; } template<> std::string brille::to_string(const brille::ops& o){ using namespace brille; std::string repr; switch(o) { case ops::plus: repr = "+"; break; case ops::minus: repr = "-"; break; case ops::times: repr = "*"; break; case ops::rdiv: repr = "/"; break; case ops::ldiv: repr = "\\"; break; default: repr = "unknown operator"; } return repr; }