summaryrefslogtreecommitdiff
path: root/src/mt/msmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mt/msmap.h')
-rw-r--r--src/mt/msmap.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/mt/msmap.h b/src/mt/msmap.h
new file mode 100644
index 0000000..a719a7b
--- /dev/null
+++ b/src/mt/msmap.h
@@ -0,0 +1,89 @@
1/*************************************************************************
2 *
3 * HTCd - Copyright (C) 1998-2006 Henrik Rydberg
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef MSMAPH
21#define MSMAPH
22
23#include <mt/mstring.h>
24#include <mt/mvec.h>
25
26struct rrstring {
27 sref first,second;
28 rrstring() : first(),second() {}
29 explicit rrstring(const sref& a) : first(a),second() {}
30 rrstring(const sref& a,const sref& b) : first(a),second(b) {}
31};
32inline bool operator<(const rrstring& a,const rrstring& b) { return a.first<b.first; }
33
34typedef mrvec<rrstring> rrpile;
35
36struct rrmap : public rrpile
37{
38 typedef rrpile::iterator iterator;
39 typedef rrpile::const_iterator const_iterator;
40
41 const sref* get(const sref& t) const;
42 const sref* add(const sref& t,const sref& s);
43 void sort();
44};
45
46//////////////////////////////////////////////////////////////////
47
48struct rimap_t {
49 sref name;
50 int at;
51 rimap_t() : name(),at(0) {}
52 explicit rimap_t(const sref& a) : name(a),at(0) {}
53 rimap_t(const sref& a,int p) : name(a),at(p) {}
54};
55inline bool operator<(const rimap_t& a,const rimap_t& b) { return a.name<b.name; }
56
57struct rimap : public mrvec<rimap_t>
58{
59 typedef mrvec<rimap_t>::iterator iterator;
60 typedef mrvec<rimap_t>::const_iterator const_iterator;
61
62 int get(const sref& t) const;
63 int add(const sref& t,int at);
64 void sort();
65};
66
67//////////////////////////////////////////////////////////////////
68
69struct sstring {
70 mstring first,second;
71 sstring() : first(),second() {}
72 explicit sstring(const mstring& a) : first(a),second() {}
73 sstring(const mstring& a,const mstring& b) : first(a),second(b) {}
74};
75inline bool operator<(const sstring& a,const sstring& b) { return a.first<b.first; }
76
77typedef msvec<sstring> sspile;
78
79struct ssmap : public sspile
80{
81 typedef sspile::iterator iterator;
82 typedef sspile::const_iterator const_iterator;
83
84 const mstring* get(const mstring& t) const;
85 const mstring* add(const mstring& t,const mstring& s);
86 void sort();
87};
88
89#endif