From ee1a480054a66f7f0329a1ed14ad28eef62047fa Mon Sep 17 00:00:00 2001 From: augusto Date: Fri, 13 Jun 1997 14:35:39 +0000 Subject: [PATCH] Gestione dei const char * NULL negli operatori di confronto git-svn-id: svn://10.65.10.50/trunk@4662 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/strings.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/strings.h b/include/strings.h index 7d9fcae20..fe1070f50 100755 --- a/include/strings.h +++ b/include/strings.h @@ -210,34 +210,34 @@ public: // @cmember Controlla se due stringhe sono uguali bool operator ==(const char* s) const - { return strcmp(_str, s) == 0; } + { return s ? strcmp(_str, s) == 0 : empty();} // @cmember Controlla se due stringhe sono uguali bool operator ==(char* s) const - { return strcmp(_str, s) == 0; } + { return s ? strcmp(_str, s) == 0 : empty();} // @cmember Controlla se due stringe sono uguali bool operator ==(const TString& s) const { return strcmp(_str, s._str) == 0; } // @cmember Controlla se due stringhe sono diverse bool operator !=(const char* s) const - { return strcmp(_str, s) != 0; } + { return s ? strcmp(_str, s) != 0 : not_empty();} // @cmember Controlla se due stringhe sono diverse bool operator !=(char* s) const - { return strcmp(_str, s) != 0; } + { return s ? strcmp(_str, s) != 0 : not_empty();} // @cmember Controlla se due stringhe sono diverse bool operator !=(const TString& s) const { return strcmp(_str, s._str) != 0; } // @cmember Controlla se una stringa e' minore di un'altra bool operator <(const char* s) const - { return strcmp(_str, s) < 0; } + { return s ? strcmp(_str, s) < 0 : FALSE;} // @cmember Controlla se una stringa e' maggiore di un'altra bool operator >(const char* s) const - { return strcmp(_str, s) > 0; } + { return s ? strcmp(_str, s) > 0 : not_empty();} // @cmember Controlla se una stringa e' maggiore o uguale ad un'altra bool operator >=(const char* s) const - { return strcmp(_str, s) >= 0; } + { return s ? strcmp(_str, s) >= 0 : TRUE;} // @cmember Controlla se una stringa e' minore o uguale ad un'altra bool operator <=(const char* s) const - { return strcmp(_str, s) <= 0; } + { return s ? strcmp(_str, s) <= 0 : empty();} // @cmember Controlla se una stringa e' minore di un'altra bool operator <(const TString & s) const { return strcmp(_str, s._str) < 0; }