diff options
Diffstat (limited to 'src/text.cpp')
-rw-r--r-- | src/text.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/text.cpp b/src/text.cpp new file mode 100644 index 0000000..5790f96 --- /dev/null +++ b/src/text.cpp @@ -0,0 +1,41 @@ +#include "src/impl.h" + +namespace mp4v2 { namespace impl { + +/////////////////////////////////////////////////////////////////////////////// + +bool +LessIgnoreCase::operator()( const string& xstr, const string& ystr ) const +{ + const string::size_type xlen = xstr.length(); + const string::size_type ylen = ystr.length(); + + if( xlen < ylen ) { + for( string::size_type i = 0; i < xlen; i++ ) { + const char x = std::toupper( xstr[i] ); + const char y = std::toupper( ystr[i] ); + + if( x < y ) + return true; + else if ( x > y ) + return false; + } + return true; + } + else { + for( string::size_type i = 0; i < ylen; i++ ) { + const char x = std::toupper( xstr[i] ); + const char y = std::toupper( ystr[i] ); + + if( x < y ) + return true; + else if ( x > y ) + return false; + } + return false; + } +} + +/////////////////////////////////////////////////////////////////////////////// + +}} // namespace mp4v2::impl |