Wolframe, 0.0.3

ddlParseStack.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_SERIALIZE_DDL_PARSE_STACK_HPP_INCLUDED
36 #define _Wolframe_SERIALIZE_DDL_PARSE_STACK_HPP_INCLUDED
37 #include "filter/typedfilter.hpp"
38 #include "types/variantStruct.hpp"
40 #include <vector>
41 #include <stdexcept>
42 
43 namespace _Wolframe {
44 namespace serialize {
45 
49 {
50 public:
53  :m_size(o.m_size)
55  ,m_value(o.m_value)
57  ,m_name(o.m_name)
59  {}
60 
63  :m_size(0)
64  ,m_elemidx(0)
65  ,m_value(v)
66  ,m_normalizer(n)
67  ,m_name(name_)
68  ,m_stateidx(0)
69  {}
70 
73 
76  {
77  return m_value;
78  }
79 
81  const char* name() const
82  {
83  return m_name;
84  }
85 
87  void state( std::size_t idx)
88  {
89  m_stateidx = idx;
90  }
91 
93  std::size_t state() const
94  {
95  return m_stateidx;
96  }
97 
100  {
101  return m_normalizer;
102  }
103 
104 private:
105  std::size_t m_size;
106  std::size_t m_elemidx;
109  const char* m_name;
110  std::size_t m_stateidx;
111 };
112 
114 typedef std::vector<DDLParseState> DDLParseStateStack;
115 
116 
117 }}//namespace
118 #endif
119 
State stack element for an initializer of a DDL structure from an iterator (serialization) ...
Definition: ddlParseStack.hpp:48
types::VariantStruct * m_value
Definition: ddlParseStack.hpp:107
DDLParseState(const DDLParseState &o)
Copy constructor.
Definition: ddlParseStack.hpp:52
std::size_t m_size
Definition: ddlParseStack.hpp:105
Normalize function definition.
Structure of variant type atoms or substructures.
Definition: variantStruct.hpp:57
const char * m_name
Definition: ddlParseStack.hpp:109
std::size_t m_elemidx
Definition: ddlParseStack.hpp:106
const types::NormalizeFunction * m_normalizer
Definition: ddlParseStack.hpp:108
std::size_t m_stateidx
Definition: ddlParseStack.hpp:110
DDLParseState(const char *name_, types::VariantStruct *v, const types::NormalizeFunction *n)
Constructor.
Definition: ddlParseStack.hpp:62
types::VariantStruct * value() const
Reference to the substructure visited in this state.
Definition: ddlParseStack.hpp:75
Basic normalization function for atomic values (variant type)
Definition: normalizeFunction.hpp:52
std::size_t state() const
Get the internal state.
Definition: ddlParseStack.hpp:93
void state(std::size_t idx)
Set the internal state.
Definition: ddlParseStack.hpp:87
std::vector< DDLParseState > DDLParseStateStack
State stack for an initializer of a DDL structure from an iterator (serialization) ...
Definition: ddlParseStack.hpp:114
~DDLParseState()
Destructor.
Definition: ddlParseStack.hpp:72
const char * name() const
Reference name of the substructure visited in this state.
Definition: ddlParseStack.hpp:81
Structures of variant types.
Typed interface for input/output filter.
const types::NormalizeFunction * normalizer() const
Get the normalizer function of the value node of this state.
Definition: ddlParseStack.hpp:99