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 
00049 class Keywords {
00050 public:
00051     // convenience types
00052     typedef string keyword;
00053     typedef string keyword_value;
00054     typedef set<keyword_value> value_set_t;
00055 
00056 private:
00058     map<keyword, keyword_value> d_parsed_keywords;
00059 
00061     map<keyword, value_set_t> d_known_keywords;
00062 
00063     virtual void m_add_keyword(const keyword &word, const keyword_value &value);
00064     virtual bool m_is_valid_keyword(const keyword &word, const keyword_value &value) const;
00065 
00066 public:
00067     Keywords();
00068     virtual ~Keywords();
00069 
00070     virtual string parse_keywords(const string &ce);
00071 
00072     // Is this keyword in the dictionary?
00073     virtual bool is_known_keyword(const string &s) const;
00074 
00075     // Get a list of all of the keywords parsed
00076     virtual list<keyword> get_keywords() const;
00077     // Has a particular keyword been parsed
00078     virtual bool has_keyword(const keyword &kw) const;
00079 
00080     // Get the parsed keyword (and it's dictionary value) of a particular kind
00081     virtual keyword_value get_keyword_value(const keyword &kw) const;
00082 };
00083 
00084 }
00085 
00086 #endif /* KEYWORDS_H_ */