-
Notifications
You must be signed in to change notification settings - Fork 137
/
Copy pathtext.cpp
41 lines (33 loc) · 1.07 KB
/
text.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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