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
|
/*************************************************************************
*
* HTCd - Copyright (C) 1998-2006 Henrik Rydberg
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MSMAPH
#define MSMAPH
#include <mt/mstring.h>
#include <mt/mvec.h>
struct rrstring {
sref first,second;
rrstring() : first(),second() {}
explicit rrstring(const sref& a) : first(a),second() {}
rrstring(const sref& a,const sref& b) : first(a),second(b) {}
};
inline bool operator<(const rrstring& a,const rrstring& b) { return a.first<b.first; }
typedef mrvec<rrstring> rrpile;
struct rrmap : public rrpile
{
typedef rrpile::iterator iterator;
typedef rrpile::const_iterator const_iterator;
const sref* get(const sref& t) const;
const sref* add(const sref& t,const sref& s);
void sort();
};
//////////////////////////////////////////////////////////////////
struct rimap_t {
sref name;
int at;
rimap_t() : name(),at(0) {}
explicit rimap_t(const sref& a) : name(a),at(0) {}
rimap_t(const sref& a,int p) : name(a),at(p) {}
};
inline bool operator<(const rimap_t& a,const rimap_t& b) { return a.name<b.name; }
struct rimap : public mrvec<rimap_t>
{
typedef mrvec<rimap_t>::iterator iterator;
typedef mrvec<rimap_t>::const_iterator const_iterator;
int get(const sref& t) const;
int add(const sref& t,int at);
void sort();
};
//////////////////////////////////////////////////////////////////
struct sstring {
mstring first,second;
sstring() : first(),second() {}
explicit sstring(const mstring& a) : first(a),second() {}
sstring(const mstring& a,const mstring& b) : first(a),second(b) {}
};
inline bool operator<(const sstring& a,const sstring& b) { return a.first<b.first; }
typedef msvec<sstring> sspile;
struct ssmap : public sspile
{
typedef sspile::iterator iterator;
typedef sspile::const_iterator const_iterator;
const mstring* get(const mstring& t) const;
const mstring* add(const mstring& t,const mstring& s);
void sort();
};
#endif
|