Tanl Linguistic Pipeline |
00001 /* 00002 ** IXE 00003 ** Common/KeyValuePairs.h 00004 ** ---------------------------------------------------------------------- 00005 ** Copyright (c) 2004 Giuseppe Attardi (attardi@di.unipi.it). 00006 ** ---------------------------------------------------------------------- 00007 ** 00008 ** This file is part of IXE. 00009 ** 00010 ** IXE is free software; you can redistribute it and/or modify it 00011 ** under the terms of the GNU General Public License, version 3, 00012 ** as published by the Free Software Foundation. 00013 ** 00014 ** IXE is distributed in the hope that it will be useful, 00015 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 ** GNU General Public License for more details. 00018 ** 00019 ** You should have received a copy of the GNU General Public License 00020 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00021 ** ---------------------------------------------------------------------- 00022 */ 00023 00024 #ifndef IXE_KeyValuePairs_H 00025 #define IXE_KeyValuePairs_H 00026 00027 // local 00028 #include "include/ixe.h" 00029 #include "text/less.h" 00030 00031 // standard 00032 #include <map> 00033 00034 namespace IXE { 00035 00042 class KeyValuePairs : public std::multimap<char const*, char const*> 00043 { 00044 public: 00045 KeyValuePairs(char const* query) { 00046 FillFromQueryString(query); 00047 } 00048 00049 ~KeyValuePairs(); 00050 00051 bool ContainsKey(char const* key) { 00052 return find(key) != end(); 00053 } 00054 00058 char const* operator[](char const* key) { 00059 const_iterator found = find(key); 00060 return (found == end()) ? 0 : found->second; 00061 } 00062 00069 void FillFromQueryString(char const* query); 00070 }; 00071 00072 } // namespace IXE 00073 00074 #endif /* IXE_KeyValuePairs_H */