Wolframe, 0.0.3

ddlCompilerInterface.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_DDL_COMPILER_INTERFACE_HPP_INCLUDED
36 #define _Wolframe_DDL_COMPILER_INTERFACE_HPP_INCLUDED
37 #include "types/form.hpp"
38 #include "types/variant.hpp"
39 #include <string>
40 #include <vector>
41 #include <boost/shared_ptr.hpp>
42 
43 namespace _Wolframe {
44 namespace langbind {
45 
49 {
51  DDLCompiler( const std::string& n, const std::string& e)
52  :m_ddlname(n),m_fileext(e) {}
54  virtual ~DDLCompiler(){}
55 
61  virtual std::vector<types::FormDescriptionR> compile( const std::string& filename, const types::NormalizeFunctionMap* typemap) const=0;
62 
64  const std::string& ddlname() const {return m_ddlname;}
65 
67  const std::string& fileext() const {return m_fileext;}
68 private:
69  std::string m_ddlname;
70  std::string m_fileext;
71 };
72 
74 typedef boost::shared_ptr<DDLCompiler> DDLCompilerR;
75 
77 typedef DDLCompiler* (*CreateDDLCompilerFunc)();
78 
79 
80 }}//namespace
81 #endif
boost::shared_ptr< DDLCompiler > DDLCompilerR
Reference to a DDL compiler.
Definition: ddlCompilerInterface.hpp:74
std::string m_ddlname
name of the data defintion language
Definition: ddlCompilerInterface.hpp:69
Defines the unified form data structure as defined by a DDL (data definition language). A form data structure represents the document unit of a wolframe request or answer.
Interface for DDL compilers.
Definition: ddlCompilerInterface.hpp:48
std::string m_fileext
file extension of a program of this data defintion language
Definition: ddlCompilerInterface.hpp:70
Variant value type.
virtual std::vector< types::FormDescriptionR > compile(const std::string &filename, const types::NormalizeFunctionMap *typemap) const =0
Compile a source from a string. Throws in case of error.
virtual ~DDLCompiler()
Destructor.
Definition: ddlCompilerInterface.hpp:54
Map of basic normalization functions for atomic values (variant type)
Definition: normalizeFunction.hpp:114
const std::string & ddlname() const
Get the name of the ddl this compiler is for.
Definition: ddlCompilerInterface.hpp:64
const std::string & fileext() const
Get the file extension for files implementing this DDL.
Definition: ddlCompilerInterface.hpp:67
DDLCompiler(const std::string &n, const std::string &e)
Constructor.
Definition: ddlCompilerInterface.hpp:51