ircproxy The Ultimate Cyborg |
Definition in file IRC_compare.h.
#include <cstddef>
#include <string>
#include "ircd_chattr.h"
Go to the source code of this file.
Classes | |
struct | IRC_less |
Functor to compare strings with IRCStringCompare. More... | |
Functions | |
int | IRCStringCompare (char c1, char c2) |
Compare two IRC characters in a 'case insensitive' way. | |
bool | IRC_compare (char c1, char c2) |
Compare two IRC characters in a 'case insensitive' way. | |
int | IRCStringCompare (char const *s1, char const *s2) |
Compare two whole IRC strings in a 'case insensitive' way. | |
int | IRCStringCompare (char const *s1, char const *s2, size_t count) |
Compare the first count characters of two IRC strings in a 'case insensitive' way. | |
int | IRCStringCompare (std::string const &s1, std::string const &s2) |
Compare two whole IRC strings in a 'case insensitive' way. | |
int | IRCStringCompare (std::string const &s1, std::string const &s2, size_t count) |
Compare the first count characters of two IRC strings in a 'case insensitive' way. | |
int | IRCStringCompare (std::string const &s1, char const *s2) |
Compare two whole IRC strings in a 'case insensitive' way. | |
int | IRCStringCompare (std::string const &s1, char const *s2, size_t count) |
Compare the first count characters of two IRC strings in a 'case insensitive' way. | |
int | IRCStringCompare (char const *s1, std::string const &s2) |
Compare two whole IRC strings in a 'case insensitive' way. | |
int | IRCStringCompare (char const *s1, std::string const &s2, size_t count) |
Compare the first count characters of two IRC strings in a 'case insensitive' way. |
int IRCStringCompare | ( | char | c1, | |
char | c2 | |||
) | [inline] |
Compare two IRC characters in a 'case insensitive' way.
Definition at line 29 of file IRC_compare.h.
00030 { 00031 int lc1 = static_cast<unsigned char>(ToLower(c1)); 00032 int lc2 = static_cast<unsigned char>(ToLower(c2)); 00033 if (lc1 < lc2) 00034 return -1; 00035 if (lc1 > lc2) 00036 return 1; 00037 return 0; 00038 }
bool IRC_compare | ( | char | c1, | |
char | c2 | |||
) | [inline] |
Compare two IRC characters in a 'case insensitive' way.
Definition at line 43 of file IRC_compare.h.
00044 { 00045 return static_cast<unsigned char>(ToLower(c1)) < static_cast<unsigned char>(ToLower(c2)); 00046 }
int IRCStringCompare | ( | char const * | s1, | |
char const * | s2 | |||
) |
Compare two whole IRC strings in a 'case insensitive' way.
Definition at line 25 of file IRC_compare.cc.
Referenced by ServerSession::detected_network(), ServerSession::found_network_name(), IRCStringCompare(), IRC_less::operator()(), and Identity::received_network_domain_answer().
00026 { 00027 while (ToLower(*s1) == ToLower(*s2)) 00028 { 00029 if (!*s1++) 00030 return 0; 00031 else 00032 ++s2; 00033 } 00034 return static_cast<unsigned char>(ToLower(*s1)) - static_cast<unsigned char>(ToLower(*s2)); 00035 }
int IRCStringCompare | ( | char const * | s1, | |
char const * | s2, | |||
size_t | count | |||
) |
Compare the first count characters of two IRC strings in a 'case insensitive' way.
Definition at line 37 of file IRC_compare.cc.
00038 { 00039 if (count == 0) 00040 return 0; 00041 while (--count != 0 && ToLower(*s1) == ToLower(*s2)) 00042 { 00043 if (!*s1++) 00044 return 0; 00045 else 00046 ++s2; 00047 } 00048 return static_cast<unsigned char>(ToLower(*s1)) - static_cast<unsigned char>(ToLower(*s2)); 00049 }
int IRCStringCompare | ( | std::string const & | s1, | |
std::string const & | s2 | |||
) | [inline] |
Compare two whole IRC strings in a 'case insensitive' way.
Definition at line 57 of file IRC_compare.h.
References IRCStringCompare().
00058 { 00059 return IRCStringCompare(s1.c_str(), s2.c_str()); 00060 }
int IRCStringCompare | ( | std::string const & | s1, | |
std::string const & | s2, | |||
size_t | count | |||
) | [inline] |
Compare the first count characters of two IRC strings in a 'case insensitive' way.
Definition at line 65 of file IRC_compare.h.
References IRCStringCompare().
00066 { 00067 return IRCStringCompare(s1.c_str(), s2.c_str(), count); 00068 }
int IRCStringCompare | ( | std::string const & | s1, | |
char const * | s2 | |||
) | [inline] |
Compare two whole IRC strings in a 'case insensitive' way.
Definition at line 71 of file IRC_compare.h.
References IRCStringCompare().
00072 { 00073 return IRCStringCompare(s1.c_str(), s2); 00074 }
int IRCStringCompare | ( | std::string const & | s1, | |
char const * | s2, | |||
size_t | count | |||
) | [inline] |
Compare the first count characters of two IRC strings in a 'case insensitive' way.
Definition at line 79 of file IRC_compare.h.
References IRCStringCompare().
00080 { 00081 return IRCStringCompare(s1.c_str(), s2, count); 00082 }
int IRCStringCompare | ( | char const * | s1, | |
std::string const & | s2 | |||
) | [inline] |
Compare two whole IRC strings in a 'case insensitive' way.
Definition at line 85 of file IRC_compare.h.
References IRCStringCompare().
00086 { 00087 return IRCStringCompare(s1, s2.c_str()); 00088 }
int IRCStringCompare | ( | char const * | s1, | |
std::string const & | s2, | |||
size_t | count | |||
) | [inline] |
Compare the first count characters of two IRC strings in a 'case insensitive' way.
Definition at line 93 of file IRC_compare.h.
References IRCStringCompare().
00094 { 00095 return IRCStringCompare(s1, s2.c_str(), count); 00096 }
Copyright © 2005-2007 Carlo Wood. All rights reserved. |
---|