openModeller  Version 1.4.0
ignorecase_traits.cpp
Go to the documentation of this file.
00001 #ifdef WIN32
00002 // avoid warnings caused by problems in VC headers
00003 #define _SCL_SECURE_NO_DEPRECATE
00004 #endif
00005 
00006 #include <openmodeller/ignorecase_traits.hh>
00007 
00008 using std::size_t;
00009 
00010 int
00011 ignorecase_traits::compare(const char* s1, const char* s2, size_t n)
00012 {
00013   for( size_t i=0; i<n; ++i ) {
00014     if (!eq(s1[i],s2[i])) {
00015       return lt(s1[i],s2[i])?-1:1;
00016     }
00017   }
00018   return 0;
00019 }
00020 
00021 const char*
00022 ignorecase_traits::find( const char* s, size_t n, const char& c )
00023 {
00024   for ( size_t i=0; i<n; ++i ) {
00025     if (eq(s[i],c)) {
00026       return &(s[i]);
00027     }
00028   }
00029   return 0;
00030 }
00031