|
Sierra Toolkit
Version of the Day
|
00001 /*------------------------------------------------------------------------*/ 00002 /* Copyright 2010 Sandia Corporation. */ 00003 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */ 00004 /* license for use of this work by or on behalf of the U.S. Government. */ 00005 /* Export of this program may require a license from the */ 00006 /* United States Government. */ 00007 /*------------------------------------------------------------------------*/ 00008 00009 #include <stk_util/util/ci_traits.hpp> 00010 00011 int 00012 ignorecase_traits::compare( 00013 const char * s1, 00014 const char * s2, 00015 std::size_t n) 00016 { 00017 for (std::size_t i = 0; i < n; ++i) 00018 if (!eq(s1[i], s2[i])) 00019 return lt(s1[i], s2[i]) ? -1 : 1; 00020 00021 return 0; 00022 } 00023 00024 const char * 00025 ignorecase_traits::find( 00026 const char * s, 00027 std::size_t n, 00028 const char & c) 00029 { 00030 for (std::size_t i = 0; i < n; ++i) 00031 if (eq(s[i], c)) 00032 return &(s[i]); 00033 00034 return 0; 00035 }