From efaad5b9805e08dcd8fef285c4aaf2b712e209fe Mon Sep 17 00:00:00 2001 From: Dr-Carlos Date: Fri, 23 Dec 2022 09:51:00 +1100 Subject: [PATCH] add extra symbol comparison methods --- include/fxos/symbols.h | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/include/fxos/symbols.h b/include/fxos/symbols.h index 756f7d6..a10ed90 100644 --- a/include/fxos/symbols.h +++ b/include/fxos/symbols.h @@ -37,7 +37,36 @@ struct Symbol bool operator<(const FxOS::Symbol &right) const { - return (type < right.type) || (value < right.value); + return (type < right.type) + || (value < right.value && type == right.type); + } + + bool operator>(const FxOS::Symbol &right) const + { + return (type > right.type) + || (value > right.value && type == right.type); + } + + bool operator==(const FxOS::Symbol &right) const + { + return value == right.value && type == right.type; + } + + bool operator!=(const FxOS::Symbol &right) const + { + return value != right.value || type != right.type; + } + + bool operator>=(const FxOS::Symbol &right) const + { + return (type > right.type) + || (value >= right.value && type == right.type); + } + + bool operator<=(const FxOS::Symbol &right) const + { + return (type < right.type) + || (value <= right.value && type == right.type); } };