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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>InspIRCd: hashcomp.h Source File</title>
<link href="inspircd.doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.3 -->
<div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Compound List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Compound Members</a> | <a class="qindex" href="globals.html">File Members</a></div>
<h1>hashcomp.h</h1><a href="hashcomp_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* +------------------------------------+</span>
00002 <span class="comment"> * | Inspire Internet Relay Chat Daemon |</span>
00003 <span class="comment"> * +------------------------------------+</span>
00004 <span class="comment"> *</span>
00005 <span class="comment"> * Inspire is copyright (C) 2002-2005 ChatSpike-Dev.</span>
00006 <span class="comment"> * E-mail:</span>
00007 <span class="comment"> * <brain@chatspike.net></span>
00008 <span class="comment"> * <Craig@chatspike.net></span>
00009 <span class="comment"> *</span>
00010 <span class="comment"> * Written by Craig Edwards, Craig McLure, and others.</span>
00011 <span class="comment"> * This program is free but copyrighted software; see</span>
00012 <span class="comment"> * the file COPYING for details.</span>
00013 <span class="comment"> *</span>
00014 <span class="comment"> * ---------------------------------------------------</span>
00015 <span class="comment"> */</span>
00016
00017 <span class="preprocessor">#ifndef _HASHCOMP_H_</span>
00018 <span class="preprocessor"></span><span class="preprocessor">#define _HASHCOMP_H_</span>
00019 <span class="preprocessor"></span>
00020 <span class="preprocessor">#include "inspircd_config.h"</span>
00021
00022 <span class="comment">/*******************************************************</span>
00023 <span class="comment"> * This file contains classes and templates that deal</span>
00024 <span class="comment"> * with the comparison and hashing of 'irc strings'.</span>
00025 <span class="comment"> * An 'irc string' is a string which compares in a</span>
00026 <span class="comment"> * case insensitive manner, and as per RFC 1459 will</span>
00027 <span class="comment"> * treat [ identical to {, ] identical to }, and \</span>
00028 <span class="comment"> * as identical to |.</span>
00029 <span class="comment"> *</span>
00030 <span class="comment"> * Our hashing functions are designed to accept</span>
00031 <span class="comment"> * std::string and compare/hash them as type irc::string</span>
00032 <span class="comment"> * by converting them internally. This makes them</span>
00033 <span class="comment"> * backwards compatible with other code which is not</span>
00034 <span class="comment"> * aware of irc::string.</span>
00035 <span class="comment"> *******************************************************/</span>
00036
00037 <span class="preprocessor">#ifdef GCC3</span>
00038 <span class="preprocessor"></span><span class="preprocessor">#include <ext/hash_map></span>
00039 <span class="preprocessor">#else</span>
00040 <span class="preprocessor"></span><span class="preprocessor">#include <hash_map></span>
00041 <span class="preprocessor">#endif</span>
00042 <span class="preprocessor"></span>
00043 <span class="preprocessor">#ifdef GCC3</span>
<a name="l00044"></a><a class="code" href="hashcomp_8h.html#a0">00044</a> <span class="preprocessor"></span><span class="preprocessor">#define nspace __gnu_cxx</span>
00045 <span class="preprocessor"></span><span class="preprocessor">#else</span>
00046 <span class="preprocessor"></span><span class="preprocessor">#define nspace std</span>
00047 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00048 <span class="preprocessor"></span>
00049 <span class="keyword">using</span> <span class="keyword">namespace </span>std;
00050
<a name="l00051"></a><a class="code" href="namespacenspace.html">00051</a> <span class="keyword">namespace </span><a class="code" href="channels_8cpp.html#a0">nspace</a>
00052 {
00053 <span class="preprocessor">#ifdef GCC34</span>
00054 <span class="preprocessor"></span> <span class="keyword">template</span><> <span class="keyword">struct </span>hash<in_addr>
00055 #else
<a name="l00056"></a><a class="code" href="structnspace_1_1nspace_1_1hash_3_01in__addr_01_4.html">00056</a> template<> struct <a class="code" href="channels_8cpp.html#a0">nspace</a>::hash<in_addr>
00057 #endif
00058 {
00059 size_t operator()(<span class="keyword">const</span> <span class="keyword">struct</span> in_addr &a) <span class="keyword">const</span>;
00060 };
00061 <span class="preprocessor">#ifdef GCC34</span>
00062 <span class="preprocessor"></span> <span class="keyword">template</span><> <span class="keyword">struct </span>hash<<a class="code" href="namespaceirc.html#a0">string</a>>
00063 #else
<a name="l00064"></a><a class="code" href="structnspace_1_1nspace_1_1hash_3_01string_01_4.html">00064</a> template<> struct <a class="code" href="channels_8cpp.html#a0">nspace</a>::hash<string>
00065 #endif
00066 {
00067 size_t operator()(<span class="keyword">const</span> <a class="code" href="namespaceirc.html#a0">string</a> &s) <span class="keyword">const</span>;
00068 };
00069 }
00070
<a name="l00073"></a><a class="code" href="namespaceirc.html">00073</a> <span class="keyword">namespace </span>irc
00074 {
00075
<a name="l00080"></a><a class="code" href="structirc_1_1StrHashComp.html">00080</a> <span class="keyword">struct </span><a class="code" href="structirc_1_1StrHashComp.html">StrHashComp</a>
00081 {
00084 <span class="keywordtype">bool</span> <a class="code" href="structirc_1_1StrHashComp.html#a0">operator()</a>(<span class="keyword">const</span> std::string& s1, <span class="keyword">const</span> std::string& s2) <span class="keyword">const</span>;
00085 };
00086
00087
<a name="l00092"></a><a class="code" href="structirc_1_1InAddr__HashComp.html">00092</a> <span class="keyword">struct </span><a class="code" href="structirc_1_1InAddr__HashComp.html">InAddr_HashComp</a>
00093 {
00096 <span class="keywordtype">bool</span> <a class="code" href="structirc_1_1InAddr__HashComp.html#a0">operator()</a>(<span class="keyword">const</span> in_addr &s1, <span class="keyword">const</span> in_addr &s2) <span class="keyword">const</span>;
00097 };
00098
00099
<a name="l00104"></a><a class="code" href="structirc_1_1irc__char__traits.html">00104</a> <span class="keyword">struct </span><a class="code" href="structirc_1_1irc__char__traits.html">irc_char_traits</a> : std::char_traits<char> {
00105
00108 <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="structirc_1_1irc__char__traits.html#e0">eq</a>(<span class="keywordtype">char</span> c1st, <span class="keywordtype">char</span> c2nd);
00109
00112 <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="structirc_1_1irc__char__traits.html#e1">ne</a>(<span class="keywordtype">char</span> c1st, <span class="keywordtype">char</span> c2nd);
00113
00116 <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="structirc_1_1irc__char__traits.html#e2">lt</a>(<span class="keywordtype">char</span> c1st, <span class="keywordtype">char</span> c2nd);
00117
00120 <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="structirc_1_1irc__char__traits.html#e3">compare</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* str1, <span class="keyword">const</span> <span class="keywordtype">char</span>* str2, size_t n);
00121
00124 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="structirc_1_1irc__char__traits.html#e4">find</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* s1, <span class="keywordtype">int</span> n, <span class="keywordtype">char</span> c);
00125 };
00126
<a name="l00129"></a><a class="code" href="namespaceirc.html#a0">00129</a> <span class="keyword">typedef</span> basic_string<char, irc_char_traits, allocator<char> > <a class="code" href="namespaceirc.html#a0">string</a>;
00130 }
00131
00132 <span class="preprocessor">#endif</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed May 25 21:42:13 2005 for InspIRCd by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 >
</a>1.3.3 </small></address>
</body>
</html>
|