Pattern.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *
00003  * Copyright (C) 2009-2010 Cassio Neri Moreira
00004  *
00005  * This file is part of the KeyValue library.
00006  *
00007  * The KeyValue library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License as published
00009  * by the Free Software Foundation, either version 3 of the License, or (at
00010  * your option) any later version.
00011  *
00012  * The KeyValue library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
00015  * Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License along
00018  * with KeyValue. If not, see <http://www.gnu.org/licenses/>.
00019  *
00020  **************************************************************************/
00021 
00029 #ifndef KEYVALUE_PATTERN_PATTERN_H_
00030 #define KEYVALUE_PATTERN_PATTERN_H_
00031 
00032 #include <boost/utility.hpp>
00033 
00034 #include "keyvalue/extern/String.h"
00035 #include "keyvalue/value/Value.h"
00036 
00037 namespace keyvalue {
00038 
00039 // Forward declarations
00040 
00041 namespace frontend {
00042   class Queue;
00043 }
00044 
00049 namespace pattern {
00050 
00063 class Pattern : private boost::noncopyable {
00064 
00065 public:
00066 
00079   virtual bool
00080   parse(frontend::Queue& queue) = 0;
00081 
00093   virtual std::pair<string, value::Value>
00094   pop() = 0;
00095 
00102   virtual bool
00103   isEmpty() const = 0;
00104 
00105 protected:
00106 
00116   class QueueRaii {
00117 
00118   public:
00119 
00126     QueueRaii(frontend::Queue& queue);
00127     ~QueueRaii();
00128 
00129   private:
00130 
00131     frontend::Queue& queue_;
00132 
00133   }; // class QueueRaii
00134 
00135 }; // class Pattern
00136 
00153 bool
00154 isKey(const value::Variant& variant);
00155 
00179 string
00180 getKey(const value::Variant& variant);
00181 
00182 } // namespace pattern
00183 } // namespace keyvalue
00184 
00185 #endif // KEYVALUE_PATTERN_PATTERN_H_

Generated on Sat Mar 20 15:08:29 2010 for KeyValue by  doxygen 1.6.1