Wolframe, 0.0.3

structParser.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 #ifndef _Wolframe_SERIALIZE_STRUCT_PARSER_HPP_INCLUDED
35 #define _Wolframe_SERIALIZE_STRUCT_PARSER_HPP_INCLUDED
37 
38 namespace _Wolframe {
39 namespace serialize {
40 
44 {
45 public:
46  typedef boost::shared_ptr<void> ObjectReference;
47 
49  StructParser( void* obj, const StructDescriptionBase* descr);
53  StructParser( const StructParser& o);
55  virtual ~StructParser(){}
56 
58  static std::string getElementPath( const ParseStateStack& stk);
59 
62 
64  const ObjectReference& object() const {return m_obj;}
66  const StructDescriptionBase* descr() const {return m_descr;}
67 
70  bool call();
71 
72 private:
73  void* m_ptr;
79 };
80 
81 }}//namespace
82 #endif
83 
State stack for an initializer of a structure.
Definition: parseStack.hpp:80
Base class for structure description used for introspection in serialization/deserialization.
Definition: structDescriptionBase.hpp:51
langbind::TypedInputFilterR m_inp
Definition: structParser.hpp:77
StructParser(void *obj, const StructDescriptionBase *descr)
Constructor.
Initializer of a structure based on a structure description feeded with a serialization.
Definition: structParser.hpp:43
Context m_ctx
Definition: structParser.hpp:76
const ObjectReference & object() const
Get a shared reference of the parsed objects base pointer.
Definition: structParser.hpp:64
const StructDescriptionBase * m_descr
Definition: structParser.hpp:75
void init(const langbind::TypedInputFilterR &i, serialize::Flags::Enum flags=serialize::Flags::None)
Parser start initialization.
ParseStateStack m_stk
Definition: structParser.hpp:78
boost::shared_ptr< TypedInputFilter > TypedInputFilterR
Shared input filter (langbind::TypedInputFilter) reference.
Definition: typedfilter.hpp:98
ObjectReference m_obj
Definition: structParser.hpp:74
void * m_ptr
Definition: structParser.hpp:73
Enum
the enumeration that can also be interpreted as bit set
Definition: flags.hpp:47
virtual ~StructParser()
Destructor.
Definition: structParser.hpp:55
const StructDescriptionBase * descr() const
Get the structure description of the parsed object.
Definition: structParser.hpp:66
static std::string getElementPath(const ParseStateStack &stk)
Get the current element path defined by the stack 'stk' as string for error messages.
Defines the non intrusive base class of serialization/deserialization of objects interfaced as TypedI...
Empty flag set (no flags set)
Definition: flags.hpp:49
Global state variables of a running serialization/deserialization procedure (without the stack) ...
Definition: mapContext.hpp:46
boost::shared_ptr< void > ObjectReference
Definition: structParser.hpp:46
bool call()
Call of one processing step the parser.