Wolframe, 0.0.3

inputfilterScope.hpp
Go to the documentation of this file.
1 /************************************************************************
2 Copyright (C) 2011 - 2014 Project Wolframe.
3 All rights reserved.
4 
5 This file is part of Project Wolframe.
6 
7 Commercial Usage
8 Licensees holding valid Project Wolframe Commercial licenses may
9 use this file in accordance with the Project Wolframe
10 Commercial License Agreement provided with the Software or,
11 alternatively, in accordance with the terms contained
12 in a written agreement between the licensee and Project Wolframe.
13 
14 GNU General Public License Usage
15 Alternatively, you can redistribute this file and/or modify it
16 under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19 
20 Wolframe is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
24 
25 You should have received a copy of the GNU General Public License
26 along with Wolframe. If not, see <http://www.gnu.org/licenses/>.
27 
28 If you have questions regarding the use of this file, please contact
29 Project Wolframe.
30 
31 ************************************************************************/
34 
35 #ifndef _Wolframe_FILTER_INPUTFILTER_SCOPE_HPP_INCLUDED
36 #define _Wolframe_FILTER_INPUTFILTER_SCOPE_HPP_INCLUDED
37 #include "filter/inputfilter.hpp"
38 #include <stdexcept>
39 
40 namespace _Wolframe {
41 namespace langbind {
42 
46 {
47 public:
50  :InputFilter("scope")
51  ,m_taglevel(0){}
52 
54  explicit InputFilterScope( const InputFilterR& i)
55  :InputFilter(i->name())
56  ,m_inputfilter(i)
57  ,m_taglevel(1)
58  {
59  InputFilterScope* prev = dynamic_cast<InputFilterScope*>(i.get());
60  if (prev) m_inputfilter = prev->inputfilter();
61  }
62 
66  :InputFilter(o)
69 
71  virtual ~InputFilterScope(){}
72 
75  virtual InputFilter* copy() const
76  {
77  return new InputFilterScope(*this);
78  }
79 
81  virtual void putInput( const void*, std::size_t, bool)
82  {
83  throw std::logic_error( "put input to an input filter scope");
84  }
85 
87  {
88  return m_inputfilter->getMetaData();
89  }
90 
97  virtual bool getNext( ElementType& type, const void*& element, std::size_t& elementsize);
98 
100 
101 private:
104 };
105 
106 }}//namespace
107 #endif
108 
109 
virtual void putInput(const void *, std::size_t, bool)
Implement InputFilter::putInput(const void*,std::size_t,bool)
Definition: inputfilterScope.hpp:81
InputFilterScope()
Constructor.
Definition: inputfilterScope.hpp:49
Document meta data representation.
Definition: docmetadata.hpp:46
virtual bool getNext(ElementType &type, const void *&element, std::size_t &elementsize)
Get next element.
const char * name() const
Get the name of the filter.
Definition: filterbase.hpp:129
virtual ~InputFilterScope()
Destructor.
Definition: inputfilterScope.hpp:71
InputFilterScope(const InputFilterScope &o)
Copy constructor.
Definition: inputfilterScope.hpp:65
InputFilterScope(const InputFilterR &i)
Constructor.
Definition: inputfilterScope.hpp:54
ElementType
Content element type that describes the role of the element in the structured input.
Definition: filterbase.hpp:66
Input filter.
Definition: inputfilter.hpp:51
InputFilterR m_inputfilter
Definition: inputfilterScope.hpp:102
const InputFilterR & inputfilter()
Definition: inputfilterScope.hpp:99
OBJ * get() const
Get the pointer to the object.
Definition: sharedReference.hpp:88
Interface for input filter.
virtual const types::DocMetaData * getMetaData()
Get the document meta data if available.
Definition: inputfilterScope.hpp:86
virtual InputFilter * copy() const
Get a self copy.
Definition: inputfilterScope.hpp:75
int m_taglevel
Definition: inputfilterScope.hpp:103
InputFilter that stops fetching elements after the creation tag level has been left.
Definition: inputfilterScope.hpp:45