xml-copy-editor-code/src/nocasecompare.h

24 lines
468 B
C
Raw Normal View History

2007-09-07 23:17:30 +02:00
#include <string>
using namespace std;
class NoCaseCompare
{
2007-09-08 00:25:30 +02:00
public:
2007-09-07 23:17:30 +02:00
NoCaseCompare();
~NoCaseCompare();
2007-09-08 00:25:30 +02:00
bool operator() ( const string& s, const string& t ) const
2007-09-07 23:17:30 +02:00
{
2007-09-08 00:25:30 +02:00
return lexicographical_compare (
s.begin(), s.end(),
t.begin(), t.end(),
noCaseCompare );
2007-09-07 23:17:30 +02:00
}
2007-09-08 00:25:30 +02:00
private:
static bool noCaseCompare ( char c1, char c2 )
2007-09-07 23:17:30 +02:00
{
2007-09-08 00:25:30 +02:00
return toupper ( c1 ) < toupper ( c2 );
2007-09-07 23:17:30 +02:00
}
};