diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2011-10-08 20:30:28 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2011-10-08 20:30:28 +0200 |
| commit | 5df79c53745fde5d6c3340a2979b1429cd5892c1 (patch) | |
| tree | 1a81af141708b826e9c61e8a04019994fcca8298 /src/mt/msmap.h | |
Initial import of htcd system 1.0
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/mt/msmap.h')
| -rw-r--r-- | src/mt/msmap.h | 89 |
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 | |||
| 26 | struct 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 | }; | ||
| 32 | inline bool operator<(const rrstring& a,const rrstring& b) { return a.first<b.first; } | ||
| 33 | |||
| 34 | typedef mrvec<rrstring> rrpile; | ||
| 35 | |||
| 36 | struct 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 | |||
| 48 | struct 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 | }; | ||
| 55 | inline bool operator<(const rimap_t& a,const rimap_t& b) { return a.name<b.name; } | ||
| 56 | |||
| 57 | struct 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 | |||
| 69 | struct 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 | }; | ||
| 75 | inline bool operator<(const sstring& a,const sstring& b) { return a.first<b.first; } | ||
| 76 | |||
| 77 | typedef msvec<sstring> sspile; | ||
| 78 | |||
| 79 | struct 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 | ||
