Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

FBwUpper.h

00001 #ifndef FBwUpperHH
00002 #define FBwUpperHH  0
00003 
00004 #include <functional>
00005 #include <algorithm>
00006 #include <ctype.h>
00007 
00008 namespace fbwrap
00009 {
00010 
00011 struct char_nc_cmp : std::binary_function<char,char, bool>
00012 {
00013     bool operator()(const char &c1, const char &c2) const
00014     {
00015         return toupper(c1)==toupper(c2);
00016     }
00017 };
00018 
00019 struct char_upper : std::unary_function<char,char>
00020 {
00021     char operator()(const char &c1) const
00022     {
00023         return toupper(c1);
00024     }
00025 };
00026 
00027 inline bool nc_cmp(string s,char *t)    
00028 {
00029     return std::equal(s.begin(),s.end(),t,char_nc_cmp());
00030 }
00031 inline bool nc_cmp(string s,string t)   
00032 {
00033     return std::equal(s.begin(),s.end(),t.begin(),char_nc_cmp());
00034 }
00035 
00036 inline void uppercase(string &s)
00037 {
00038     std::transform(s.begin(),s.end(),s.begin(),char_upper());
00039 }
00040 
00041 // ----------------------------------------------------------------------------
00042 // namespace end
00043 }
00044 
00045 #endif 

Generated on Fri Jan 31 08:30:02 2003 for fbwrap by doxygen1.2.17