00001 #ifndef __J2K__JString_Compare_CPP__ 00002 #define __J2K__JString_Compare_CPP__ 00003 00004 #include <j2k/Fred/String/String.hpp> 00005 00006 //////////////////////////////////////////////////////////////////////////// 00007 /// Compare utilities only. No external function used, all inlined ! /// 00008 //////////////////////////////////////////////////////////////////////////// 00009 00010 inline int JString::compare( const JString& right ) const { 00011 if ( pData == right.pData ) return 0; 00012 return strcmp( pData->data, right.pData->data ); 00013 } 00014 00015 inline int JString::compare( const char* r ) const { 00016 if ( pData == strNull && ( r == "" || r == NULL ) ) return 0; 00017 return strcmp( pData->data, r ); 00018 } 00019 00020 // Is Left JString (THIS) less than Right JString? 00021 inline BOOL JString::operator< ( const JString& right ) const { 00022 return ( compare(right) < 0 ); 00023 } 00024 00025 inline BOOL JString::operator< ( const char* right ) const { 00026 return ( compare(right) < 0 ); 00027 } 00028 00029 inline BOOL JString::operator< ( char right ) const { 00030 return ( compare(right) < 0 ); 00031 } 00032 00033 inline BOOL JString::operator> ( const JString& right ) const { 00034 return ( compare(right) > 0 ); 00035 } 00036 00037 inline BOOL JString::operator> ( const char* right ) const { 00038 return ( compare(right) > 0 ); 00039 } 00040 00041 inline BOOL JString::operator> ( char right ) const { 00042 return ( compare(right) > 0 ); 00043 } 00044 00045 inline BOOL JString::operator<=( const JString& right ) const { 00046 return ( compare(right) <= 0 ); 00047 } 00048 00049 inline BOOL JString::operator<=( const char* right ) const { 00050 return ( compare(right) <= 0 ); 00051 } 00052 00053 inline BOOL JString::operator<=( char right ) const { 00054 return ( compare(right) <= 0 ); 00055 } 00056 00057 inline BOOL JString::operator>=( const JString& right ) const { 00058 return ( compare(right) >= 0 ); 00059 } 00060 00061 inline BOOL JString::operator>=( const char* right ) const { 00062 return ( compare(right) >= 0 ); 00063 } 00064 00065 inline BOOL JString::operator>=( char right ) const { 00066 return ( compare(right) >= 0 ); 00067 } 00068 00069 inline BOOL JString::operator==( const JString& right ) const { 00070 return ( compare(right) == 0 ); 00071 } 00072 00073 inline BOOL JString::operator==( const char* right ) const { 00074 return ( compare(right) == 0 ); 00075 } 00076 00077 inline BOOL JString::operator==( char right ) const { 00078 return ( compare(right) == 0 ); 00079 } 00080 00081 inline BOOL JString::operator!=( const JString& right ) const { 00082 return ( compare(right) != 0 ); 00083 } 00084 00085 inline BOOL JString::operator!=( const char* right ) const { 00086 return ( compare(right) != 0 ); 00087 } 00088 00089 inline BOOL JString::operator!=( char right ) const { 00090 return ( compare(right) != 0 ); 00091 } 00092 00093 #endif