libdap++  Updated for version 3.8.2
Keywords2.h
Go to the documentation of this file.
00001 // -*- mode: c++; c-basic-offset:4 -*-
00002 
00003 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
00004 // Access Protocol.
00005 
00006 // Copyright (c) 2011 OPeNDAP, Inc.
00007 // Author: James Gallagher <jgallagher@opendap.org>
00008 //
00009 // This library is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU Lesser General Public
00011 // License as published by the Free Software Foundation; either
00012 // version 2.1 of the License, or (at your option) any later version.
00013 //
00014 // This library 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 GNU
00017 // Lesser General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU Lesser General Public
00020 // License along with this library; if not, write to the Free Software
00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //
00023 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
00024 
00025 #ifndef KEYWORDS_H_
00026 #define KEYWORDS_H_
00027 
00028 #include <string>
00029 #include <set>
00030 #include <map>
00031 #include <list>
00032 
00033 using namespace std;
00034 
00035 namespace libdap {
00036 
00052 class Keywords {
00053 public:
00054     // convenience types
00055     typedef string keyword;
00056     typedef string keyword_value;
00057     typedef set<keyword_value> value_set_t;
00058 
00059 private:
00061     map<keyword, keyword_value> d_parsed_keywords;
00062 
00064     map<keyword, value_set_t> d_known_keywords;
00065 
00066     virtual void m_add_keyword(const keyword &word, const keyword_value &value);
00067     virtual bool m_is_valid_keyword(const keyword &word, const keyword_value &value) const;
00068 
00069 public:
00070     Keywords();
00071     virtual ~Keywords();
00072 
00073     virtual string parse_keywords(const string &ce);
00074 
00075     // Is this keyword in the dictionary?
00076     virtual bool is_known_keyword(const string &s) const;
00077 
00078     // Get a list of all of the keywords parsed
00079     virtual list<keyword> get_keywords() const;
00080     // Has a particular keyword been parsed
00081     virtual bool has_keyword(const keyword &kw) const;
00082 
00083     // Get the parsed keyword (and it's dictionary value) of a particular kind
00084     virtual keyword_value get_keyword_value(const keyword &kw) const;
00085 };
00086 
00087 }
00088 
00089 #endif /* KEYWORDS_H_ */